Relationship between VarCorr() and posterior draws?

Hi,

I’ve fit an intercept-only mixed effects model in rstanarm. Big thanks to @tjmahr for his example here:

The model is basically the same, except it’s intercept only.

library(lme4)
library(dplyr)
library(tibble)

sleepstudy <- sleepstudy %>% 
    as_tibble() %>% 
    mutate(Subject = as.character(Subject))

df_sleep <- bind_rows(
    sleepstudy,
    tibble(Reaction = c(286, 288), Days = 0:1, Subject = "374"),
    tibble(Reaction = 245, Days = 0, Subject = "373"))

sleepb <- stan_glmer(
    Reaction ~ 1 + (1 | Subject),
    family = gaussian(),
    data = df_sleep,
    prior = normal(0, 2, autoscale = TRUE),
    prior_intercept = normal(0, 5, autoscale = TRUE),
    prior_covariance = decov(regularization = 2),
    prior_aux = cauchy(0, 1, autoscale = TRUE), 
    # reproducible blogging
    seed = 20211116
)

Output standard deviations with varcorr:

VarCorr(sleepb)
 Groups   Name        Std.Dev.
 Subject  (Intercept) 36.793  
 Residual             44.350  

But I want to dive into greater details using the posterior draws. In particular, I want to identify the contribution to the variance in each group from members.

sleepdraws <- as.matrix(sleepb)
apply(sleepdraws,2,sd)

But obviously, applying sd to each column from the posterior draws doesn’t get me there. What am I missing? How do I pull the information from the posterior draws to capture the variance in each group?

@betanalpha ?
@bgoodri ? your answers in this thread look along the same lines:

I don’t fully understand the problem so I won’t be able to offer much help. In particular I don’t understand what the desired variance is. For this model the behavior in each group will be captured by a single parameter so there isn’t any notion of variance within the group. There could be predictive variance but here that’s the same for all groups. There is also the variance across groups with is captured by the population scale parameter that brms automatically introduces.