[R] Why is AIC from lmer 2 less than that from lme?

Jon Olav Vik jonovik at start.no
Tue Mar 28 14:40:53 CEST 2006

```I'm migrating to lmer() from lme(). I have noticed that AIC values from
lmer() are 2 units smaller than those reported by lme(). Could someone

The issue can be replicated with the first example from Pinheiro & Bates
(2000) Mixed-effects models in S and S-plus.

library(nlme)
Rail2 <- Rail
summary(lme(travel~1,data=Rail2,random=~1|Rail)) # AIC = 128.177
detach(package:nlme)
library(Matrix)
lmer(travel~1+(1|Rail),data=Rail2) # AIC = 126.177

Output is given below. The parameter estimates, standard errors and log
likelihood seem virtually identical.

I'm using R 2.2.1 on Windows XP SP2 (details below), lmer() from Matrix
0.995-8, and lme() from nlme 3.1-68.1

Sincerely,
Jon Olav Vik

> library(nlme)
> summary(lme(travel~1,data=Rail,random=~1|Rail))
Linear mixed-effects model fit by REML
Data: Rail
AIC      BIC   logLik
128.177 130.6766 -61.0885

Random effects:
Formula: ~1 | Rail
(Intercept) Residual
StdDev:    24.80547 4.020779

Fixed effects: travel ~ 1
Value Std.Error DF  t-value p-value
(Intercept)  66.5  10.17104 12 6.538173       0

Standardized Within-Group Residuals:
Min          Q1         Med          Q3         Max
-1.61882658 -0.28217671  0.03569328  0.21955784  1.61437744

Number of Observations: 18
Number of Groups: 6

> library(Matrix)
> lmer(travel~1+(1|Rail),data=Rail)
Linear mixed-effects model fit by REML
Formula: travel ~ 1 + (1 | Rail)
Data: Rail
AIC      BIC   logLik MLdeviance REMLdeviance
126.177 127.9577 -61.0885   128.6251      122.177
Random effects:
Groups   Name        Variance Std.Dev.
Rail     (Intercept) 615.286  24.8050
Residual              16.167   4.0208
number of obs: 18, groups: Rail, 6

Fixed effects:
Estimate Std. Error t value
(Intercept)   66.500     10.171  6.5383

> version
_
platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
language R

```