# How to set joint prior for the regression coefficient in hierarchical regression?

The following is the R code for using brm_multiple to perform multivariate logistic regression based upon brms package. y is binary variable.

fit=brm_multiple(y~age+group_1+group_2+group_3,
data=imp,chains=4,iter=5000,warmup=2500,
prior=c(set_prior('normal(-0.1,0.5)',class='b',coef='group_1'),
set_prior('normal(-0.1,0.5)',class='b',coef='group_2'),
set_prior('normal(-0.1,0.5)',class='b',coef='group_3'),
set_prior('normal(-0.1,0.5)',class='b',coef='age')
)


The above model assumes independent priors and does not impose a hyper prior to regularize all coefficients. I want the following model specified.

y\sim Normal(\beta_{age}age+\beta_1group_1+\beta_2group_2+\beta_3group_3+\beta_0,\sigma^2) where (\beta_0,\beta_{age},\beta_1,\beta_2,\beta_3)\sim Normal(\alpha,\Sigma),\alpha\sim Normal((0,0,0,0,0),\Sigma_1) where \Sigma_1 is known,\sigma follows inverse chi square distribution and \Sigma follows inverse Wishart distribution.

This model will regularize all coefficients.

I think brm_multiple is for running the same model on many datasets. For example when using multiple imputation. When I think of multivariate regression, then I think of using the mvbind syntax or multiple bf() formulas Estimating Multivariate Models with brms

But in any case, have you looked at using stanvar in brms? See the second example where a multi-normal prior with known covariance matrix is defined User-defined variables passed to Stan — stanvar • brms

Thanks for the suggestion. I think I have to lookup stanvar and stan coding in order to implement this hyper-prior. Otherwise, I have to implement in stan code alone instead of using brms package. I think per this post Initialisation issues when using student-t for hierarchical priors - #5 by paul.buerkner. It seems that stanvar is experimental. I would be better off by hard coding in stan instead.

Just a note: the post you linked that mentions an experimental feature is not saying that stanvar is experimental.

The reason to use stanvar with brms rather than hard-coding in stan would be if you want the flexibility to iterate quickly with different forms of the linear predictor, and/or if you want easy integration with the post-processing tasks that brms provides for posterior prediction, model criticism, model comparison, etc.

With that said, stanvar is difficult to use unless you are comfortable with the Stan language itself.

Thanks for clarification. I might use brms stanvar as cross check for hard code in stan.