# Odds ratio and querying posterior with different priors with stan_glm function

Hello,
Regarding the example here with standard package and stan_glm() function for Bayesian logistic regression

https://www.kaggle.com/avehtari/bayesian-logistic-regression-with-rstanarm

``````library(rstanarm)
options(mc.cores = parallel::detectCores())
t_prior <- student_t(df = 7, location = 0, scale = 2.5)
post1 <- stan_glm(outcome ~ ., data = diabetes,
prior = t_prior, prior_intercept = t_prior, QR=TRUE,
seed = 14124869)
``````

The OR is

``````OR = post1\$measure[2,1]
``````

1. How I can use non-informative prior (flat)? with different cutoff points?
2. How I can perform queries since its Bayesian, like P(OR>0.2)?
3. How I can get the plot of prior, likelihood, and the posterior as well?

1. Flat priors are not recommended. Is there a specific reason why would you want to use those? What do you mean by cutoff points?
2. There is an extended version of that example in https://avehtari.github.io/modelselection/diabetes.html There are examples of how to compute probabilities. Check that out and ask again if you don’t find a specific piece of code.
3. That extended example has plots for the posterior. For the prior and likelihood you need to do your own plotting, although for priors you can find plenty of examples by googling and I think there is also a R package for that, but can’t remember the name.
2 Likes

Thanks, @avehtari,

1. what is the best mean and variance for the priors, I used normal one with mean equal to zero and high variance (non-informative).

2. I think if I access the mcmc data that use to calculate the estimation of the parameters, then I can perform any query, but I did not find that the function returns this list of simulated data.

3. do you mean brms package? I think if I access the simulated raw data, I will do that.

Non-informative on coefficients is not non-informative for outcomes. See

I don’t understand this question. Can you elaborate?

I didn’t mean brms (that is the name I can easily remember). Maybe tidybayes has plots for basic distrbutions? You could use brms to sample from the prior, but that is then from the joint prior and the sampling may also fail for uninformative priors.