Pedictive posterior visualization for logistic(or binomial) regression


I am looking for a good way to visualize predictive posterior for binomial regression. In my case y[i]~binomial_logit(N, alpha+betax[i]) - or in vectorized form y~binomial_logit(N, alpha+xbeta) where x is a matrix and represents 10+ predictors for each observation, beta is a vector.

Is this a visualization for posterior predictive checking (i.e., comparing predictions to observed binomial counts) or for visualizing out-of-sample predictions? More specifically, what are you interested in showing in (learning from) this visualization? There’s tons of ways to visualize these things, so knowing more about your purpose would be helpful.

Really i would like to learn both but immediate need is comparing predictions to observed binomial counts.

Is it as simple as having in generated quantities y_pred[i]=binomial_logit_rng(N, alpha+beta*x[i]) and then taking 90% credible region of y_pred and comparing with observed binomial counts?

Yeah that’s one option. The bayesplot function ppc_intervals makes that plot. Many of the other ppc_ plots are also fine to use with binomial models.

You can also compare the probabilities rather than the observed counts (I think both are useful).

1 Like

Hi Jonah, how could one compare the probabilities instead of observed counts?