[R] stepAIC/lme problem (1.7.0 only)

Robert Cuffe cuffer at maths.tcd.ie
Mon Apr 28 16:06:13 CEST 2003


I can use stepAIC on an lme object in 1.6.2, but 
I get the following error if I try to do the same
in 1.7.0:

Error in lme(fixed = resp ~ cov1 + cov2, data = a, random = structure(list( : 
        unused argument(s) (formula ...)

Does anybody know why?

Here's an example:

library(nlme)
library(MASS)
a <- data.frame( resp=rnorm(250), cov1=rnorm(250),
                 cov2=rnorm(250), group=rep(letters[1:10],25) )
mod1 <- lme(resp~cov1, a, ~cov1|group, method="ML")
mod2 <- stepAIC(mod1, scope=list(upper=~(cov1+cov2)^2,
                                 lower=~cov1) )
					 
# it doesn't happen for normal linear models:

mod3 <- lm(resp~cov1, data=a)
mod4 <- stepAIC(mod3, scope=list(upper=~(cov1+cov2)^2,
                                 lower=~cov1) )

Thanks, 

Robert



More information about the R-help mailing list