问题
I want to model the treatment effect over time on biological data using lmer()
to take into account the individual effect.
The procedure usually used is to build several models by deleting step by step fixed effects and interactions terms and then find the best models using anova(model1,model2)
and keeping the most parcimonious model when non significant difference are found.
However I've found different model fitness values (AIC, BIC..) between the output of summary(model1)
and anova (model1,model2)
.
Here is the code:
#Data are in z6
m1<-lmer(Brightness~factor(FT)*factor(Time)+(1|ID),z6)
m2<-lmer(Brightness~factor(FT)+factor(Time)+(1|ID),z6)
summary(m1)@AICtab
AIC BIC logLik deviance REMLdev
2284.223 2335.65 -1128.112 2301.36 2256.223
summary(m2)@AICtab
AIC BIC logLik deviance REMLdev
2298.247 2331.307 -1140.124 2302.42 2280.247
anova(m1,m2)
Data: z6
Models:
m2: Brightness ~ factor(FT) + factor(Time) + (1 | ID)
m1: Brightness ~ factor(FT) * factor(Time) + (1 | ID)
Df AIC BIC logLik Chisq Chi Df Pr(>Chisq)
m2 9 2320.4 2353.5 -1151.2
m1 14 2329.4 2380.8 -1150.7 1.0601 5 0.9576
There 14 AIC unit difference between the two model when comparing the summary()
output but only 9 in the anova()
. Where does this difference come from?
Thanks in advance.
回答1:
Your models have different fixed effects and hence fitting via REML is not appropriate for model comparisons of the type you show. The anova()
method knows this and computes ML estimates. The summary()
method uses the REML estimates (the latter is clearly indicated in the output).
Notice that the logLik
values are different in the two summaries and the anova()
output. The former is the REML log likelihood, the latter the ML likelihood. As AIC etc are a function of the log likelihood this is enough to account for the AIC differences reported.
The anova()
method can compute the ML estimates if the model(s) were not fitted via REML and hence does the right thing if the models compared differ in terms of their fixed effects.
If you are going to deploy these methods in your research I strongly suggest you read up on REML and ML estimation and their relative merits, uses etc if the above is news to you.
来源:https://stackoverflow.com/questions/12838087/difference-in-model-fitness-estimate-between-lmer-and-anova