[R] lme: extract variance estimate

Stephen Ellner spe2 at cornell.edu
Wed Jul 7 21:26:41 CEST 2004


Spencer Graves wrote: 

>     Have you considered "VarCorr"?  I've used it with "lme", and the 
>documentation in package lme4 suggests it should work with GLMM, which 
>might also do what you want from glmmPQL. 

Thanks for the pointer (I was not aware that nlme and lme4 had different
versions of lme), but I'm still stuck at the same place using lme4:> VarCorr(fit)
 Groups   Name        Variance Std.Dev.
 yeart    (Intercept) 0.040896 0.20223 
 Residual             0.091125 0.30187 

The number I need to extract and store is the .20223, but all the 
components I can find in VarCorr(fit) are something else. 

u=VarCorr(fit); slotNames(u)
[1] "scale"    "reSumry"  "useScale"
> u at scale
[1] 0.3018693
> u at reSumry
$yeart
An object of class "corrmatrix"
            (Intercept)
(Intercept)           1
Slot "stdDev":
(Intercept) 
  0.6699156 
> u at useScale
[1] TRUE

In glmmML the estimate is returned as the $sigma component
of the model, but I also need the same info from 'family=gaussian' 
models. 


Stephen P. Ellner (spe2 at cornell.edu)
Department of Ecology and Evolutionary Biology
Corson Hall, Cornell University, Ithaca NY 14853-2701
Phone (607) 254-4221    FAX (607) 255-8088




More information about the R-help mailing list