Fitting unique priors per coefficient with Rstanarm


I’m hoping this is more a gentle-push-in-the-right-direction question because I feel like I’m stuck on something pretty minor. I can’t figure out from the documentation for Rstanarm how to fit priors per different coefficients. I know how to do it in brms but I’m having troubles with that package since the developers have noted that there are compatibility issues between the current version of brms and the current version of R (4.2+). Anyway, the code in brms is below, and I was wondering if anyone could tell me how to achieve a similar result in Rstanarm.

Thank you!


multiple_regression_fit ← brm(data = df,
formula = mpg ~ wt + cyl,
prior = c(prior(normal(0, 2), coef = ‘wt’), #like this
prior(normal(0, 5), coef = ‘cyl’)), #like this
chains = 1,
seed = 12345)

I think you’ll find what you’re looking for in the last section of the Prior Distributions vignette. rstanarm::stan_glm() is a bit more restricted than brms in that the coefficients must be drawn from the same distribution (here, Normal), but it still allows separate parameters of that distribution for each coefficient (e.g., location/mean, scale/sd). The grouping is a bit different than brms too—you’ll need to pass a vector with the prior location parameters (plural) then the scale parameters to the prior = ... argument.