[R-sig-ME] How to extract variance components in lme4 1.0 ?
Ben Bolker
bbolker at gmail.com
Thu Sep 12 23:41:15 CEST 2013
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
>
This is possible but undocumented (I've just documented it
in the master branch [1.1-0]):
print(VarCorr(fm1),comp=c("Std.Dev.","Variance"))
More information about the R-sig-mixed-models
mailing list