PPD-intervals | R Documentation |
Medians and central interval estimates of posterior or prior predictive
distributions. Each of these functions makes the same plot as the
corresponding ppc_
function but without plotting any
observed data y
. The Plot Descriptions section at PPC-intervals has
details on the individual plots.
ppd_intervals( ypred, x = NULL, ..., prob = 0.5, prob_outer = 0.9, alpha = 0.33, size = 1, fatten = 2.5, linewidth = 1 ) ppd_intervals_grouped( ypred, x = NULL, group, ..., facet_args = list(), prob = 0.5, prob_outer = 0.9, alpha = 0.33, size = 1, fatten = 2.5, linewidth = 1 ) ppd_ribbon( ypred, x = NULL, ..., prob = 0.5, prob_outer = 0.9, alpha = 0.33, size = 0.25 ) ppd_ribbon_grouped( ypred, x = NULL, group, ..., facet_args = list(), prob = 0.5, prob_outer = 0.9, alpha = 0.33, size = 0.25 ) ppd_intervals_data( ypred, x = NULL, group = NULL, ..., prob = 0.5, prob_outer = 0.9 ) ppd_ribbon_data( ypred, x = NULL, group = NULL, ..., prob = 0.5, prob_outer = 0.9 )
ypred |
An |
x |
A numeric vector to use as the x-axis
variable. For example, |
... |
Currently unused. |
prob, prob_outer |
Values between |
alpha, size, fatten, linewidth |
Arguments passed to geoms. For ribbon
plots |
group |
A grouping variable of the same length as |
facet_args |
A named list of arguments (other than |
The plotting functions return a ggplot object that can be further
customized using the ggplot2 package. The functions with suffix
_data()
return the data that would have been drawn by the plotting
function.
Gabry, J. , Simpson, D. , Vehtari, A. , Betancourt, M. and Gelman, A. (2019), Visualization in Bayesian workflow. J. R. Stat. Soc. A, 182: 389-402. doi:10.1111/rssa.12378. (journal version, arXiv preprint, code on GitHub)
Other PPDs:
PPD-distributions
,
PPD-overview
,
PPD-test-statistics
color_scheme_set("brightblue") ypred <- example_yrep_draws() x <- example_x_data() group <- example_group_data() ppd_intervals(ypred[, 1:50]) ppd_intervals(ypred[, 1:50], fatten = 0) ppd_intervals(ypred[, 1:50], fatten = 0, linewidth = 2) ppd_intervals(ypred[, 1:50], prob_outer = 0.75, fatten = 0, linewidth = 2) # put a predictor variable on the x-axis ppd_intervals(ypred[, 1:100], x = x[1:100], fatten = 1) + ggplot2::labs(y = "Prediction", x = "Some variable of interest") # with a grouping variable too ppd_intervals_grouped( ypred = ypred[, 1:100], x = x[1:100], group = group[1:100], size = 2, fatten = 0, facet_args = list(nrow = 2) ) # even reducing size, ppd_intervals is too cluttered when there are many # observations included (ppd_ribbon is better) ppd_intervals(ypred, size = 0.5, fatten = 0.1, linewidth = 0.5) ppd_ribbon(ypred) ppd_ribbon(ypred, size = 0) # remove line showing median prediction
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.