[R] stepAIC/lme problem (1.7.0 only)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Apr 29 19:09:51 CEST 2003


On Mon, 28 Apr 2003, Prof Brian Ripley wrote:

> There are changes to improve scoping in stepAIC that assume that update
> works in ways that update.lme does not:
> 
> > mod2 <- addterm(mod1, ~(cov1+cov2)^2)
> Error in lme(fixed = resp ~ cov1 + cov2, data = a, random = structure(list( : 
>         unused argument(s) (evaluate ...)
> 
> The actual problem is in stepAIC which now has the line
> 
>     object$call$formula <- object$formula <- Terms
> 
> but fixing that one only opens up others (as above).
> 
> I was vaguely aware of this: I don't know of an easy fix.

I found one thanks to the magic of namespaces: see VR_7.1-5, shortly to be 
sent to CRAN.  As rw1070's install.packages() is broken and cannot install 
bundles, I have put a zip file for Windows at

http://www.stats.ox.ac.uk/pub/RWin/VR_7.1-5.zip

that you need to unzip in rw1070/library (perhaps by using zip.unpack in R).

> 
> 
> On Mon, 28 Apr 2003, Robert Cuffe wrote:
> 
> > 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
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > 
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list