Skip to content
Prev 4455 / 20628 Next

lmer() vs. lme() gave different variance component estimates

Thank you Peter. Actually 3 people from mixed model mailing list tried my code 
using lmer(). They got the same results as what I got from lme4(). So they 
couldn't replicate my lmer() results:

Random effects:
Groups   Name        Variance Std.Dev.
eye:id   (Intercept) 3.59531  1.89613 
id       (Intercept) 3.51025  1.87357 
Residual             0.01875  0.13693 
Number of obs: 640, groups: eye:id, 160; id, 80

The only difference they can think of is they are using Mac and FreeBSD while 
mine is PC. I can't imagine this can be the reason. I re-install lme4 package, 
but still got weird results with lmer().

Per your suggestion, here is the results for aov()

summary(aov(score~trt+Error(id/eye), data=dat))

Error: id
          Df Sum Sq Mean Sq F value    Pr(>F)    
trt        7 1353.6 193.378   4.552 0.0002991 ***
Residuals 72 3058.7  42.482                      
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 

Error: id:eye
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals 80   1152    14.4               

Error: Within
           Df Sum Sq Mean Sq F value Pr(>F)
Residuals 480      9 0.01875

As can be seen, thr within subject variance estimate (0.01875) is the same 
between aov, lmer and lme. But I am not sure how to relate results between aov 
and lmer/lme for the other 2 variance components (id and eye%in%id).

Thanks

John






----- Original Message ----
From: Peter Dalgaard <pdalgd at gmail.com>
To: array chip <arrayprofile at yahoo.com>
Cc: r-help at r-project.org
Sent: Fri, September 17, 2010 1:05:27 PM
Subject: Re: [R] lmer() vs. lme() gave different variance component estimates
On 09/17/2010 09:14 PM, array chip wrote:
That's your guess... I'd be more careful about jumping to conclusions.
If this is a balanced data set, perhaps you could supply the result of

summary(aov(score~trt+Error(id/eye), data=dat))

The correct estimates should be computable from the ANOVA table.