Stan_glm: Estimating the probability that a coefficient>0


I have used rstanarm’s stan_glm for a Bayesian estimation of the coefficients in a logistic regression model. I am wondering if, like in PyMC, it is possible to estimate the probability that a certain coefficient is, for example, greater than zero?

Thanks for the help!

This is most easily done with something like

post <- stan_glm(y ~ x + ..., data = dataset, family = binomial())
mean($x > 0)

In case it’s not obvious this calculates the fraction of samples that are greater than zero… boolean TRUE gets turned into 1 and FALSE into 0

Great - thank you both!