[R] extract variance for random effects from "mer" object

Ben Bolker bbolker at gmail.com
Thu Apr 7 13:29:59 CEST 2011


Maas James Dr (MED <J.Maas <at> uea.ac.uk> writes:

> I get an output from a glmer package, but would like 
> to extract the variance of the Random effects, in this
> case called trtpair and the value is 0.
[snip]
> > fednmaout
> Generalized linear mixed model fit by the Laplace approximation 
> Formula: cbind(fednmadat$events, fednmadat$patnums - fednmadat$events) ~     
treat + tn + (1 | trtpair) 
>    AIC   BIC logLik deviance
>  84.01 153.1 -9.006    18.01
> Random effects:
>  Groups  Name        Variance Std.Dev.
>  trtpair (Intercept)  0        0      
> Number of obs: 60, groups: trtpair, 3
> 

  VarCorr(fednmaout)[[1]]

(the [[1]] means to extract the variance for the
first (and only in this case) random effect.)



More information about the R-help mailing list