yrep <- posterior_predict(example_model)
table(yrep)
nd <- lme4::cbpp
nd$size <- max(nd$size) + 1L
ppd <- posterior_predict(example_model, newdata = nd)
# Use fun argument to transform predictions
fit <- stan_glm(I(log(mpg)) ~ wt, data = mtcars)
ppd <- posterior_predict(fit, fun = exp)
Run the code above in your browser using DataLab