[R] Specifying xlevels in effects library

John Fox jfox at mcmaster.ca
Thu Jun 10 03:52:21 CEST 2004

Dear David,

You don't have to change the model, but you do have to name the variable age
(or Age) consistently, and give a list as the xlevels argument. Hence, if
the variable names are really lower-case:   eff <- effect("sex*age", mod,


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of David 
> J. Netherway
> Sent: Wednesday, June 09, 2004 8:27 PM
> To: R-help at stat.math.ethz.ch
> Subject: Re: [R] Specifying xlevels in effects library
> Andy and John,
> I looked at typical when xlevels did not work but when I saw 
> that it was a function I went no further. Setting the 
> function to a constant was a good idea.
> John's method seems to require that I change the model:
>  > eff <-effect("sex*age",mod,xlevel=(Age=c(120,120)))
> Error in all(!(factors[, term1] & (!factors[, term2]))) : 
>         subscript out of bounds
> In addition: Warning message: 
> sex:age does not appear in the model in: effect("sex*age", 
> mod, xlevel = (age = c(120, 120))) 
> Andy's method works as suggested for this simple case.
> Thanks for your time.
> Cheers, David
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list