When fitting models using stan_glmer(), summary(stan_glmer()) names the elements of the covariance matrix using terms like Sigma[group:(Intercept),(Intercept)]. Especially in the (quite common) case where the covariance matrix is 1x1, it would be very easy for users to see Sigma, think "sigma", and assume that this is the standard deviation of the random effect, rather than the variance. I suggest changing the name from "Sigma" to "Var" in the case of a 1x1 matrix, and possibly also for the diagonal elements of higher-dimensionality covariance matrices. Alternatively, I suggest documenting this output both in the stan_glmer() documentation and in the rstanarm group-specific terms vignette.
Reproducible Steps:
probs <- boot::inv.logit(rnorm(500, 0,10))
trials <- ceiling(runif(500,0,100))
successes <- rbinom(500, trials, probs)
df <- data.frame(s_f = NA, group = as.factor(1:500))
df$s_f <- cbind(successes, trials-successes)
testmodel <- rstanarm::stan_glmer(s_f ~ (1|group), data = df, family = 'binomial', cores = 4, iter = 100)
a <- summary(testmodel)["Sigma[group:(Intercept),(Intercept)]",]
I don't think we should change the output because someone's R scripts may be relying on the current (not great) behavior. But I am about to commit an improvement to the documentation.
Summary:
When fitting models using
stan_glmer()
,summary(stan_glmer())
names the elements of the covariance matrix using terms likeSigma[group:(Intercept),(Intercept)]
. Especially in the (quite common) case where the covariance matrix is 1x1, it would be very easy for users to seeSigma
, think "sigma", and assume that this is the standard deviation of the random effect, rather than the variance. I suggest changing the name from "Sigma" to "Var" in the case of a 1x1 matrix, and possibly also for the diagonal elements of higher-dimensionality covariance matrices. Alternatively, I suggest documenting this output both in thestan_glmer()
documentation and in the rstanarm group-specific terms vignette.Reproducible Steps:
RStanARM Version:
2.18.2
R Version:
3.6.0