[R-sig-ME] Extracting variances from a mer object

Douglas Bates bates at stat.wisc.edu
Wed Jul 7 23:13:50 CEST 2010


On Wed, Jul 7, 2010 at 4:06 PM, Gang Chen <gangchen6 at gmail.com> wrote:
> This is a simple question. When fitting a model with lmer, how can I
> extract all the variances from the output object? For example, with
> the following analysis, I just want to extract the column of Variance
> under the Random effects table - those 3 variance numbers: 0.63756 for
> Subj, 23.03698 for Scan, and 199.50496 for Residual. VarCorr(fm) only
> gives me the first two. I couldn't find any slots for this purpose
> from str(fm) either.

?VarCorr

>> (fm<-lmer(Rep~(1|Subj)+(1|Scan), data=Model))
> Linear mixed model fit by REML
> Formula: Rep ~ (1 | Subj) + (1 | Scan)
>   Data: Model
>   AIC   BIC logLik deviance REMLdev
>  166.4 170.3 -79.18    163.2   158.4
> Random effects:
>  Groups   Name        Variance  Std.Dev.
>  Subj     (Intercept)   0.63756  0.79847
>  Scan     (Intercept)  23.03698  4.79969
>  Residual             199.50496 14.12462
> Number of obs: 20, groups: Subj, 10; Scan, 2
>
> Fixed effects:
>            Estimate Std. Error t value
> (Intercept)   27.603      4.642   5.946
>
> Thanks,
> Gang
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




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