brms: Mixed Model
We’ll start with the mixed model from before
Like rstanarm, brms follows lme4’s syntax
sleepstudy_brms <- brm(Reaction ~ Days + (1 + Days|Subject),
data = sleepstudy)
summary(sleepstudy_brms)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Reaction ~ Days + (1 + Days | Subject)
Data: sleepstudy (Number of observations: 180)
Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup samples = 4000
Group-Level Effects:
~Subject (Number of levels: 18)
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sd(Intercept) 26.74 7.04 15.36 43.05 1635 1.00
sd(Days) 6.52 1.50 4.20 9.95 1290 1.01
cor(Intercept,Days) 0.10 0.29 -0.46 0.67 877 1.01
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
Intercept 251.42 7.39 236.86 266.19 1650 1.00
Days 10.41 1.67 7.24 13.82 1233 1.00
Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sigma 25.89 1.55 23.10 29.06 3200 1.00
Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
is a crude measure of effective sample size, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).