Wraps bayesplot::ppc_dens_overlay() with consistent styling via
theme_ppc(). Subsamples y_rep rows for readability when \(S\) is
large.
Arguments
- y_obs
Numeric vector of length \(n\) containing the observed outcomes.
- y_rep
Numeric matrix of dimension \(S \times n\) where each row is one posterior predictive replicate (e.g. the output of
simulate_ppc()).- n_samples
Positive integer. Number of rows to subsample from
y_repfor the overlay. Subsampling improves readability when \(S\) is large. Defaults to50. The subsample is drawn without replacement whenn_samples < S, otherwise all rows are used.- ...
Additional arguments passed to
bayesplot::ppc_dens_overlay().
Examples
set.seed(7)
y <- rnorm(80, mean = 0, sd = 1)
draws <- matrix(rnorm(300 * 80, mean = 0), nrow = 300, ncol = 80)
y_rep <- simulate_ppc(draws)
# \donttest{
p <- plot_ppc_overlay(y, y_rep, n_samples = 40)
# }