Ppc_boxplot axes

bayesplot
#1

I’m looking at posterior predictive distributions for three models. As part of the comparison, I produced boxplots using ppc_boxplot for the observed data and 10 randomly posterior predictive distributions for each model. My problem is that for two of the models, the boxplots all have the same limits on the vertical axis, while for the third model I get different limits. Is there a way to specify the y-axis limits (like the ylim= parameter for general graphing in R)?

0 Likes

#2

The objects produced by the bayesplot package are ggplot2 objects, and so you can customize them the same way you would other plots produced by ggplot2. In particular, in this case I think you can do something like

bayesplot::ppc_boxplot(model1) + ylim(0, 5)
bayesplot::ppc_boxplot(model2) + ylim(0, 5)
bayesplot::ppc_boxplot(model3) + ylim(0, 5)

to have the vertical axis run from zero to five for all three plots. For more information, see the ggplot2 documentation on

0 Likes

#3

That solved it… thanks!!!

0 Likes