[R-sig-ME] extracting variance components in lme4?

Douglas Bates bates at stat.wisc.edu
Tue Feb 6 14:42:33 CET 2007


On 2/6/07, Fabian Scheipl <f.abian at gmx.net> wrote:
> try
>
> vc      <-VarCorr( model1 )
> varcomps<-c(unlist( lapply(vc, diag) ), # random intercept variances
>             attr(vc,"sc")^2)            # residual variance
>
> also works if you have multiple random terms (intercept and slope, e.g.) for a given grouping factor.
> Extracts the respective variances without the covariances.

Yes, indeed.  That is better than the version that I suggested.  Thanks.

If a good name for such an extractor can be suggested I will
incorporate it in the lme4 package.  Any suggestions for a name?




More information about the R-sig-mixed-models mailing list