I'm trying to extract this section of the model summary from a set of glmms. I want both the variance and the standard deviation.
Random effects:
Groups Name Variance Std.Dev.
herd (Intercept) 0.4123 0.6421
Number of obs: 56, groups: herd, 15
I tried following this answer Extract random effect variances from lme4 mer model object
But I can't seem to get the variance, only the standard deviation. I thought perhaps this was because I was using glmer instead of lmer, but I seem to get the same results.
gm1 <- lmer( size ~ period + (1 | herd), data = cbpp)
summary(gm1)
Random effects:
Groups Name Variance Std.Dev.
herd (Intercept) 44.40 6.664
Residual 14.51 3.810
Number of obs: 56, groups: herd, 15
> VarCorr(gm1, comp="Variance")
Groups Name Std.Dev.
herd (Intercept) 6.6636
Residual 3.8096
> VarCorr(gm1, comp="Std.Dev.")
Groups Name Std.Dev.
herd (Intercept) 6.6636
Residual 3.8096
> VarCorr(gm1, comp=c("Variance","Std.Dev."))
Groups Name Std.Dev.
herd (Intercept) 6.6636
Residual 3.8096
gm2 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)
summary(gm2)
Random effects:
Groups Name Variance Std.Dev.
herd (Intercept) 0.4123 0.6421
Number of obs: 56, groups: herd, 15
> VarCorr(gm2, comp="Variance")
Groups Name Std.Dev.
herd (Intercept) 0.64207
> VarCorr(gm2, comp="Std.Dev.")
Groups Name Std.Dev.
herd (Intercept) 0.64207
> VarCorr(gm2, comp=c("Variance","Std.Dev."))
Groups Name Std.Dev.
herd (Intercept) 0.64207
Any ideas what might be going on here?