David Barron-3 wrote: > > You can calculate the AIC as follows: > > (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) > aic1 <- AIC(logLik(fm1)) > >
Is AIC() [extractAIC()] "valid" for models with random effects? I noticed that the help page for extractAIC() does not list models with random effects. I think this boils down to the difference between the likelihoods for models with and without random effects, and I don't know. Just curious... > On 12/18/07, Peter H Singleton <[EMAIL PROTECTED]> 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? >> ______________________________________________ R-help@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 Hewitt Virginia Institute of Marine Science http://www.vims.edu/fish/students/dhewitt/ -- View this message in context: http://www.nabble.com/How-can-I-extract-the-AIC-score-from-a-mixed-model-object-produced-using-lmer--tp14406832p14419438.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.