[R] ANOVA vs REML approach to variance component estimation

Douglas Bates dmbates at gmail.com
Mon Jun 13 01:54:42 CEST 2005


On 6/12/05, Adaikalavan Ramasamy <ramasamy at cancer.org.uk> wrote:
> Thank you for confirming this and introducing me to varcomp().
> 
> I have another question that I hope you or someone else can help me
> with. I was trying to generalise my codes for variable measurement
> levels and discovered that lme() was estimating the within group
> variance even with a single measure per subject for all subjects !
> 
> Here is an example where we have 12 animals but with single measurement.
> 
>   y  <- c(2.2, -1.4, -0.5, -0.3, -2.1, 1.5,
>           1.3, -0.3, 0.5, -1.4, -0.2, 1.8)
>   ID <- factor( 1:12 )
> 
> 
> Analysis of variance method correctly says that there is no residual
> variance and it equals to total variance.
> 
> summary(aov(y ~ ID))
>             Df  Sum Sq Mean Sq
> ID          11 20.9692  1.9063
> 
> 
> However the REML method is giving me a within animal variance when there
> is no replication at animal level. It seems like I can get components of
> variance for factors that are not replicated.
> 
> library(ape)
> varcomp(lme(y ~ 1, random = ~ 1 | ID))
>        ID    Within
> 1.6712661 0.2350218
> 
> Am I reading this correct and can someone kindly explain this to me ?

It's a spurious convergence in lme.  There is no check in lme for the
number of observations exceeding the number of groups.  There should
be.  I'll add this to the bug reports list.




More information about the R-help mailing list