Raw Message
Message-ID: <loom.20130912T234138-678@post.gmane.org>
Date: 2013-09-12T21:42:42Z
From: Ben Bolker
Subject: How to extract variance components in lme4 1.0 ?
Kevin Wright <kw.stat at ...> writes:
>
> Note, I don't want to print() them. I want to use them in calculations
> (e.g. change from variances to proportions of variation explained).
>
> VarCorr() can be used to print them, but as yet I haven't been able to find
> out how to easily extract the variances.
>
> data(Orthodont, package="nlme")
> fm1 <- lmer(distance ~ age + (age|Subject), data = Orthodont)
> VarCorr(fm1)
>
> Groups Name Std.Dev. Corr
> Subject (Intercept) 2.32704
> age 0.22643 -0.609
> Residual 1.31004
>
Oops, I didn't read carefully enough.
If you're willing to have the variances without the correlations/
covariances included,
unlist(lapply(VarCorr(fm1),diag))
Subject.(Intercept) Subject.age
5.41511574 0.05126949