[R] lmer- why do AIC, BIC, loglik change?
Darren M. Ward
Darren.M.Ward at Dartmouth.EDU
Wed Oct 18 22:21:11 CEST 2006
Hi all,
I am having issues comparing models with lmer. As an example, when
I run the code below the model summaries (AIC, BIC, loglik) differ between
the summary() and anova() commands. Can anyone clear up what's wrong?
Thank you!
Darren Ward
library(lme4)
data(sleepstudy)
fm1<-lmer(Reaction ~ Days + (1|Subject), sleepstudy)
summary(fm1)
fm2<-lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
summary(fm2)
anova(fm1, fm2)
Sample output:
> summary(fm1)
Linear mixed-effects model fit by REML
Formula: Reaction ~ Days + (1 | Subject)
Data: sleepstudy
AIC BIC logLik MLdeviance REMLdeviance
1792 1802 -893.2 1794 1786
> summary(fm2)
Linear mixed-effects model fit by REML
Formula: Reaction ~ Days + (Days | Subject)
Data: sleepstudy
AIC BIC logLik MLdeviance REMLdeviance
1754 1770 -871.8 1752 1744
> anova(fm1, fm2)
Data: sleepstudy
Models:
fm1: Reaction ~ Days + (1 | Subject)
fm2: Reaction ~ Days + (Days | Subject)
Df AIC BIC logLik Chisq Chi Df Pr(>Chisq)
fm1 3 1800.10 1809.68 -897.05
fm2 5 1761.98 1777.95 -875.99 42.115 2 7.158e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> sessionInfo()
R version 2.4.0 (2006-10-03)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
vegan lme4 Matrix lattice
"1.8-3" "0.9975-6" "0.9975-3" "0.14-9"
More information about the R-help
mailing list