Skip to content

Commit 8352a81

Browse files
committed
mention prior predictive checking
advances #196
1 parent 98da77c commit 8352a81

File tree

7 files changed

+80
-61
lines changed

7 files changed

+80
-61
lines changed

R/bayesplot-package.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
#' Monte Carlo (MCMC) simulations generated by *any* MCMC algorithm
3737
#' as well as diagnostics. There are also additional functions specifically
3838
#' for use with models fit using the [No-U-Turn Sampler (NUTS)][NUTS].
39-
#' * [__PPC__][PPC-overview]: Graphical posterior predictive checks (PPCs).
39+
#' * [__PPC__][PPC-overview]: Graphical prior and posterior predictive
40+
#' checks (PPCs).
4041
#'
4142
#' In future releases modules will be added specifically for
4243
#' forecasting/out-of-sample prediction and other inference-related tasks.

R/pp_check.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#' Posterior predictive checks (S3 generic and default method)
1+
#' Posterior (or prior) predictive checks (S3 generic and default method)
22
#'
33
#' S3 generic with simple default method. The intent is to provide a generic so
44
#' authors of other \R packages who wish to provide interfaces to the functions
5-
#' in **bayesplot** will be encouraged to include `pp_check()` methods in
6-
#' their package, preserving the same naming conventions for posterior
5+
#' in **bayesplot** will be encouraged to include `pp_check()` methods in their
6+
#' package, preserving the same naming conventions for posterior (and prior)
77
#' predictive checking across many \R packages for Bayesian inference. This is
8-
#' for the convenience of both users and developers. See the **Details**
9-
#' and **Examples** sections, below, and the package vignettes for examples
10-
#' of defining `pp_check()` methods.
8+
#' for the convenience of both users and developers. See the **Details** and
9+
#' **Examples** sections, below, and the package vignettes for examples of
10+
#' defining `pp_check()` methods.
1111
#'
1212
#' @export
1313
#' @param object Typically a fitted model object. The default method, however,
@@ -56,8 +56,8 @@ pp_check <- function(object, ...) {
5656
#' @export
5757
#' @param yrep For the default method, a `yrep` matrix passed to `fun`.
5858
#' @param fun For the default method, the plotting function to call. Can be any
59-
#' of the \link[=PPC]{PPC functions}. The `"ppc_"` prefix can optionally
60-
#' be dropped if `fun` is specified as a string.
59+
#' of the [PPC] functions. The `"ppc_"` prefix can optionally be dropped if
60+
#' `fun` is specified as a string.
6161
#'
6262
pp_check.default <- function(object, yrep, fun, ...) {
6363
if (is.character(fun) && substr(fun, 1, 4) != "ppc_") {

R/ppc-overview.R

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#' @family PPCs
66
#'
77
#' @description
8-
#' The **bayesplot** PPC module provides various plotting functions for
9-
#' creating graphical displays comparing observed data to simulated data from
10-
#' the posterior predictive distribution. See below for a brief discussion of
11-
#' the ideas behind posterior predictive checking, a description of the
12-
#' structure of this package, and tips on providing an interface to
8+
#' The **bayesplot** PPC module provides various plotting functions for creating
9+
#' graphical displays comparing observed data to simulated data from the
10+
#' posterior (or prior) predictive distribution. See below for a brief
11+
#' discussion of the ideas behind posterior predictive checking, a description
12+
#' of the structure of this package, and tips on providing an interface to
1313
#' **bayesplot** from another package.
1414
#'
1515
#' @details
@@ -50,35 +50,45 @@
5050
#' For a more thorough discussion of posterior predictive checking see
5151
#' Chapter 6 of Gelman et. al. (2013).
5252
#' }
53+
#' \subsection{Prior predictive checking}{
54+
#' To use **bayesplot** for *prior* predictive checks you can simply use draws
55+
#' from the prior predictive distribution instead of the posterior predictive
56+
#' distribution. See Gabry et al. (2019) for more on prior predictive checking
57+
#' and when it is reasonable to compare the prior predictive distribution to the
58+
#' observed data. If you want to avoid using the observed data for prior
59+
#' predictive checks, then the `y` argument to the PPC plotting functions can be
60+
#' used to provide plausible or implausible `y` values that you want to compare
61+
#' to the prior predictive realizations.
62+
#' }
5363
#'
54-
#' @section PPC plotting functions: The plotting functions for posterior
55-
#' predictive checking in this package are organized into several categories,
56-
#' each with its own documentation:
64+
#' @section PPC plotting functions: The plotting functions for prior and
65+
#' posterior predictive checking are organized into several categories, each
66+
#' with its own documentation:
5767
#' * [__Distributions__][PPC-distributions]: Histograms, kernel density
5868
#' estimates, boxplots, and other plots comparing the empirical distribution
59-
#' of the observed data `y` to the distributions of individual replicated
60-
#' datasets (rows) in `yrep`.
61-
#' * [__Statistics__][PPC-test-statistics]: The distribution of a statistic, or a
62-
#' pair of statistics, over the replicated datasets (rows) in `yrep` compared
63-
#' to value of the statistic(s) computed from `y`.
69+
#' of data `y` to the distributions of individual simulated datasets (rows)
70+
#' in `yrep`.
71+
#' * [__Statistics__][PPC-test-statistics]: The distribution of a statistic,
72+
#' or a pair of statistics, over the simulated datasets (rows) in `yrep`
73+
#' compared to value of the statistic(s) computed from `y`.
6474
#' * [__Intervals__][PPC-intervals]: Interval estimates of `yrep` with `y`
6575
#' overlaid. The x-axis variable can be optionally specified by the user
6676
#' (e.g. to plot against against a predictor variable or over time).
6777
#' * [__Predictive errors__][PPC-errors]: Plots of predictive errors
68-
#' (`y - yrep`) computed from `y` and replicated datasets (rows) in `yrep`.
69-
#' For binomial models binned error plots are also available.
78+
#' (`y - yrep`) computed from `y` and eachc of the simulated datasets (rows)
79+
#' in `yrep`. For binomial models binned error plots are also available.
7080
#' * [__Scatterplots__][PPC-scatterplots]: Scatterplots (and similar
71-
#' visualizations) of the observed data `y` vs. individual replicated datasets
72-
#' (rows) in `yrep`, or vs. the average value of the distributions of each data
73-
#' point (columns) in `yrep`.
81+
#' visualizations) of the data `y` vs. individual simuluted datasets
82+
#' (rows) in `yrep`, or vs. the average value of the distributions of each
83+
#' data point (columns) in `yrep`.
7484
#' * [__Plots for discrete outcomes__][PPC-discrete]: PPC functions that can
7585
#' only be used if `y` and `yrep` are discrete. For example, rootograms for
7686
#' count outcomes and bar plots for ordinal, categorical, and
7787
#' multinomial outcomes.
7888
#' * [__LOO predictive checks__][PPC-loo]: PPC functions for predictive checks
7989
#' based on (approximate) leave-one-out (LOO) cross-validation.
8090
#'
81-
#' @section Providing an interface for posterior predictive checking from another package:
91+
#' @section Providing an interface for predictive checking from another package:
8292
#'
8393
#' In addition to the various plotting functions, the **bayesplot** package
8494
#' provides the S3 generic [pp_check()]. Authors of \R packages for

man/PPC-overview.Rd

Lines changed: 29 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bayesplot-package.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/pp_check.Rd

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidy-params.Rd

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)