How do I implement bayesian logistic regression with multivariate Normal prior using rstanarm?

I am looking to implement bayesian logistic regression. However, the examples are confusing me a lot.

So far, here is what I got,

# X is predictors dataframe
# Y is prediction dataframe

# Say X has 4 dimensions,then I believe multNormal 
# should somehow take input of list of size 5 for means,
# and another matrix of 5x5 for covariances
multNormal <- # What goes here?

post <- stan_glm(Y ~ X, family = # What goes here for logistic regression?, 
             prior = multNormal, prior_intercept = multNormal,
             seed = 1)

I tried to understand https://mc-stan.org/rstanarm/articles/priors.html#informative-prior-distributions and https://mc-stan.org/rstanarm/articles/rstanarm.html, but honestly, I couldn’t understand what to do next. Couldn’t locate any documentation either.

what do I need to do next?

The priors on the coefficients are all univariate and independent. You can do

post <- stan_glm(Y ~ x1 + x2 + ..., data = dataset, family = binomial, 
                 QR = TRUE, seed = 1)

which uses the default univariate normal prior on the coefficients of Q, which amounts to a multivariate normal prior on the coefficients of X with variance-covariance matrix proportional to R' * R.

1 Like

Thanks! This helps with the case of non-informative priors. But in another case, I have information about the means and covariance of the prior. How can I define it?

You can’t in rstanarm. Or at least not with the covariances. You could define normal priors marginally with whatever means and standard deviations you want.