Different variance estimates from lmer and lmer2
On 5/22/07, Jonathan Bartlett <Jonathan.Bartlett at lshtm.ac.uk> wrote:
For some mixed models, I get different variance estimates if I use lmer compared to using lmer2. Is there a reason why the two commands are giving quite different estimates?
The analysis below is from page 168 of "Extending the linear model with R" by Faraway, using the dataframe irrigation from the faraway package. Strangely, the results using lmer2 agree with the book, whereas lmer gives slightly different estimates.
I have am running R 2.5.0 with lme4 version 0.99875-0 on WinXP.
lmod <- lmer(yield ~ irrigation * variety + (1|field),data=irrigation)
summary(lmod)
Linear mixed-effects model fit by REML Formula: yield ~ irrigation * variety + (1 | field) Data: irrigation AIC BIC logLik MLdeviance REMLdeviance 63.4 70.35 -22.7 68.62 45.4 Random effects: Groups Name Variance Std.Dev. field (Intercept) 15.5182 3.9393 Residual 2.1919 1.4805 number of obs: 16, groups: field, 8 ....
lmod <- lmer2(yield ~ irrigation * variety +
(1|field),data=irrigation)
summary(lmod)
Linear mixed-effects model fit by REML Formula: yield ~ irrigation * variety + (1 | field) Data: irrigation AIC BIC logLik MLdeviance REMLdeviance 63.4 70.35 -22.70 68.61 45.39 Random effects: Groups Name Variance Std.Dev. field (Intercept) 16.1991 4.0248 Residual 2.1076 1.4518 Number of obs: 16, groups: field, 8
These differences are just reflecting different parameterizations and different convergence criteria for lmer and lmer2. Notice that the REML deviance for the model fit by lmer2 is slightly smaller than that fit by lmer (45.39 vs 45.4). If you add the optional argument control = list(msVerbose = 1) to the call to lmer and to lmer2 you will see that lmer2 takes more iterations and, as shown above, produces a slightly better criterion for the fit. Having said all this, I would note that a difference of 0.01 in the deviance is not going to be in any way significant. Essentially what all this is indicating is that the estimates of the variance components are not very precisely determined. It was probably after Julian fitted the models for his book that I made the change in lmer to loosen the convergence criterion in lmer somewhat. In retrospect that may not have been a good idea.
lmer2, the book and Stata's xtmixed give the estimate of the random intercept SD as 4.02, whereas lmer gives it as 3.94. My apologies if the reason for such differences is down to a mistake on my part - I was unable to find any postings on the list regarding this issue. Many thanks Jonathan London School of Hygiene and Tropical Medicine www.lshtm.ac.uk
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models