I was recently asked to report a statistic along with posterior predictive distributions that provides some support (either for or against)that my model fitting the data. I found the ppc_stat function in bayes plot and decided to give it a whirl. In creating this plot, and estimating the T statistic, this vignette provides a pretty clear explanation of what the input should look like. Where y is the observed outcome variable and is length 434. yrep is the posterior predictive distribution with 434 columns and 500 rows.
y <- example_y_data() yrep <- example_yrep_draws() ppc_stat(y, yrep)
My question arises as to if I am creating the yrep variable correctly. To create yrep as it is intended in the bayesplot documentation, would I use the posterior_predict function from brms? That is, does yrep = something like this?
model = brm(formula = Successes | trials(Trials) ~ x + y, data=data, family=binomial) #Plot ppc_stat y = data$y yrep = posterior_predict(model, nsamples = 500) ppc_stat(y, yrep)
Ultimately, the plot looks like this which seems like a posterior predictive distribution and I am not actually sure what you glean from this as far as model fit.
Any input would be appreciated. Thanks!