Extracting overall coefficient estimates from rstanarm

I am having a go at rstanarm because a collaborator of mine wants to avoid using Stan scripts. This is my first go at this, so please forgive my naivety. Suppose I have a model that estimates separate slopes for each different groups for the effect of an independent variable (‘lag’) on a dependent variable (‘value’). I can fit this by variational Bayes using the following,

fit_ppool <- stan_glmer(value ~ (lag|group),data=example,algorithm=“meanfield”,prior = normal(0,1))

I want to check a few things about this. First, does prior ~ normal(0,1) mean that the ‘population-level’ slope (a hyper-parameter) has a normal(0,1) prior? In other words, is the structure of the model,

beta_i ~ normal(beta_top,sigma_top);
beta_top ~ normal(0,1);

where i indicates group. Also, if this is the case, then how do I set a prior on sigma_top?

Second, is there a way to obtain estimates of beta_top through rstanarm? At the moment, I seem able to estimate the group level parameters, but can’t find population-level ones…



For this, you need lag to also be outside (lag | group) as in

fit_ppool <- stan_glmer(value ~ lag + (lag | group), data = example, 
                        algorithm = “meanfield”, prior = normal(0,1))

That is just part of the lme4 syntax. What you had originally forces the population-level slope to be zero, which is usually not what anyone wants. That is why

This is done via the prior_covariance argument even though there is only a standard deviation in your case. By setting that equal to decov(shape = 2, scale = 1.5) you get a gamma prior with that shape and scale on the standard deviation in the coefficient on lag across levels of group.

Also, meanfield ADVI tends not to work well with stan_[g]lmer.

Great, thanks Ben!