Skip to contents

Each panel shows:

  • A histogram of the \(M\) posterior predictive draws of the test statistic \(T(\mathbf{y}^{\mathrm{rep}})\).

  • A solid red vertical line at the observed value \(T(\mathbf{y})\), annotated with its numeric value.

  • Dashed green vertical lines at the lower and upper bounds of the \((1-\alpha)\) posterior predictive interval.

A pass/fail indicator appears in the panel subtitle.

Usage

# S3 method for class 'hbb_ppc'
plot(x, type = NULL, ...)

Arguments

x

An object of class "hbb_ppc" returned by ppc.

type

Character string or NULL; which statistic to plot. If NULL (default), uses x$type. Otherwise one of "both", "zero_rate", "it_share".

...

Additional arguments (currently unused).

Value

A ggplot object (single-statistic) or a patchwork object (type = "both"), returned invisibly.

Details

Produces a histogram of the posterior predictive draws for each requested test statistic, overlaid with a vertical line at the observed value. When type = "both", the two panels are combined using patchwork.

ggplot2 Requirement

This function requires ggplot2 (and patchwork for type = "both"). Both are in Suggests; they will be checked via rlang::check_installed() and the user will be prompted to install them if absent.

References

Gabry, J., Simpson, D., Vehtari, A., Betancourt, M., and Gelman, A. (2019). Visualisation in Bayesian workflow. Journal of the Royal Statistical Society: Series A, 182(2), 389–402.