From 2dd1a7a8b0768483cc9ba35e0215fc6c773ebab2 Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Thu, 26 Feb 2026 17:05:04 +0530 Subject: [PATCH 1/4] Add documentation for ppc_data and ppc_loo_pit_data Fixes #209 --- NEWS.md | 1 + R/ppc-distributions.R | 9 +++++++++ R/ppc-loo.R | 13 ++++++++++++- man/PPC-distributions.Rd | 9 +++++++++ man/PPC-loo.Rd | 16 +++++++++++++++- 5 files changed, 46 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 25c323e3..5cc259c4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # bayesplot (development version) +* Documentation added for `ppc_data()` and `ppc_loo_pit_data()` functions (#209) * New functions `mcmc_dots` and `mcmc_dots_by_chain` for dot plots of MCMC draws by @behramulukir (#402) * Default to `quantiles=100` for all dot plots by @behramulukir (#402) diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index d86a8b4c..fda798af 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -22,6 +22,15 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_data()`}{ +#' This function prepares data for plotting with **ggplot2**. It is the +#' data-preparation back end for all the `ppc_*()` plotting functions, and +#' users can call it directly to create custom PPC plots using ggplot2. The +#' function returns a data frame (or list of data frames) that can be used to +#' build ggplot objects. This is useful when you want to customize the +#' appearance of PPC plots beyond what the built-in plotting functions allow, +#' or when you want to create entirely new types of PPC visualizations. +#' } #' \item{`ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()`}{ #' A separate histogram, shaded frequency polygon, smoothed kernel density #' estimate, or box and whiskers plot is displayed for `y` and each diff --git a/R/ppc-loo.R b/R/ppc-loo.R index 88a6692c..e0f93039 100644 --- a/R/ppc-loo.R +++ b/R/ppc-loo.R @@ -23,10 +23,21 @@ #' `ppc_loo_ribbon()`, `alpha` and `size` are passed to #' [ggplot2::geom_ribbon()]. #' -#' @template return-ggplot +#' @template return-ggplot-or-data #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_loo_pit_data()`}{ +#' This function prepares LOO-PIT data for plotting with **ggplot2**. It is +#' the data-preparation back end for the LOO-PIT plotting functions +#' (`ppc_loo_pit_overlay()`, `ppc_loo_pit_qq()`, and `ppc_loo_pit_ecdf()`), +#' and users can call it directly to create custom LOO-PIT plots using +#' ggplot2. The function computes the leave-one-out probability integral +#' transform (LOO-PIT) values and returns a data frame that can be used to +#' build ggplot objects. This is useful when you want to create custom +#' visualizations of LOO-PIT values beyond what the built-in plotting +#' functions provide. +#' } #' \item{`ppc_loo_pit_overlay()`, `ppc_loo_pit_qq()`, `ppc_loo_pit_ecdf()`}{ #' The calibration of marginal predictions can be assessed using probability #' integral transformation (PIT) checks. LOO improves the check by avoiding the diff --git a/man/PPC-distributions.Rd b/man/PPC-distributions.Rd index c31242e8..64bba2a3 100644 --- a/man/PPC-distributions.Rd +++ b/man/PPC-distributions.Rd @@ -264,6 +264,15 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_data()}}{ +This function prepares data for plotting with \strong{ggplot2}. It is the +data-preparation back end for all the \verb{ppc_*()} plotting functions, and +users can call it directly to create custom PPC plots using ggplot2. The +function returns a data frame (or list of data frames) that can be used to +build ggplot objects. This is useful when you want to customize the +appearance of PPC plots beyond what the built-in plotting functions allow, +or when you want to create entirely new types of PPC visualizations. +} \item{\verb{ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()}}{ A separate histogram, shaded frequency polygon, smoothed kernel density estimate, or box and whiskers plot is displayed for \code{y} and each diff --git a/man/PPC-loo.Rd b/man/PPC-loo.Rd index 555898d8..7e9ebe02 100644 --- a/man/PPC-loo.Rd +++ b/man/PPC-loo.Rd @@ -223,7 +223,10 @@ order of the observations. The alternative (\code{"median"}) arranges them by median value from smallest (left) to largest (right).} } \value{ -A ggplot object that can be further customized using the \strong{ggplot2} package. +The plotting functions return a ggplot object that can be further +customized using the \strong{ggplot2} package. The functions with suffix +\verb{_data()} return the data that would have been drawn by the plotting +function. } \description{ Leave-One-Out (LOO) predictive checks. See the \strong{Plot Descriptions} section, @@ -233,6 +236,17 @@ for details. \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_loo_pit_data()}}{ +This function prepares LOO-PIT data for plotting with \strong{ggplot2}. It is +the data-preparation back end for the LOO-PIT plotting functions +(\code{ppc_loo_pit_overlay()}, \code{ppc_loo_pit_qq()}, and \code{ppc_loo_pit_ecdf()}), +and users can call it directly to create custom LOO-PIT plots using +ggplot2. The function computes the leave-one-out probability integral +transform (LOO-PIT) values and returns a data frame that can be used to +build ggplot objects. This is useful when you want to create custom +visualizations of LOO-PIT values beyond what the built-in plotting +functions provide. +} \item{\code{ppc_loo_pit_overlay()}, \code{ppc_loo_pit_qq()}, \code{ppc_loo_pit_ecdf()}}{ The calibration of marginal predictions can be assessed using probability integral transformation (PIT) checks. LOO improves the check by avoiding the From a8260cf9e0f236bbaa76dd11194352f3e7b06c47 Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Thu, 26 Feb 2026 17:20:42 +0530 Subject: [PATCH 2/4] Replaced all ppc_*() functions with many ppc_*() for accuracy, corrected the return type to data frame, and refined wording to avoid overclaiming functionality --- R/ppc-distributions.R | 14 +++++++------- man/PPC-distributions.Rd | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index fda798af..217ad315 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -23,13 +23,13 @@ #' @section Plot Descriptions: #' \describe{ #' \item{`ppc_data()`}{ -#' This function prepares data for plotting with **ggplot2**. It is the -#' data-preparation back end for all the `ppc_*()` plotting functions, and -#' users can call it directly to create custom PPC plots using ggplot2. The -#' function returns a data frame (or list of data frames) that can be used to -#' build ggplot objects. This is useful when you want to customize the -#' appearance of PPC plots beyond what the built-in plotting functions allow, -#' or when you want to create entirely new types of PPC visualizations. +#' This function prepares data for plotting with **ggplot2**. It is a +#' general-purpose data-preparation helper used by many `ppc_*()` plotting +#' functions, and users can call it directly to create custom PPC plots using +#' ggplot2. The function returns a data frame that can be used to build ggplot +#' objects. This is useful when you want to customize the appearance of PPC +#' plots beyond what the built-in plotting functions allow, or when you want to +#' construct new types of PPC visualizations based on the same underlying data. #' } #' \item{`ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()`}{ #' A separate histogram, shaded frequency polygon, smoothed kernel density diff --git a/man/PPC-distributions.Rd b/man/PPC-distributions.Rd index 64bba2a3..e1d6825d 100644 --- a/man/PPC-distributions.Rd +++ b/man/PPC-distributions.Rd @@ -265,13 +265,13 @@ the input contains the "success" \emph{proportions} (not discrete \describe{ \item{\code{ppc_data()}}{ -This function prepares data for plotting with \strong{ggplot2}. It is the -data-preparation back end for all the \verb{ppc_*()} plotting functions, and -users can call it directly to create custom PPC plots using ggplot2. The -function returns a data frame (or list of data frames) that can be used to -build ggplot objects. This is useful when you want to customize the -appearance of PPC plots beyond what the built-in plotting functions allow, -or when you want to create entirely new types of PPC visualizations. +This function prepares data for plotting with \strong{ggplot2}. It is a +general-purpose data-preparation helper used by many \verb{ppc_*()} plotting +functions, and users can call it directly to create custom PPC plots using +ggplot2. The function returns a data frame that can be used to build ggplot +objects. This is useful when you want to customize the appearance of PPC +plots beyond what the built-in plotting functions allow, or when you want to +construct new types of PPC visualizations based on the same underlying data. } \item{\verb{ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()}}{ A separate histogram, shaded frequency polygon, smoothed kernel density From d2d85449457bf9a630d178664352b591f9da294f Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Sun, 8 Mar 2026 15:37:05 +0530 Subject: [PATCH 3/4] Document all *_data() functions (#209) --- NEWS.md | 2 +- R/mcmc-diagnostics.R | 14 ++++++++++++++ R/mcmc-distributions.R | 8 +++++++- R/mcmc-intervals.R | 7 +++++++ R/mcmc-parcoord.R | 6 ++++++ R/mcmc-traces.R | 7 +++++++ R/ppc-discrete.R | 5 +++++ R/ppc-errors.R | 8 +++++++- R/ppc-intervals.R | 7 +++++++ R/ppc-scatterplots.R | 8 ++++++++ R/ppc-test-statistics.R | 7 +++++++ R/ppd-distributions.R | 11 +++++++++++ R/ppd-intervals.R | 13 +++++++++++++ R/ppd-test-statistics.R | 12 ++++++++++++ man/MCMC-diagnostics.Rd | 14 ++++++++++++++ man/MCMC-distributions.Rd | 11 ++++++++++- man/MCMC-intervals.Rd | 7 +++++++ man/MCMC-parcoord.Rd | 6 ++++++ man/MCMC-traces.Rd | 7 +++++++ man/PPC-discrete.Rd | 5 +++++ man/PPC-errors.Rd | 11 ++++++++++- man/PPC-intervals.Rd | 7 +++++++ man/PPC-scatterplots.Rd | 8 ++++++++ man/PPC-test-statistics.Rd | 7 +++++++ man/PPD-distributions.Rd | 13 +++++++++++++ man/PPD-intervals.Rd | 15 +++++++++++++++ man/PPD-test-statistics.Rd | 14 ++++++++++++++ 27 files changed, 235 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index be2a6061..b3e8922c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # bayesplot (development version) -* Documentation added for `ppc_data()` and `ppc_loo_pit_data()` functions (#209) +* Documentation added for all exported `*_data()` functions (#209) * Improved documentation for `binwidth`, `bins`, and `breaks` arguments to clarify they are passed to `ggplot2::geom_area()` and `ggdist::stat_dots()` in addition to `ggplot2::geom_histogram()` * Improved documentation for `freq` argument to clarify it applies to frequency polygons in addition to histograms * Fixed test in `test-ppc-distributions.R` that incorrectly used `ppc_dens()` instead of `ppd_dens()` when testing PPD functions diff --git a/R/mcmc-diagnostics.R b/R/mcmc-diagnostics.R index 3dc1b324..516cb20b 100644 --- a/R/mcmc-diagnostics.R +++ b/R/mcmc-diagnostics.R @@ -18,6 +18,20 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`mcmc_rhat_data()`}{ +#' Data-preparation back end for `mcmc_rhat()` and `mcmc_rhat_hist()`. +#' Users can call `mcmc_rhat_data()` directly to obtain the data frame of +#' Rhat values with rating labels and create custom Rhat diagnostic +#' visualizations with **ggplot2**. +#' } +#' +#' \item{`mcmc_neff_data()`}{ +#' Data-preparation back end for `mcmc_neff()` and `mcmc_neff_hist()`. +#' Users can call `mcmc_neff_data()` directly to obtain the data frame of +#' effective-sample-size ratios with rating labels and create custom Neff +#' diagnostic visualizations with **ggplot2**. +#' } +#' #' \item{`mcmc_rhat()`, `mcmc_rhat_hist()`}{ #' Rhat values as either points or a histogram. Values are colored using #' different shades (lighter is better). The chosen thresholds are somewhat diff --git a/R/mcmc-distributions.R b/R/mcmc-distributions.R index aa0eff84..9a7c5835 100644 --- a/R/mcmc-distributions.R +++ b/R/mcmc-distributions.R @@ -15,10 +15,16 @@ #' @param ... For dot plots, optional additional arguments to pass to [ggdist::stat_dots()]. #' @param alpha Passed to the geom to control the transparency. #' -#' @template return-ggplot +#' @template return-ggplot-or-data #' #' @section Plot Descriptions: #' \describe{ +#' \item{`mcmc_dens_chains_data()`}{ +#' Data-preparation back end for `mcmc_dens_chains()`. Users can call +#' `mcmc_dens_chains_data()` directly to obtain the prepared long-format +#' data frame of MCMC draws (with chain information retained) and create +#' custom ridgeline density visualizations with **ggplot2**. +#' } #' \item{`mcmc_hist()`}{ #' Histograms of posterior draws with all chains merged. #' } diff --git a/R/mcmc-intervals.R b/R/mcmc-intervals.R index 13687846..6110891a 100644 --- a/R/mcmc-intervals.R +++ b/R/mcmc-intervals.R @@ -38,6 +38,13 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`mcmc_intervals_data()`, `mcmc_areas_data()`, `mcmc_areas_ridges_data()`}{ +#' Data-preparation back ends for `mcmc_intervals()`, `mcmc_areas()`, and +#' `mcmc_areas_ridges()`, respectively. Users can call these functions +#' directly to obtain the prepared data frames of posterior interval +#' summaries and create custom interval or density-area visualizations +#' with **ggplot2**. +#' } #' \item{`mcmc_intervals()`}{ #' Plots of uncertainty intervals computed from posterior draws with all #' chains merged. diff --git a/R/mcmc-parcoord.R b/R/mcmc-parcoord.R index f3718e18..64d927df 100644 --- a/R/mcmc-parcoord.R +++ b/R/mcmc-parcoord.R @@ -29,6 +29,12 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`mcmc_parcoord_data()`}{ +#' Data-preparation back end for `mcmc_parcoord()`. Users can call +#' `mcmc_parcoord_data()` directly to obtain the prepared long-format data +#' frame of MCMC draws (with optional NUTS diagnostic information) and +#' create custom parallel coordinates visualizations with **ggplot2**. +#' } #' \item{`mcmc_parcoord()`}{ #' [Parallel coordinates plot](https://en.wikipedia.org/wiki/Parallel_coordinates) #' of MCMC draws. There is one dimension per parameter along the horizontal diff --git a/R/mcmc-traces.R b/R/mcmc-traces.R index 57449883..adad5aa2 100644 --- a/R/mcmc-traces.R +++ b/R/mcmc-traces.R @@ -45,6 +45,13 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`mcmc_trace_data()`}{ +#' Data-preparation back end for `mcmc_trace()`, `mcmc_trace_highlight()`, +#' `mcmc_rank_hist()`, `mcmc_rank_overlay()`, and `mcmc_rank_ecdf()`. The +#' returned data frame contains columns for both the original draw values +#' and their within-parameter ranks, so it can be used to build both trace +#' and rank-based visualizations with **ggplot2**. +#' } #' \item{`mcmc_trace()`}{ #' Standard trace plots of MCMC draws. For models fit using [NUTS], #' the `np` argument can be used to also show divergences on the trace plot. diff --git a/R/ppc-discrete.R b/R/ppc-discrete.R index c346247f..7122a620 100644 --- a/R/ppc-discrete.R +++ b/R/ppc-discrete.R @@ -37,6 +37,11 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_bars_data()`}{ +#' Data-preparation back end for `ppc_bars()` and `ppc_bars_grouped()`. +#' Users can call `ppc_bars_data()` directly to obtain the prepared data +#' frame and create custom bar chart visualizations with **ggplot2**. +#' } #' \item{`ppc_bars()`}{ #' Bar plot of `y` with `yrep` medians and uncertainty intervals #' superimposed on the bars. diff --git a/R/ppc-errors.R b/R/ppc-errors.R index 31ecfb2b..94c9e5ee 100644 --- a/R/ppc-errors.R +++ b/R/ppc-errors.R @@ -33,6 +33,12 @@ #' #' @section Plot descriptions: #' \describe{ +#' \item{`ppc_error_data()`}{ +#' Data-preparation back end for the `ppc_error_*()` family of plotting +#' functions. Users can call `ppc_error_data()` directly to obtain the +#' data frame of predictive errors (`y - yrep`) and create custom error +#' visualizations with **ggplot2**. +#' } #' \item{`ppc_error_hist()`}{ #' A separate histogram is plotted for the predictive errors computed from #' `y` and each dataset (row) in `yrep`. For this plot `yrep` should have @@ -69,7 +75,7 @@ #' } #' } #' -#' @template return-ggplot +#' @template return-ggplot-or-data #' #' @templateVar bdaRef (Ch. 6) #' @template reference-bda diff --git a/R/ppc-intervals.R b/R/ppc-intervals.R index d41bf90f..a21daa46 100644 --- a/R/ppc-intervals.R +++ b/R/ppc-intervals.R @@ -33,6 +33,13 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_intervals_data()`, `ppc_ribbon_data()`}{ +#' Data-preparation back end for `ppc_intervals()`, `ppc_ribbon()`, and +#' their grouped variants. `ppc_ribbon_data()` is an alias for +#' `ppc_intervals_data()`. Users can call either function directly to +#' obtain the prepared data frame and create custom interval or ribbon +#' visualizations with **ggplot2**. +#' } #' \item{`ppc_intervals(), ppc_ribbon()`}{ #' `100*prob`% central intervals for `yrep` at each `x` #' value. `ppc_intervals()` plots intervals as vertical bars with points diff --git a/R/ppc-scatterplots.R b/R/ppc-scatterplots.R index 50802f82..8c483221 100644 --- a/R/ppc-scatterplots.R +++ b/R/ppc-scatterplots.R @@ -29,6 +29,14 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_scatter_data()`, `ppc_scatter_avg_data()`}{ +#' Data-preparation back ends for the `ppc_scatter*()` family of plotting +#' functions. `ppc_scatter_data()` returns a data frame with one row per +#' observation per `yrep` draw, while `ppc_scatter_avg_data()` returns a +#' data frame with one row per observation summarising `yrep` draws with +#' the chosen `stat`. Users can call these functions directly to create +#' custom scatterplot visualizations with **ggplot2**. +#' } #' \item{`ppc_scatter()`}{ #' For each dataset (row) in `yrep` a scatterplot is generated showing `y` #' against that row of `yrep`. For this plot `yrep` should only contain a diff --git a/R/ppc-test-statistics.R b/R/ppc-test-statistics.R index ecaabfd4..23b71a86 100644 --- a/R/ppc-test-statistics.R +++ b/R/ppc-test-statistics.R @@ -38,6 +38,13 @@ #' #' @section Plot Descriptions: #' \describe{ +#' \item{`ppc_stat_data()`}{ +#' Data-preparation back end for `ppc_stat()`, `ppc_stat_freqpoly()`, and +#' their grouped variants. Users can call `ppc_stat_data()` directly to +#' obtain the data frame of test-statistic values computed from `y` and +#' each row of `yrep`, enabling custom test-statistic visualizations with +#' **ggplot2**. +#' } #' \item{`ppc_stat()`, `ppc_stat_freqpoly()`}{ #' A histogram/bar plot or frequency polygon of the distribution of a statistic #' computed by applying `stat` to each dataset (row) in `yrep`. The value of diff --git a/R/ppd-distributions.R b/R/ppd-distributions.R index 70c4e5a6..bb3eda05 100644 --- a/R/ppd-distributions.R +++ b/R/ppd-distributions.R @@ -14,6 +14,17 @@ #' @template details-binomial #' @template return-ggplot-or-data #' +#' @section Plot Descriptions: +#' \describe{ +#' \item{`ppd_data()`}{ +#' Data-preparation back end for `ppd_dens_overlay()` and related +#' `ppd_*()` distribution plotting functions. Users can call `ppd_data()` +#' directly to obtain the prepared data frame and create custom +#' posterior/prior predictive distribution visualizations with **ggplot2**. +#' The `ppd_data()` function is the PPD counterpart to [ppc_data()]. +#' } +#' } +#' #' @examples #' # difference between ppd_dens_overlay() and ppc_dens_overlay() #' color_scheme_set("brightblue") diff --git a/R/ppd-intervals.R b/R/ppd-intervals.R index 63184072..3db0dd34 100644 --- a/R/ppd-intervals.R +++ b/R/ppd-intervals.R @@ -14,6 +14,19 @@ #' #' @template return-ggplot-or-data #' +#' @section Plot Descriptions: +#' \describe{ +#' \item{`ppd_intervals_data()`, `ppd_ribbon_data()`}{ +#' Data-preparation back end for `ppd_intervals()`, `ppd_ribbon()`, and +#' their grouped variants. `ppd_ribbon_data()` is an alias for +#' `ppd_intervals_data()`. Users can call either function directly to +#' obtain the prepared data frame and create custom interval or ribbon +#' visualizations with **ggplot2**. +#' These functions are PPD counterparts to [ppc_intervals_data()] and +#' [ppc_ribbon_data()]. +#' } +#' } +#' #' @template reference-vis-paper #' #' @examples diff --git a/R/ppd-test-statistics.R b/R/ppd-test-statistics.R index d7146405..44441d3c 100644 --- a/R/ppd-test-statistics.R +++ b/R/ppd-test-statistics.R @@ -17,6 +17,18 @@ #' @template details-binomial #' @template return-ggplot-or-data #' +#' @section Plot Descriptions: +#' \describe{ +#' \item{`ppd_stat_data()`}{ +#' Data-preparation back end for `ppd_stat()`, `ppd_stat_freqpoly()`, and +#' their grouped variants. Users can call `ppd_stat_data()` directly to +#' obtain the data frame of test-statistic values computed from each row of +#' `ypred`, enabling custom test-statistic visualizations with **ggplot2**. +#' The `ppd_stat_data()` function is the PPD counterpart to +#' [ppc_stat_data()]. +#' } +#' } +#' #' @template reference-vis-paper #' @examples #' yrep <- example_yrep_draws() diff --git a/man/MCMC-diagnostics.Rd b/man/MCMC-diagnostics.Rd index b396717e..d1d54681 100644 --- a/man/MCMC-diagnostics.Rd +++ b/man/MCMC-diagnostics.Rd @@ -111,6 +111,20 @@ also \link{MCMC-nuts} for additional MCMC diagnostic plots. \section{Plot Descriptions}{ \describe{ +\item{\code{mcmc_rhat_data()}}{ +Data-preparation back end for \code{mcmc_rhat()} and \code{mcmc_rhat_hist()}. +Users can call \code{mcmc_rhat_data()} directly to obtain the data frame of +Rhat values with rating labels and create custom Rhat diagnostic +visualizations with \strong{ggplot2}. +} + +\item{\code{mcmc_neff_data()}}{ +Data-preparation back end for \code{mcmc_neff()} and \code{mcmc_neff_hist()}. +Users can call \code{mcmc_neff_data()} directly to obtain the data frame of +effective-sample-size ratios with rating labels and create custom Neff +diagnostic visualizations with \strong{ggplot2}. +} + \item{\code{mcmc_rhat()}, \code{mcmc_rhat_hist()}}{ Rhat values as either points or a histogram. Values are colored using different shades (lighter is better). The chosen thresholds are somewhat diff --git a/man/MCMC-distributions.Rd b/man/MCMC-distributions.Rd index ec69c799..a29abafe 100644 --- a/man/MCMC-distributions.Rd +++ b/man/MCMC-distributions.Rd @@ -224,7 +224,10 @@ The default is \code{quantiles=100} so that each dot represent one percent of posterior mass.} } \value{ -A ggplot object that can be further customized using the \strong{ggplot2} package. +The plotting functions return a ggplot object that can be further +customized using the \strong{ggplot2} package. The functions with suffix +\verb{_data()} return the data that would have been drawn by the plotting +function. } \description{ Various types of histograms and kernel density plots of MCMC draws. See the @@ -233,6 +236,12 @@ Various types of histograms and kernel density plots of MCMC draws. See the \section{Plot Descriptions}{ \describe{ +\item{\code{mcmc_dens_chains_data()}}{ +Data-preparation back end for \code{mcmc_dens_chains()}. Users can call +\code{mcmc_dens_chains_data()} directly to obtain the prepared long-format +data frame of MCMC draws (with chain information retained) and create +custom ridgeline density visualizations with \strong{ggplot2}. +} \item{\code{mcmc_hist()}}{ Histograms of posterior draws with all chains merged. } diff --git a/man/MCMC-intervals.Rd b/man/MCMC-intervals.Rd index c0c1605a..a6cbbb68 100644 --- a/man/MCMC-intervals.Rd +++ b/man/MCMC-intervals.Rd @@ -201,6 +201,13 @@ See the \strong{Plot Descriptions} section, below, for details. \section{Plot Descriptions}{ \describe{ +\item{\code{mcmc_intervals_data()}, \code{mcmc_areas_data()}, \code{mcmc_areas_ridges_data()}}{ +Data-preparation back ends for \code{mcmc_intervals()}, \code{mcmc_areas()}, and +\code{mcmc_areas_ridges()}, respectively. Users can call these functions +directly to obtain the prepared data frames of posterior interval +summaries and create custom interval or density-area visualizations +with \strong{ggplot2}. +} \item{\code{mcmc_intervals()}}{ Plots of uncertainty intervals computed from posterior draws with all chains merged. diff --git a/man/MCMC-parcoord.Rd b/man/MCMC-parcoord.Rd index 3ea32731..3f7a1979 100644 --- a/man/MCMC-parcoord.Rd +++ b/man/MCMC-parcoord.Rd @@ -112,6 +112,12 @@ for more background and a real example. \section{Plot Descriptions}{ \describe{ +\item{\code{mcmc_parcoord_data()}}{ +Data-preparation back end for \code{mcmc_parcoord()}. Users can call +\code{mcmc_parcoord_data()} directly to obtain the prepared long-format data +frame of MCMC draws (with optional NUTS diagnostic information) and +create custom parallel coordinates visualizations with \strong{ggplot2}. +} \item{\code{mcmc_parcoord()}}{ \href{https://en.wikipedia.org/wiki/Parallel_coordinates}{Parallel coordinates plot} of MCMC draws. There is one dimension per parameter along the horizontal diff --git a/man/MCMC-traces.Rd b/man/MCMC-traces.Rd index 8d578352..233ccdf5 100644 --- a/man/MCMC-traces.Rd +++ b/man/MCMC-traces.Rd @@ -231,6 +231,13 @@ section, below, for details. \section{Plot Descriptions}{ \describe{ +\item{\code{mcmc_trace_data()}}{ +Data-preparation back end for \code{mcmc_trace()}, \code{mcmc_trace_highlight()}, +\code{mcmc_rank_hist()}, \code{mcmc_rank_overlay()}, and \code{mcmc_rank_ecdf()}. The +returned data frame contains columns for both the original draw values +and their within-parameter ranks, so it can be used to build both trace +and rank-based visualizations with \strong{ggplot2}. +} \item{\code{mcmc_trace()}}{ Standard trace plots of MCMC draws. For models fit using \link{NUTS}, the \code{np} argument can be used to also show divergences on the trace plot. diff --git a/man/PPC-discrete.Rd b/man/PPC-discrete.Rd index d996cd95..262821e5 100644 --- a/man/PPC-discrete.Rd +++ b/man/PPC-discrete.Rd @@ -115,6 +115,11 @@ be non-negative. \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_bars_data()}}{ +Data-preparation back end for \code{ppc_bars()} and \code{ppc_bars_grouped()}. +Users can call \code{ppc_bars_data()} directly to obtain the prepared data +frame and create custom bar chart visualizations with \strong{ggplot2}. +} \item{\code{ppc_bars()}}{ Bar plot of \code{y} with \code{yrep} medians and uncertainty intervals superimposed on the bars. diff --git a/man/PPC-errors.Rd b/man/PPC-errors.Rd index 8e3d28c7..b8dea34a 100644 --- a/man/PPC-errors.Rd +++ b/man/PPC-errors.Rd @@ -132,7 +132,10 @@ return a scalar statistic. The function name is displayed in the axis-label. Defaults to \code{"mean"}.} } \value{ -A ggplot object that can be further customized using the \strong{ggplot2} package. +The plotting functions return a ggplot object that can be further +customized using the \strong{ggplot2} package. The functions with suffix +\verb{_data()} return the data that would have been drawn by the plotting +function. } \description{ Various plots of predictive errors \code{y - yrep}. See the @@ -152,6 +155,12 @@ proportions (not counts). See the \strong{Examples} section, below. \section{Plot descriptions}{ \describe{ +\item{\code{ppc_error_data()}}{ +Data-preparation back end for the \verb{ppc_error_*()} family of plotting +functions. Users can call \code{ppc_error_data()} directly to obtain the +data frame of predictive errors (\code{y - yrep}) and create custom error +visualizations with \strong{ggplot2}. +} \item{\code{ppc_error_hist()}}{ A separate histogram is plotted for the predictive errors computed from \code{y} and each dataset (row) in \code{yrep}. For this plot \code{yrep} should have diff --git a/man/PPC-intervals.Rd b/man/PPC-intervals.Rd index ddac2ebc..530d4034 100644 --- a/man/PPC-intervals.Rd +++ b/man/PPC-intervals.Rd @@ -141,6 +141,13 @@ See the \strong{Plot Descriptions} section, below. \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_intervals_data()}, \code{ppc_ribbon_data()}}{ +Data-preparation back end for \code{ppc_intervals()}, \code{ppc_ribbon()}, and +their grouped variants. \code{ppc_ribbon_data()} is an alias for +\code{ppc_intervals_data()}. Users can call either function directly to +obtain the prepared data frame and create custom interval or ribbon +visualizations with \strong{ggplot2}. +} \item{\verb{ppc_intervals(), ppc_ribbon()}}{ \code{100*prob}\% central intervals for \code{yrep} at each \code{x} value. \code{ppc_intervals()} plots intervals as vertical bars with points diff --git a/man/PPC-scatterplots.Rd b/man/PPC-scatterplots.Rd index 2c22bbd3..de33d641 100644 --- a/man/PPC-scatterplots.Rd +++ b/man/PPC-scatterplots.Rd @@ -100,6 +100,14 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_scatter_data()}, \code{ppc_scatter_avg_data()}}{ +Data-preparation back ends for the \verb{ppc_scatter*()} family of plotting +functions. \code{ppc_scatter_data()} returns a data frame with one row per +observation per \code{yrep} draw, while \code{ppc_scatter_avg_data()} returns a +data frame with one row per observation summarising \code{yrep} draws with +the chosen \code{stat}. Users can call these functions directly to create +custom scatterplot visualizations with \strong{ggplot2}. +} \item{\code{ppc_scatter()}}{ For each dataset (row) in \code{yrep} a scatterplot is generated showing \code{y} against that row of \code{yrep}. For this plot \code{yrep} should only contain a diff --git a/man/PPC-test-statistics.Rd b/man/PPC-test-statistics.Rd index 3f0bf3e0..8a1296f7 100644 --- a/man/PPC-test-statistics.Rd +++ b/man/PPC-test-statistics.Rd @@ -142,6 +142,13 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ +\item{\code{ppc_stat_data()}}{ +Data-preparation back end for \code{ppc_stat()}, \code{ppc_stat_freqpoly()}, and +their grouped variants. Users can call \code{ppc_stat_data()} directly to +obtain the data frame of test-statistic values computed from \code{y} and +each row of \code{yrep}, enabling custom test-statistic visualizations with +\strong{ggplot2}. +} \item{\code{ppc_stat()}, \code{ppc_stat_freqpoly()}}{ A histogram/bar plot or frequency polygon of the distribution of a statistic computed by applying \code{stat} to each dataset (row) in \code{yrep}. The value of diff --git a/man/PPD-distributions.Rd b/man/PPD-distributions.Rd index a53c62e4..38a44d86 100644 --- a/man/PPD-distributions.Rd +++ b/man/PPD-distributions.Rd @@ -138,6 +138,19 @@ For Binomial data, the plots may be more useful if the input contains the "success" \emph{proportions} (not discrete "success" or "failure" counts). } +\section{Plot Descriptions}{ + +\describe{ +\item{\code{ppd_data()}}{ +Data-preparation back end for \code{ppd_dens_overlay()} and related +\verb{ppd_*()} distribution plotting functions. Users can call \code{ppd_data()} +directly to obtain the prepared data frame and create custom +posterior/prior predictive distribution visualizations with \strong{ggplot2}. +The \code{ppd_data()} function is the PPD counterpart to \code{\link[=ppc_data]{ppc_data()}}. +} +} +} + \examples{ # difference between ppd_dens_overlay() and ppc_dens_overlay() color_scheme_set("brightblue") diff --git a/man/PPD-intervals.Rd b/man/PPD-intervals.Rd index 9548709f..d172c852 100644 --- a/man/PPD-intervals.Rd +++ b/man/PPD-intervals.Rd @@ -125,6 +125,21 @@ corresponding \code{\link[=PPC-intervals]{ppc_}} function but without plotting a observed data \code{y}. The \strong{Plot Descriptions} section at \link{PPC-intervals} has details on the individual plots. } +\section{Plot Descriptions}{ + +\describe{ +\item{\code{ppd_intervals_data()}, \code{ppd_ribbon_data()}}{ +Data-preparation back end for \code{ppd_intervals()}, \code{ppd_ribbon()}, and +their grouped variants. \code{ppd_ribbon_data()} is an alias for +\code{ppd_intervals_data()}. Users can call either function directly to +obtain the prepared data frame and create custom interval or ribbon +visualizations with \strong{ggplot2}. +These functions are PPD counterparts to \code{\link[=ppc_intervals_data]{ppc_intervals_data()}} and +\code{\link[=ppc_ribbon_data]{ppc_ribbon_data()}}. +} +} +} + \examples{ color_scheme_set("brightblue") ypred <- example_yrep_draws() diff --git a/man/PPD-test-statistics.Rd b/man/PPD-test-statistics.Rd index 7c8b41f3..6583a777 100644 --- a/man/PPD-test-statistics.Rd +++ b/man/PPD-test-statistics.Rd @@ -126,6 +126,20 @@ For Binomial data, the plots may be more useful if the input contains the "success" \emph{proportions} (not discrete "success" or "failure" counts). } +\section{Plot Descriptions}{ + +\describe{ +\item{\code{ppd_stat_data()}}{ +Data-preparation back end for \code{ppd_stat()}, \code{ppd_stat_freqpoly()}, and +their grouped variants. Users can call \code{ppd_stat_data()} directly to +obtain the data frame of test-statistic values computed from each row of +\code{ypred}, enabling custom test-statistic visualizations with \strong{ggplot2}. +The \code{ppd_stat_data()} function is the PPD counterpart to +\code{\link[=ppc_stat_data]{ppc_stat_data()}}. +} +} +} + \examples{ yrep <- example_yrep_draws() ppd_stat(yrep) From 5e61b03b42bf33182eb28eace5042d37630bc868 Mon Sep 17 00:00:00 2001 From: jgabry Date: Mon, 9 Mar 2026 11:10:37 -0600 Subject: [PATCH 4/4] Minor edits * move doc of _data() functions below doc of plotting functions --- R/mcmc-diagnostics.R | 15 ++++----------- R/mcmc-distributions.R | 12 ++++++------ R/mcmc-intervals.R | 14 +++++++------- R/mcmc-parcoord.R | 12 ++++++------ R/mcmc-traces.R | 14 +++++++------- R/ppc-discrete.R | 10 +++++----- R/ppc-distributions.R | 22 +++++++++++----------- R/ppc-errors.R | 12 ++++++------ R/ppc-intervals.R | 14 +++++++------- R/ppc-scatterplots.R | 16 ++++++++-------- R/ppc-test-statistics.R | 14 +++++++------- R/ppd-distributions.R | 11 ----------- R/ppd-intervals.R | 13 ------------- R/ppd-test-statistics.R | 12 ------------ man/MCMC-diagnostics.Rd | 15 ++++----------- man/MCMC-distributions.Rd | 12 ++++++------ man/MCMC-intervals.Rd | 14 +++++++------- man/MCMC-parcoord.Rd | 12 ++++++------ man/MCMC-traces.Rd | 14 +++++++------- man/PPC-discrete.Rd | 10 +++++----- man/PPC-distributions.Rd | 22 +++++++++++----------- man/PPC-errors.Rd | 12 ++++++------ man/PPC-intervals.Rd | 14 +++++++------- man/PPC-scatterplots.Rd | 16 ++++++++-------- man/PPC-test-statistics.Rd | 14 +++++++------- man/PPD-distributions.Rd | 13 ------------- man/PPD-intervals.Rd | 15 --------------- man/PPD-test-statistics.Rd | 14 -------------- 28 files changed, 148 insertions(+), 240 deletions(-) diff --git a/R/mcmc-diagnostics.R b/R/mcmc-diagnostics.R index 516cb20b..2727928f 100644 --- a/R/mcmc-diagnostics.R +++ b/R/mcmc-diagnostics.R @@ -18,20 +18,13 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`mcmc_rhat_data()`}{ -#' Data-preparation back end for `mcmc_rhat()` and `mcmc_rhat_hist()`. -#' Users can call `mcmc_rhat_data()` directly to obtain the data frame of -#' Rhat values with rating labels and create custom Rhat diagnostic +#' \item{`mcmc_rhat_data()`, `mcmc_neff_data()`}{ +#' Data-preparation back ends for the R-hat and effective sample size plots. +#' Users can call these functions directly to obtain the data frame of +#' diagnostic values with rating labels and create custom diagnostic #' visualizations with **ggplot2**. #' } #' -#' \item{`mcmc_neff_data()`}{ -#' Data-preparation back end for `mcmc_neff()` and `mcmc_neff_hist()`. -#' Users can call `mcmc_neff_data()` directly to obtain the data frame of -#' effective-sample-size ratios with rating labels and create custom Neff -#' diagnostic visualizations with **ggplot2**. -#' } -#' #' \item{`mcmc_rhat()`, `mcmc_rhat_hist()`}{ #' Rhat values as either points or a histogram. Values are colored using #' different shades (lighter is better). The chosen thresholds are somewhat diff --git a/R/mcmc-distributions.R b/R/mcmc-distributions.R index 9a7c5835..fbb34ad2 100644 --- a/R/mcmc-distributions.R +++ b/R/mcmc-distributions.R @@ -19,12 +19,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`mcmc_dens_chains_data()`}{ -#' Data-preparation back end for `mcmc_dens_chains()`. Users can call -#' `mcmc_dens_chains_data()` directly to obtain the prepared long-format -#' data frame of MCMC draws (with chain information retained) and create -#' custom ridgeline density visualizations with **ggplot2**. -#' } #' \item{`mcmc_hist()`}{ #' Histograms of posterior draws with all chains merged. #' } @@ -54,6 +48,12 @@ #' appear in separate facets; in `mcmc_dens_chains()` they appear in the #' same panel and can overlap vertically. #' } +#' \item{`mcmc_dens_chains_data()`}{ +#' Data-preparation back end for `mcmc_dens_chains()`. Users can call this +#' function directly to obtain the prepared long-format data frame of MCMC +#' draws (with chain information retained) and create custom visualizations +#' with **ggplot2**. +#' } #' } #' #' @examples diff --git a/R/mcmc-intervals.R b/R/mcmc-intervals.R index 6110891a..1ab9298a 100644 --- a/R/mcmc-intervals.R +++ b/R/mcmc-intervals.R @@ -38,13 +38,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`mcmc_intervals_data()`, `mcmc_areas_data()`, `mcmc_areas_ridges_data()`}{ -#' Data-preparation back ends for `mcmc_intervals()`, `mcmc_areas()`, and -#' `mcmc_areas_ridges()`, respectively. Users can call these functions -#' directly to obtain the prepared data frames of posterior interval -#' summaries and create custom interval or density-area visualizations -#' with **ggplot2**. -#' } #' \item{`mcmc_intervals()`}{ #' Plots of uncertainty intervals computed from posterior draws with all #' chains merged. @@ -58,6 +51,13 @@ #' ridgelines. This plot provides a compact display of (hierarchically) #' related distributions. #' } +#' \item{`mcmc_intervals_data()`, `mcmc_areas_data()`, `mcmc_areas_ridges_data()`}{ +#' Data-preparation back ends for `mcmc_intervals()`, `mcmc_areas()`, and +#' `mcmc_areas_ridges()`, respectively. Users can call these functions +#' directly to obtain the prepared data frames of posterior interval +#' summaries and create custom interval or density-area visualizations +#' with **ggplot2**. +#' } #' } #' #' @examples diff --git a/R/mcmc-parcoord.R b/R/mcmc-parcoord.R index 64d927df..6891ed46 100644 --- a/R/mcmc-parcoord.R +++ b/R/mcmc-parcoord.R @@ -29,12 +29,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`mcmc_parcoord_data()`}{ -#' Data-preparation back end for `mcmc_parcoord()`. Users can call -#' `mcmc_parcoord_data()` directly to obtain the prepared long-format data -#' frame of MCMC draws (with optional NUTS diagnostic information) and -#' create custom parallel coordinates visualizations with **ggplot2**. -#' } #' \item{`mcmc_parcoord()`}{ #' [Parallel coordinates plot](https://en.wikipedia.org/wiki/Parallel_coordinates) #' of MCMC draws. There is one dimension per parameter along the horizontal @@ -54,6 +48,12 @@ #' when specifying the `transformations` argument to #' `mcmc_parcoord`. See the **Examples** section for how to do this. #' } +#' \item{`mcmc_parcoord_data()`}{ +#' Data-preparation back end for `mcmc_parcoord()`. Users can call +#' `mcmc_parcoord_data()` directly to obtain the prepared long-format data +#' frame of MCMC draws (with optional NUTS diagnostic information) and +#' create custom visualizations with **ggplot2**. +#' } #' } #' #' @template reference-vis-paper diff --git a/R/mcmc-traces.R b/R/mcmc-traces.R index adad5aa2..cad857ae 100644 --- a/R/mcmc-traces.R +++ b/R/mcmc-traces.R @@ -45,13 +45,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`mcmc_trace_data()`}{ -#' Data-preparation back end for `mcmc_trace()`, `mcmc_trace_highlight()`, -#' `mcmc_rank_hist()`, `mcmc_rank_overlay()`, and `mcmc_rank_ecdf()`. The -#' returned data frame contains columns for both the original draw values -#' and their within-parameter ranks, so it can be used to build both trace -#' and rank-based visualizations with **ggplot2**. -#' } #' \item{`mcmc_trace()`}{ #' Standard trace plots of MCMC draws. For models fit using [NUTS], #' the `np` argument can be used to also show divergences on the trace plot. @@ -79,6 +72,13 @@ #' ECDFs and the theoretical expectation for samples originating from the #' same distribution is drawn. See Säilynoja et al. (2021) for details. #' } +#' \item{`mcmc_trace_data()`}{ +#' Data-preparation back end for `mcmc_trace()`, `mcmc_trace_highlight()`, +#' `mcmc_rank_hist()`, `mcmc_rank_overlay()`, and `mcmc_rank_ecdf()`. The +#' returned data frame contains columns for both the original draw values +#' and their within-parameter ranks, so it can be used to build both trace +#' and rank-based visualizations with **ggplot2**. +#' } #' } #' #' @template reference-improved-rhat diff --git a/R/ppc-discrete.R b/R/ppc-discrete.R index 7122a620..2c3f54a9 100644 --- a/R/ppc-discrete.R +++ b/R/ppc-discrete.R @@ -37,11 +37,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`ppc_bars_data()`}{ -#' Data-preparation back end for `ppc_bars()` and `ppc_bars_grouped()`. -#' Users can call `ppc_bars_data()` directly to obtain the prepared data -#' frame and create custom bar chart visualizations with **ggplot2**. -#' } #' \item{`ppc_bars()`}{ #' Bar plot of `y` with `yrep` medians and uncertainty intervals #' superimposed on the bars. @@ -50,6 +45,11 @@ #' Same as `ppc_bars()` but a separate plot (facet) is generated for each #' level of a grouping variable. #' } +#' \item{`ppc_bars_data()`}{ +#' Data-preparation back end for `ppc_bars()` and `ppc_bars_grouped()`. +#' Users can call `ppc_bars_data()` directly to obtain the prepared data +#' frame and create custom visualizations with **ggplot2**. +#' } #' \item{`ppc_rootogram()`}{ #' Rootograms allow for diagnosing problems in count data models such as #' overdispersion or excess zeros. In `standing`, `hanging`, and `suspended` diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index 217ad315..d32a2e1a 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -22,15 +22,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`ppc_data()`}{ -#' This function prepares data for plotting with **ggplot2**. It is a -#' general-purpose data-preparation helper used by many `ppc_*()` plotting -#' functions, and users can call it directly to create custom PPC plots using -#' ggplot2. The function returns a data frame that can be used to build ggplot -#' objects. This is useful when you want to customize the appearance of PPC -#' plots beyond what the built-in plotting functions allow, or when you want to -#' construct new types of PPC visualizations based on the same underlying data. -#' } #' \item{`ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()`}{ #' A separate histogram, shaded frequency polygon, smoothed kernel density #' estimate, or box and whiskers plot is displayed for `y` and each @@ -40,7 +31,7 @@ #' \item{`ppc_dots()`}{ #' A dot plot plot is displayed for `y` and each dataset (row) in `yrep`. #' For these plots `yrep` should therefore contain only a small number of rows. -#' See the **Examples** section. This function requires [ggdist::stat_dots] to be installed. +#' See the **Examples** section. #' } #' \item{`ppc_freqpoly_grouped()`}{ #' A separate frequency polygon is plotted for each level of a grouping @@ -68,7 +59,16 @@ #' confidence intervals are provided to asses if `y` and `yrep` originate #' from the same distribution. The PIT values can also be provided directly #' as `pit`. -#' See Säilynoja et al. (2021) for more details.} +#' See Säilynoja et al. (2021) for more details. +#' } +#' \item{`ppc_data()`}{ +#' This function prepares data for plotting with **ggplot2** and doesn't +#' itself make any plots. Users can call it directly to obtain the underlying +#' data frame that (in most cases) is passed to **ggplot2**. This is useful +#' when you want to customize the appearance of PPC plots beyond what the +#' built-in plotting functions allow, or when you want to construct new types +#' of PPC visualizations based on the same underlying data. +#' } #' } #' #' @template reference-vis-paper diff --git a/R/ppc-errors.R b/R/ppc-errors.R index 94c9e5ee..f0012f24 100644 --- a/R/ppc-errors.R +++ b/R/ppc-errors.R @@ -33,12 +33,6 @@ #' #' @section Plot descriptions: #' \describe{ -#' \item{`ppc_error_data()`}{ -#' Data-preparation back end for the `ppc_error_*()` family of plotting -#' functions. Users can call `ppc_error_data()` directly to obtain the -#' data frame of predictive errors (`y - yrep`) and create custom error -#' visualizations with **ggplot2**. -#' } #' \item{`ppc_error_hist()`}{ #' A separate histogram is plotted for the predictive errors computed from #' `y` and each dataset (row) in `yrep`. For this plot `yrep` should have @@ -73,6 +67,12 @@ #' this plot `y` and `yrep` should contain proportions rather than counts, #' and `yrep` should have only a small number of rows. #' } +#' \item{`ppc_error_data()`}{ +#' Data-preparation back end for the `ppc_error_*()` family of plotting +#' functions. Users can call `ppc_error_data()` directly to obtain the +#' data frame of predictive errors (`y - yrep`) and create custom error +#' visualizations with **ggplot2**. +#' } #' } #' #' @template return-ggplot-or-data diff --git a/R/ppc-intervals.R b/R/ppc-intervals.R index a21daa46..b41be3b0 100644 --- a/R/ppc-intervals.R +++ b/R/ppc-intervals.R @@ -33,13 +33,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`ppc_intervals_data()`, `ppc_ribbon_data()`}{ -#' Data-preparation back end for `ppc_intervals()`, `ppc_ribbon()`, and -#' their grouped variants. `ppc_ribbon_data()` is an alias for -#' `ppc_intervals_data()`. Users can call either function directly to -#' obtain the prepared data frame and create custom interval or ribbon -#' visualizations with **ggplot2**. -#' } #' \item{`ppc_intervals(), ppc_ribbon()`}{ #' `100*prob`% central intervals for `yrep` at each `x` #' value. `ppc_intervals()` plots intervals as vertical bars with points @@ -57,6 +50,13 @@ #' Same as `ppc_intervals()` and `ppc_ribbon()`, respectively, but a #' separate plot (facet) is generated for each level of a grouping variable. #' } +#' \item{`ppc_intervals_data()`, `ppc_ribbon_data()`}{ +#' Data-preparation back end for `ppc_intervals()`, `ppc_ribbon()`, and +#' their grouped variants. `ppc_ribbon_data()` is an alias for +#' `ppc_intervals_data()`. Users can call either function directly to +#' obtain the prepared data frame and create custom interval or ribbon +#' visualizations with **ggplot2**. +#' } #' } #' #' @examples diff --git a/R/ppc-scatterplots.R b/R/ppc-scatterplots.R index 8c483221..c6fb13a8 100644 --- a/R/ppc-scatterplots.R +++ b/R/ppc-scatterplots.R @@ -29,14 +29,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`ppc_scatter_data()`, `ppc_scatter_avg_data()`}{ -#' Data-preparation back ends for the `ppc_scatter*()` family of plotting -#' functions. `ppc_scatter_data()` returns a data frame with one row per -#' observation per `yrep` draw, while `ppc_scatter_avg_data()` returns a -#' data frame with one row per observation summarising `yrep` draws with -#' the chosen `stat`. Users can call these functions directly to create -#' custom scatterplot visualizations with **ggplot2**. -#' } #' \item{`ppc_scatter()`}{ #' For each dataset (row) in `yrep` a scatterplot is generated showing `y` #' against that row of `yrep`. For this plot `yrep` should only contain a @@ -53,6 +45,14 @@ #' The same as `ppc_scatter_avg()`, but a separate plot is generated for #' each level of a grouping variable. #' } +#' \item{`ppc_scatter_data()`, `ppc_scatter_avg_data()`}{ +#' Data-preparation back ends for the `ppc_scatter*()` family of plotting +#' functions. `ppc_scatter_data()` returns a data frame with one row per +#' observation per `yrep` draw, while `ppc_scatter_avg_data()` returns a +#' data frame with one row per observation summarising `yrep` draws with +#' the chosen `stat`. Users can call these functions directly to create +#' custom visualizations with **ggplot2**. +#' } #' } #' #' @examples diff --git a/R/ppc-test-statistics.R b/R/ppc-test-statistics.R index 23b71a86..b4d2043a 100644 --- a/R/ppc-test-statistics.R +++ b/R/ppc-test-statistics.R @@ -38,13 +38,6 @@ #' #' @section Plot Descriptions: #' \describe{ -#' \item{`ppc_stat_data()`}{ -#' Data-preparation back end for `ppc_stat()`, `ppc_stat_freqpoly()`, and -#' their grouped variants. Users can call `ppc_stat_data()` directly to -#' obtain the data frame of test-statistic values computed from `y` and -#' each row of `yrep`, enabling custom test-statistic visualizations with -#' **ggplot2**. -#' } #' \item{`ppc_stat()`, `ppc_stat_freqpoly()`}{ #' A histogram/bar plot or frequency polygon of the distribution of a statistic #' computed by applying `stat` to each dataset (row) in `yrep`. The value of @@ -62,6 +55,13 @@ #' computed over the datasets (rows) in `yrep`. The value of the #' statistics in the observed data is overlaid as large point. #' } +#' \item{`ppc_stat_data()`}{ +#' Data-preparation back end for `ppc_stat()`, `ppc_stat_freqpoly()`, and +#' their grouped variants. Users can call `ppc_stat_data()` directly to +#' obtain the data frame of test-statistic values computed from `y` and +#' each row of `yrep`, enabling custom test-statistic visualizations with +#' **ggplot2**. +#' } #' } #' #' @examples diff --git a/R/ppd-distributions.R b/R/ppd-distributions.R index bb3eda05..70c4e5a6 100644 --- a/R/ppd-distributions.R +++ b/R/ppd-distributions.R @@ -14,17 +14,6 @@ #' @template details-binomial #' @template return-ggplot-or-data #' -#' @section Plot Descriptions: -#' \describe{ -#' \item{`ppd_data()`}{ -#' Data-preparation back end for `ppd_dens_overlay()` and related -#' `ppd_*()` distribution plotting functions. Users can call `ppd_data()` -#' directly to obtain the prepared data frame and create custom -#' posterior/prior predictive distribution visualizations with **ggplot2**. -#' The `ppd_data()` function is the PPD counterpart to [ppc_data()]. -#' } -#' } -#' #' @examples #' # difference between ppd_dens_overlay() and ppc_dens_overlay() #' color_scheme_set("brightblue") diff --git a/R/ppd-intervals.R b/R/ppd-intervals.R index 3db0dd34..63184072 100644 --- a/R/ppd-intervals.R +++ b/R/ppd-intervals.R @@ -14,19 +14,6 @@ #' #' @template return-ggplot-or-data #' -#' @section Plot Descriptions: -#' \describe{ -#' \item{`ppd_intervals_data()`, `ppd_ribbon_data()`}{ -#' Data-preparation back end for `ppd_intervals()`, `ppd_ribbon()`, and -#' their grouped variants. `ppd_ribbon_data()` is an alias for -#' `ppd_intervals_data()`. Users can call either function directly to -#' obtain the prepared data frame and create custom interval or ribbon -#' visualizations with **ggplot2**. -#' These functions are PPD counterparts to [ppc_intervals_data()] and -#' [ppc_ribbon_data()]. -#' } -#' } -#' #' @template reference-vis-paper #' #' @examples diff --git a/R/ppd-test-statistics.R b/R/ppd-test-statistics.R index 44441d3c..d7146405 100644 --- a/R/ppd-test-statistics.R +++ b/R/ppd-test-statistics.R @@ -17,18 +17,6 @@ #' @template details-binomial #' @template return-ggplot-or-data #' -#' @section Plot Descriptions: -#' \describe{ -#' \item{`ppd_stat_data()`}{ -#' Data-preparation back end for `ppd_stat()`, `ppd_stat_freqpoly()`, and -#' their grouped variants. Users can call `ppd_stat_data()` directly to -#' obtain the data frame of test-statistic values computed from each row of -#' `ypred`, enabling custom test-statistic visualizations with **ggplot2**. -#' The `ppd_stat_data()` function is the PPD counterpart to -#' [ppc_stat_data()]. -#' } -#' } -#' #' @template reference-vis-paper #' @examples #' yrep <- example_yrep_draws() diff --git a/man/MCMC-diagnostics.Rd b/man/MCMC-diagnostics.Rd index d1d54681..35e589dc 100644 --- a/man/MCMC-diagnostics.Rd +++ b/man/MCMC-diagnostics.Rd @@ -111,20 +111,13 @@ also \link{MCMC-nuts} for additional MCMC diagnostic plots. \section{Plot Descriptions}{ \describe{ -\item{\code{mcmc_rhat_data()}}{ -Data-preparation back end for \code{mcmc_rhat()} and \code{mcmc_rhat_hist()}. -Users can call \code{mcmc_rhat_data()} directly to obtain the data frame of -Rhat values with rating labels and create custom Rhat diagnostic +\item{\code{mcmc_rhat_data()}, \code{mcmc_neff_data()}}{ +Data-preparation back ends for the R-hat and effective sample size plots. +Users can call these functions directly to obtain the data frame of +diagnostic values with rating labels and create custom diagnostic visualizations with \strong{ggplot2}. } -\item{\code{mcmc_neff_data()}}{ -Data-preparation back end for \code{mcmc_neff()} and \code{mcmc_neff_hist()}. -Users can call \code{mcmc_neff_data()} directly to obtain the data frame of -effective-sample-size ratios with rating labels and create custom Neff -diagnostic visualizations with \strong{ggplot2}. -} - \item{\code{mcmc_rhat()}, \code{mcmc_rhat_hist()}}{ Rhat values as either points or a histogram. Values are colored using different shades (lighter is better). The chosen thresholds are somewhat diff --git a/man/MCMC-distributions.Rd b/man/MCMC-distributions.Rd index a29abafe..71be98d7 100644 --- a/man/MCMC-distributions.Rd +++ b/man/MCMC-distributions.Rd @@ -236,12 +236,6 @@ Various types of histograms and kernel density plots of MCMC draws. See the \section{Plot Descriptions}{ \describe{ -\item{\code{mcmc_dens_chains_data()}}{ -Data-preparation back end for \code{mcmc_dens_chains()}. Users can call -\code{mcmc_dens_chains_data()} directly to obtain the prepared long-format -data frame of MCMC draws (with chain information retained) and create -custom ridgeline density visualizations with \strong{ggplot2}. -} \item{\code{mcmc_hist()}}{ Histograms of posterior draws with all chains merged. } @@ -271,6 +265,12 @@ but overlaid on a single plot. In \code{mcmc_dens_overlay()} parameters appear in separate facets; in \code{mcmc_dens_chains()} they appear in the same panel and can overlap vertically. } +\item{\code{mcmc_dens_chains_data()}}{ +Data-preparation back end for \code{mcmc_dens_chains()}. Users can call this +function directly to obtain the prepared long-format data frame of MCMC +draws (with chain information retained) and create custom visualizations +with \strong{ggplot2}. +} } } diff --git a/man/MCMC-intervals.Rd b/man/MCMC-intervals.Rd index a6cbbb68..b98f835e 100644 --- a/man/MCMC-intervals.Rd +++ b/man/MCMC-intervals.Rd @@ -201,13 +201,6 @@ See the \strong{Plot Descriptions} section, below, for details. \section{Plot Descriptions}{ \describe{ -\item{\code{mcmc_intervals_data()}, \code{mcmc_areas_data()}, \code{mcmc_areas_ridges_data()}}{ -Data-preparation back ends for \code{mcmc_intervals()}, \code{mcmc_areas()}, and -\code{mcmc_areas_ridges()}, respectively. Users can call these functions -directly to obtain the prepared data frames of posterior interval -summaries and create custom interval or density-area visualizations -with \strong{ggplot2}. -} \item{\code{mcmc_intervals()}}{ Plots of uncertainty intervals computed from posterior draws with all chains merged. @@ -221,6 +214,13 @@ Density plot, as in \code{mcmc_areas()}, but drawn with overlapping ridgelines. This plot provides a compact display of (hierarchically) related distributions. } +\item{\code{mcmc_intervals_data()}, \code{mcmc_areas_data()}, \code{mcmc_areas_ridges_data()}}{ +Data-preparation back ends for \code{mcmc_intervals()}, \code{mcmc_areas()}, and +\code{mcmc_areas_ridges()}, respectively. Users can call these functions +directly to obtain the prepared data frames of posterior interval +summaries and create custom interval or density-area visualizations +with \strong{ggplot2}. +} } } diff --git a/man/MCMC-parcoord.Rd b/man/MCMC-parcoord.Rd index 3f7a1979..cbb7d294 100644 --- a/man/MCMC-parcoord.Rd +++ b/man/MCMC-parcoord.Rd @@ -112,12 +112,6 @@ for more background and a real example. \section{Plot Descriptions}{ \describe{ -\item{\code{mcmc_parcoord_data()}}{ -Data-preparation back end for \code{mcmc_parcoord()}. Users can call -\code{mcmc_parcoord_data()} directly to obtain the prepared long-format data -frame of MCMC draws (with optional NUTS diagnostic information) and -create custom parallel coordinates visualizations with \strong{ggplot2}. -} \item{\code{mcmc_parcoord()}}{ \href{https://en.wikipedia.org/wiki/Parallel_coordinates}{Parallel coordinates plot} of MCMC draws. There is one dimension per parameter along the horizontal @@ -137,6 +131,12 @@ all variables before plotting you could use function \code{(x - mean(x))/sd(x)} when specifying the \code{transformations} argument to \code{mcmc_parcoord}. See the \strong{Examples} section for how to do this. } +\item{\code{mcmc_parcoord_data()}}{ +Data-preparation back end for \code{mcmc_parcoord()}. Users can call +\code{mcmc_parcoord_data()} directly to obtain the prepared long-format data +frame of MCMC draws (with optional NUTS diagnostic information) and +create custom visualizations with \strong{ggplot2}. +} } } diff --git a/man/MCMC-traces.Rd b/man/MCMC-traces.Rd index 233ccdf5..9a280361 100644 --- a/man/MCMC-traces.Rd +++ b/man/MCMC-traces.Rd @@ -231,13 +231,6 @@ section, below, for details. \section{Plot Descriptions}{ \describe{ -\item{\code{mcmc_trace_data()}}{ -Data-preparation back end for \code{mcmc_trace()}, \code{mcmc_trace_highlight()}, -\code{mcmc_rank_hist()}, \code{mcmc_rank_overlay()}, and \code{mcmc_rank_ecdf()}. The -returned data frame contains columns for both the original draw values -and their within-parameter ranks, so it can be used to build both trace -and rank-based visualizations with \strong{ggplot2}. -} \item{\code{mcmc_trace()}}{ Standard trace plots of MCMC draws. For models fit using \link{NUTS}, the \code{np} argument can be used to also show divergences on the trace plot. @@ -265,6 +258,13 @@ is, bands that completely cover all of the rank ECDFs with the probability ECDFs and the theoretical expectation for samples originating from the same distribution is drawn. See Säilynoja et al. (2021) for details. } +\item{\code{mcmc_trace_data()}}{ +Data-preparation back end for \code{mcmc_trace()}, \code{mcmc_trace_highlight()}, +\code{mcmc_rank_hist()}, \code{mcmc_rank_overlay()}, and \code{mcmc_rank_ecdf()}. The +returned data frame contains columns for both the original draw values +and their within-parameter ranks, so it can be used to build both trace +and rank-based visualizations with \strong{ggplot2}. +} } } diff --git a/man/PPC-discrete.Rd b/man/PPC-discrete.Rd index 262821e5..9da2fa17 100644 --- a/man/PPC-discrete.Rd +++ b/man/PPC-discrete.Rd @@ -115,11 +115,6 @@ be non-negative. \section{Plot Descriptions}{ \describe{ -\item{\code{ppc_bars_data()}}{ -Data-preparation back end for \code{ppc_bars()} and \code{ppc_bars_grouped()}. -Users can call \code{ppc_bars_data()} directly to obtain the prepared data -frame and create custom bar chart visualizations with \strong{ggplot2}. -} \item{\code{ppc_bars()}}{ Bar plot of \code{y} with \code{yrep} medians and uncertainty intervals superimposed on the bars. @@ -128,6 +123,11 @@ superimposed on the bars. Same as \code{ppc_bars()} but a separate plot (facet) is generated for each level of a grouping variable. } +\item{\code{ppc_bars_data()}}{ +Data-preparation back end for \code{ppc_bars()} and \code{ppc_bars_grouped()}. +Users can call \code{ppc_bars_data()} directly to obtain the prepared data +frame and create custom visualizations with \strong{ggplot2}. +} \item{\code{ppc_rootogram()}}{ Rootograms allow for diagnosing problems in count data models such as overdispersion or excess zeros. In \code{standing}, \code{hanging}, and \code{suspended} diff --git a/man/PPC-distributions.Rd b/man/PPC-distributions.Rd index 23841507..b0099f2d 100644 --- a/man/PPC-distributions.Rd +++ b/man/PPC-distributions.Rd @@ -264,15 +264,6 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ -\item{\code{ppc_data()}}{ -This function prepares data for plotting with \strong{ggplot2}. It is a -general-purpose data-preparation helper used by many \verb{ppc_*()} plotting -functions, and users can call it directly to create custom PPC plots using -ggplot2. The function returns a data frame that can be used to build ggplot -objects. This is useful when you want to customize the appearance of PPC -plots beyond what the built-in plotting functions allow, or when you want to -construct new types of PPC visualizations based on the same underlying data. -} \item{\verb{ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()}}{ A separate histogram, shaded frequency polygon, smoothed kernel density estimate, or box and whiskers plot is displayed for \code{y} and each @@ -282,7 +273,7 @@ contain only a small number of rows. See the \strong{Examples} section. \item{\code{ppc_dots()}}{ A dot plot plot is displayed for \code{y} and each dataset (row) in \code{yrep}. For these plots \code{yrep} should therefore contain only a small number of rows. -See the \strong{Examples} section. This function requires \link[ggdist:stat_dots]{ggdist::stat_dots} to be installed. +See the \strong{Examples} section. } \item{\code{ppc_freqpoly_grouped()}}{ A separate frequency polygon is plotted for each level of a grouping @@ -310,7 +301,16 @@ the corresponding \code{yrep} values. \code{100 * prob}\% central simultaneous confidence intervals are provided to asses if \code{y} and \code{yrep} originate from the same distribution. The PIT values can also be provided directly as \code{pit}. -See Säilynoja et al. (2021) for more details.} +See Säilynoja et al. (2021) for more details. +} +\item{\code{ppc_data()}}{ +This function prepares data for plotting with \strong{ggplot2} and doesn't +itself make any plots. Users can call it directly to obtain the underlying +data frame that (in most cases) is passed to \strong{ggplot2}. This is useful +when you want to customize the appearance of PPC plots beyond what the +built-in plotting functions allow, or when you want to construct new types +of PPC visualizations based on the same underlying data. +} } } diff --git a/man/PPC-errors.Rd b/man/PPC-errors.Rd index b8dea34a..e23b29e9 100644 --- a/man/PPC-errors.Rd +++ b/man/PPC-errors.Rd @@ -155,12 +155,6 @@ proportions (not counts). See the \strong{Examples} section, below. \section{Plot descriptions}{ \describe{ -\item{\code{ppc_error_data()}}{ -Data-preparation back end for the \verb{ppc_error_*()} family of plotting -functions. Users can call \code{ppc_error_data()} directly to obtain the -data frame of predictive errors (\code{y - yrep}) and create custom error -visualizations with \strong{ggplot2}. -} \item{\code{ppc_error_hist()}}{ A separate histogram is plotted for the predictive errors computed from \code{y} and each dataset (row) in \code{yrep}. For this plot \code{yrep} should have @@ -195,6 +189,12 @@ to \code{arm::binnedplot()}) is generated for each dataset (row) in \code{yrep}. this plot \code{y} and \code{yrep} should contain proportions rather than counts, and \code{yrep} should have only a small number of rows. } +\item{\code{ppc_error_data()}}{ +Data-preparation back end for the \verb{ppc_error_*()} family of plotting +functions. Users can call \code{ppc_error_data()} directly to obtain the +data frame of predictive errors (\code{y - yrep}) and create custom error +visualizations with \strong{ggplot2}. +} } } diff --git a/man/PPC-intervals.Rd b/man/PPC-intervals.Rd index 530d4034..6ad715e0 100644 --- a/man/PPC-intervals.Rd +++ b/man/PPC-intervals.Rd @@ -141,13 +141,6 @@ See the \strong{Plot Descriptions} section, below. \section{Plot Descriptions}{ \describe{ -\item{\code{ppc_intervals_data()}, \code{ppc_ribbon_data()}}{ -Data-preparation back end for \code{ppc_intervals()}, \code{ppc_ribbon()}, and -their grouped variants. \code{ppc_ribbon_data()} is an alias for -\code{ppc_intervals_data()}. Users can call either function directly to -obtain the prepared data frame and create custom interval or ribbon -visualizations with \strong{ggplot2}. -} \item{\verb{ppc_intervals(), ppc_ribbon()}}{ \code{100*prob}\% central intervals for \code{yrep} at each \code{x} value. \code{ppc_intervals()} plots intervals as vertical bars with points @@ -165,6 +158,13 @@ to read than the other. Same as \code{ppc_intervals()} and \code{ppc_ribbon()}, respectively, but a separate plot (facet) is generated for each level of a grouping variable. } +\item{\code{ppc_intervals_data()}, \code{ppc_ribbon_data()}}{ +Data-preparation back end for \code{ppc_intervals()}, \code{ppc_ribbon()}, and +their grouped variants. \code{ppc_ribbon_data()} is an alias for +\code{ppc_intervals_data()}. Users can call either function directly to +obtain the prepared data frame and create custom interval or ribbon +visualizations with \strong{ggplot2}. +} } } diff --git a/man/PPC-scatterplots.Rd b/man/PPC-scatterplots.Rd index de33d641..2727b38c 100644 --- a/man/PPC-scatterplots.Rd +++ b/man/PPC-scatterplots.Rd @@ -100,14 +100,6 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ -\item{\code{ppc_scatter_data()}, \code{ppc_scatter_avg_data()}}{ -Data-preparation back ends for the \verb{ppc_scatter*()} family of plotting -functions. \code{ppc_scatter_data()} returns a data frame with one row per -observation per \code{yrep} draw, while \code{ppc_scatter_avg_data()} returns a -data frame with one row per observation summarising \code{yrep} draws with -the chosen \code{stat}. Users can call these functions directly to create -custom scatterplot visualizations with \strong{ggplot2}. -} \item{\code{ppc_scatter()}}{ For each dataset (row) in \code{yrep} a scatterplot is generated showing \code{y} against that row of \code{yrep}. For this plot \code{yrep} should only contain a @@ -124,6 +116,14 @@ is a summary statistic. Unlike for \code{ppc_scatter()}, for The same as \code{ppc_scatter_avg()}, but a separate plot is generated for each level of a grouping variable. } +\item{\code{ppc_scatter_data()}, \code{ppc_scatter_avg_data()}}{ +Data-preparation back ends for the \verb{ppc_scatter*()} family of plotting +functions. \code{ppc_scatter_data()} returns a data frame with one row per +observation per \code{yrep} draw, while \code{ppc_scatter_avg_data()} returns a +data frame with one row per observation summarising \code{yrep} draws with +the chosen \code{stat}. Users can call these functions directly to create +custom visualizations with \strong{ggplot2}. +} } } diff --git a/man/PPC-test-statistics.Rd b/man/PPC-test-statistics.Rd index 8a1296f7..4c39620b 100644 --- a/man/PPC-test-statistics.Rd +++ b/man/PPC-test-statistics.Rd @@ -142,13 +142,6 @@ the input contains the "success" \emph{proportions} (not discrete \section{Plot Descriptions}{ \describe{ -\item{\code{ppc_stat_data()}}{ -Data-preparation back end for \code{ppc_stat()}, \code{ppc_stat_freqpoly()}, and -their grouped variants. Users can call \code{ppc_stat_data()} directly to -obtain the data frame of test-statistic values computed from \code{y} and -each row of \code{yrep}, enabling custom test-statistic visualizations with -\strong{ggplot2}. -} \item{\code{ppc_stat()}, \code{ppc_stat_freqpoly()}}{ A histogram/bar plot or frequency polygon of the distribution of a statistic computed by applying \code{stat} to each dataset (row) in \code{yrep}. The value of @@ -166,6 +159,13 @@ A scatterplot showing the joint distribution of two statistics computed over the datasets (rows) in \code{yrep}. The value of the statistics in the observed data is overlaid as large point. } +\item{\code{ppc_stat_data()}}{ +Data-preparation back end for \code{ppc_stat()}, \code{ppc_stat_freqpoly()}, and +their grouped variants. Users can call \code{ppc_stat_data()} directly to +obtain the data frame of test-statistic values computed from \code{y} and +each row of \code{yrep}, enabling custom test-statistic visualizations with +\strong{ggplot2}. +} } } diff --git a/man/PPD-distributions.Rd b/man/PPD-distributions.Rd index 38a44d86..a53c62e4 100644 --- a/man/PPD-distributions.Rd +++ b/man/PPD-distributions.Rd @@ -138,19 +138,6 @@ For Binomial data, the plots may be more useful if the input contains the "success" \emph{proportions} (not discrete "success" or "failure" counts). } -\section{Plot Descriptions}{ - -\describe{ -\item{\code{ppd_data()}}{ -Data-preparation back end for \code{ppd_dens_overlay()} and related -\verb{ppd_*()} distribution plotting functions. Users can call \code{ppd_data()} -directly to obtain the prepared data frame and create custom -posterior/prior predictive distribution visualizations with \strong{ggplot2}. -The \code{ppd_data()} function is the PPD counterpart to \code{\link[=ppc_data]{ppc_data()}}. -} -} -} - \examples{ # difference between ppd_dens_overlay() and ppc_dens_overlay() color_scheme_set("brightblue") diff --git a/man/PPD-intervals.Rd b/man/PPD-intervals.Rd index d172c852..9548709f 100644 --- a/man/PPD-intervals.Rd +++ b/man/PPD-intervals.Rd @@ -125,21 +125,6 @@ corresponding \code{\link[=PPC-intervals]{ppc_}} function but without plotting a observed data \code{y}. The \strong{Plot Descriptions} section at \link{PPC-intervals} has details on the individual plots. } -\section{Plot Descriptions}{ - -\describe{ -\item{\code{ppd_intervals_data()}, \code{ppd_ribbon_data()}}{ -Data-preparation back end for \code{ppd_intervals()}, \code{ppd_ribbon()}, and -their grouped variants. \code{ppd_ribbon_data()} is an alias for -\code{ppd_intervals_data()}. Users can call either function directly to -obtain the prepared data frame and create custom interval or ribbon -visualizations with \strong{ggplot2}. -These functions are PPD counterparts to \code{\link[=ppc_intervals_data]{ppc_intervals_data()}} and -\code{\link[=ppc_ribbon_data]{ppc_ribbon_data()}}. -} -} -} - \examples{ color_scheme_set("brightblue") ypred <- example_yrep_draws() diff --git a/man/PPD-test-statistics.Rd b/man/PPD-test-statistics.Rd index 6583a777..7c8b41f3 100644 --- a/man/PPD-test-statistics.Rd +++ b/man/PPD-test-statistics.Rd @@ -126,20 +126,6 @@ For Binomial data, the plots may be more useful if the input contains the "success" \emph{proportions} (not discrete "success" or "failure" counts). } -\section{Plot Descriptions}{ - -\describe{ -\item{\code{ppd_stat_data()}}{ -Data-preparation back end for \code{ppd_stat()}, \code{ppd_stat_freqpoly()}, and -their grouped variants. Users can call \code{ppd_stat_data()} directly to -obtain the data frame of test-statistic values computed from each row of -\code{ypred}, enabling custom test-statistic visualizations with \strong{ggplot2}. -The \code{ppd_stat_data()} function is the PPD counterpart to -\code{\link[=ppc_stat_data]{ppc_stat_data()}}. -} -} -} - \examples{ yrep <- example_yrep_draws() ppd_stat(yrep)