[R] stepAIC for lmer
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Dec 4 14:27:14 CET 2006
On Mon, 4 Dec 2006, Marc Bernard wrote:
> Dear All,
>
> I am trying to use stepAIC for an lmer object but it doesn't work. Here is an example:
No, and it is not documented to work with lmer objects. stepAIC is
support software for a book, and lmer is not discussed in that book (and
postdates the book considerably). lmer does not return an object of the
type considered by stepAIC (it has an S4 class and it not at all similar
to e.g. glm).
>
> x1 <- gl(4,100)
> x2 <- gl(2,200)
> time <- rep(1:4,100)
> ID <- rep(1:100, each=4)
> Y <- runif(400) <=.5
> levels(Y) <- c(1,0)
> dfr <- as.data.frame(cbind(ID,Y,time,x1,x2))
>
>
> fm0.lmer <- lmer(Y ~ time+x1+x2 + (1|ID), data = dfr, family = binomial)
>
> fm.lmer <- stepAIC(fm0.lmer,scope = list(upper = ~I(time-6)*SF_0_N4*SEX, lower = ~1,trace = FALSE))
>
> I obtain the following error:
>
> Error in terms.default(object) : no terms component
>
> I would be very grateful for any suggestion,
>
> Bernard,
>
>
>
>
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
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