Maas James Dr (MED)
2011-Apr-07 11:03 UTC
[R] extract variance for random effects from "mer" object
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. Can I extract it directly or do I need to do some further calculations on the "mer" object to get it? Thanks Jim> class(fednmaout)[1] "mer" attr(,"package") [1] "lme4"> fednmaoutGeneralized 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 ==============================Dr. Jim Maas University of East Anglia
Ben Bolker
2011-Apr-07 11:29 UTC
[R] extract variance for random effects from "mer" object
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.)