Re: [R] How can I extract the AIC score from a mixed model object produced using lmer?

From: David Barron <david.barron_at_sbs.ox.ac.uk>
Date: Tue, 18 Dec 2007 22:21:03 +0000

You can calculate the AIC as follows:

(fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) aic1 <- AIC(logLik(fm1))

Hope this helps.
Dave

On 12/18/07, Peter H Singleton <psingleton_at_fs.fed.us> wrote:
>
> I am running a series of candidate mixed models using lmer (package lme4)
> and I'd like to be able to compile a list of the AIC scores for those
> models so that I can quickly summarize and rank the models by AIC. When I
> do logistic regression, I can easily generate this kind of list by creating
> the model objects using glm, and doing:
>
> > md <- c("md1.lr", "md2.lr", "md3.lr")
> > aic <- c(md1.lr$aic, md2.lr$aic, md3.lr$aic)
> > aic2 <- cbind(md, aic)
>
> but when I try to extract the AIC score from the model object produced by
> lmer I get:
>
> > md1.lme$aic
> NULL
> Warning message:
> In md1.lme$aic : $ operator not defined for this S4 class, returning NULL
>
> So... How do I query the AIC value out of a mixed model object created by
> lmer?
>
> <<->><<->><<->><<->><<->><<->><<->>
> Peter Singleton
> USFS Pacific Northwest Research Station
> 1133 N. Western Ave.
> Wenatchee WA 98801
> Phone: (509)664-1732
> Fax: (509)665-8362
> E-mail: psingleton_at_fs.fed.us
>
> ______________________________________________
> R-help_at_r-project.org 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.
>

-- 
David Barron
Said Business School                 Jesus College
Park End Street                          Oxford
Oxford OX1 1HP                          OX1 3DW
01865 288906                              01865 279684

______________________________________________
R-help_at_r-project.org 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.
Received on Tue 18 Dec 2007 - 22:23:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 19 Dec 2007 - 16:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.