Skip to content

Commit 5e61b03

Browse files
committed
Minor edits
* move doc of _data() functions below doc of plotting functions
1 parent d2d8544 commit 5e61b03

28 files changed

+148
-240
lines changed

R/mcmc-diagnostics.R

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,13 @@
1818
#'
1919
#' @section Plot Descriptions:
2020
#' \describe{
21-
#' \item{`mcmc_rhat_data()`}{
22-
#' Data-preparation back end for `mcmc_rhat()` and `mcmc_rhat_hist()`.
23-
#' Users can call `mcmc_rhat_data()` directly to obtain the data frame of
24-
#' Rhat values with rating labels and create custom Rhat diagnostic
21+
#' \item{`mcmc_rhat_data()`, `mcmc_neff_data()`}{
22+
#' Data-preparation back ends for the R-hat and effective sample size plots.
23+
#' Users can call these functions directly to obtain the data frame of
24+
#' diagnostic values with rating labels and create custom diagnostic
2525
#' visualizations with **ggplot2**.
2626
#' }
2727
#'
28-
#' \item{`mcmc_neff_data()`}{
29-
#' Data-preparation back end for `mcmc_neff()` and `mcmc_neff_hist()`.
30-
#' Users can call `mcmc_neff_data()` directly to obtain the data frame of
31-
#' effective-sample-size ratios with rating labels and create custom Neff
32-
#' diagnostic visualizations with **ggplot2**.
33-
#' }
34-
#'
3528
#' \item{`mcmc_rhat()`, `mcmc_rhat_hist()`}{
3629
#' Rhat values as either points or a histogram. Values are colored using
3730
#' different shades (lighter is better). The chosen thresholds are somewhat

R/mcmc-distributions.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
#'
2020
#' @section Plot Descriptions:
2121
#' \describe{
22-
#' \item{`mcmc_dens_chains_data()`}{
23-
#' Data-preparation back end for `mcmc_dens_chains()`. Users can call
24-
#' `mcmc_dens_chains_data()` directly to obtain the prepared long-format
25-
#' data frame of MCMC draws (with chain information retained) and create
26-
#' custom ridgeline density visualizations with **ggplot2**.
27-
#' }
2822
#' \item{`mcmc_hist()`}{
2923
#' Histograms of posterior draws with all chains merged.
3024
#' }
@@ -54,6 +48,12 @@
5448
#' appear in separate facets; in `mcmc_dens_chains()` they appear in the
5549
#' same panel and can overlap vertically.
5650
#' }
51+
#' \item{`mcmc_dens_chains_data()`}{
52+
#' Data-preparation back end for `mcmc_dens_chains()`. Users can call this
53+
#' function directly to obtain the prepared long-format data frame of MCMC
54+
#' draws (with chain information retained) and create custom visualizations
55+
#' with **ggplot2**.
56+
#' }
5757
#' }
5858
#'
5959
#' @examples

R/mcmc-intervals.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@
3838
#'
3939
#' @section Plot Descriptions:
4040
#' \describe{
41-
#' \item{`mcmc_intervals_data()`, `mcmc_areas_data()`, `mcmc_areas_ridges_data()`}{
42-
#' Data-preparation back ends for `mcmc_intervals()`, `mcmc_areas()`, and
43-
#' `mcmc_areas_ridges()`, respectively. Users can call these functions
44-
#' directly to obtain the prepared data frames of posterior interval
45-
#' summaries and create custom interval or density-area visualizations
46-
#' with **ggplot2**.
47-
#' }
4841
#' \item{`mcmc_intervals()`}{
4942
#' Plots of uncertainty intervals computed from posterior draws with all
5043
#' chains merged.
@@ -58,6 +51,13 @@
5851
#' ridgelines. This plot provides a compact display of (hierarchically)
5952
#' related distributions.
6053
#' }
54+
#' \item{`mcmc_intervals_data()`, `mcmc_areas_data()`, `mcmc_areas_ridges_data()`}{
55+
#' Data-preparation back ends for `mcmc_intervals()`, `mcmc_areas()`, and
56+
#' `mcmc_areas_ridges()`, respectively. Users can call these functions
57+
#' directly to obtain the prepared data frames of posterior interval
58+
#' summaries and create custom interval or density-area visualizations
59+
#' with **ggplot2**.
60+
#' }
6161
#' }
6262
#'
6363
#' @examples

R/mcmc-parcoord.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@
2929
#'
3030
#' @section Plot Descriptions:
3131
#' \describe{
32-
#' \item{`mcmc_parcoord_data()`}{
33-
#' Data-preparation back end for `mcmc_parcoord()`. Users can call
34-
#' `mcmc_parcoord_data()` directly to obtain the prepared long-format data
35-
#' frame of MCMC draws (with optional NUTS diagnostic information) and
36-
#' create custom parallel coordinates visualizations with **ggplot2**.
37-
#' }
3832
#' \item{`mcmc_parcoord()`}{
3933
#' [Parallel coordinates plot](https://en.wikipedia.org/wiki/Parallel_coordinates)
4034
#' of MCMC draws. There is one dimension per parameter along the horizontal
@@ -54,6 +48,12 @@
5448
#' when specifying the `transformations` argument to
5549
#' `mcmc_parcoord`. See the **Examples** section for how to do this.
5650
#' }
51+
#' \item{`mcmc_parcoord_data()`}{
52+
#' Data-preparation back end for `mcmc_parcoord()`. Users can call
53+
#' `mcmc_parcoord_data()` directly to obtain the prepared long-format data
54+
#' frame of MCMC draws (with optional NUTS diagnostic information) and
55+
#' create custom visualizations with **ggplot2**.
56+
#' }
5757
#' }
5858
#'
5959
#' @template reference-vis-paper

R/mcmc-traces.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@
4545
#'
4646
#' @section Plot Descriptions:
4747
#' \describe{
48-
#' \item{`mcmc_trace_data()`}{
49-
#' Data-preparation back end for `mcmc_trace()`, `mcmc_trace_highlight()`,
50-
#' `mcmc_rank_hist()`, `mcmc_rank_overlay()`, and `mcmc_rank_ecdf()`. The
51-
#' returned data frame contains columns for both the original draw values
52-
#' and their within-parameter ranks, so it can be used to build both trace
53-
#' and rank-based visualizations with **ggplot2**.
54-
#' }
5548
#' \item{`mcmc_trace()`}{
5649
#' Standard trace plots of MCMC draws. For models fit using [NUTS],
5750
#' the `np` argument can be used to also show divergences on the trace plot.
@@ -79,6 +72,13 @@
7972
#' ECDFs and the theoretical expectation for samples originating from the
8073
#' same distribution is drawn. See Säilynoja et al. (2021) for details.
8174
#' }
75+
#' \item{`mcmc_trace_data()`}{
76+
#' Data-preparation back end for `mcmc_trace()`, `mcmc_trace_highlight()`,
77+
#' `mcmc_rank_hist()`, `mcmc_rank_overlay()`, and `mcmc_rank_ecdf()`. The
78+
#' returned data frame contains columns for both the original draw values
79+
#' and their within-parameter ranks, so it can be used to build both trace
80+
#' and rank-based visualizations with **ggplot2**.
81+
#' }
8282
#' }
8383
#'
8484
#' @template reference-improved-rhat

R/ppc-discrete.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
#'
3838
#' @section Plot Descriptions:
3939
#' \describe{
40-
#' \item{`ppc_bars_data()`}{
41-
#' Data-preparation back end for `ppc_bars()` and `ppc_bars_grouped()`.
42-
#' Users can call `ppc_bars_data()` directly to obtain the prepared data
43-
#' frame and create custom bar chart visualizations with **ggplot2**.
44-
#' }
4540
#' \item{`ppc_bars()`}{
4641
#' Bar plot of `y` with `yrep` medians and uncertainty intervals
4742
#' superimposed on the bars.
@@ -50,6 +45,11 @@
5045
#' Same as `ppc_bars()` but a separate plot (facet) is generated for each
5146
#' level of a grouping variable.
5247
#' }
48+
#' \item{`ppc_bars_data()`}{
49+
#' Data-preparation back end for `ppc_bars()` and `ppc_bars_grouped()`.
50+
#' Users can call `ppc_bars_data()` directly to obtain the prepared data
51+
#' frame and create custom visualizations with **ggplot2**.
52+
#' }
5353
#' \item{`ppc_rootogram()`}{
5454
#' Rootograms allow for diagnosing problems in count data models such as
5555
#' overdispersion or excess zeros. In `standing`, `hanging`, and `suspended`

R/ppc-distributions.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@
2222
#'
2323
#' @section Plot Descriptions:
2424
#' \describe{
25-
#' \item{`ppc_data()`}{
26-
#' This function prepares data for plotting with **ggplot2**. It is a
27-
#' general-purpose data-preparation helper used by many `ppc_*()` plotting
28-
#' functions, and users can call it directly to create custom PPC plots using
29-
#' ggplot2. The function returns a data frame that can be used to build ggplot
30-
#' objects. This is useful when you want to customize the appearance of PPC
31-
#' plots beyond what the built-in plotting functions allow, or when you want to
32-
#' construct new types of PPC visualizations based on the same underlying data.
33-
#' }
3425
#' \item{`ppc_hist(), ppc_freqpoly(), ppc_dens(), ppc_boxplot()`}{
3526
#' A separate histogram, shaded frequency polygon, smoothed kernel density
3627
#' estimate, or box and whiskers plot is displayed for `y` and each
@@ -40,7 +31,7 @@
4031
#' \item{`ppc_dots()`}{
4132
#' A dot plot plot is displayed for `y` and each dataset (row) in `yrep`.
4233
#' For these plots `yrep` should therefore contain only a small number of rows.
43-
#' See the **Examples** section. This function requires [ggdist::stat_dots] to be installed.
34+
#' See the **Examples** section.
4435
#' }
4536
#' \item{`ppc_freqpoly_grouped()`}{
4637
#' A separate frequency polygon is plotted for each level of a grouping
@@ -68,7 +59,16 @@
6859
#' confidence intervals are provided to asses if `y` and `yrep` originate
6960
#' from the same distribution. The PIT values can also be provided directly
7061
#' as `pit`.
71-
#' See Säilynoja et al. (2021) for more details.}
62+
#' See Säilynoja et al. (2021) for more details.
63+
#' }
64+
#' \item{`ppc_data()`}{
65+
#' This function prepares data for plotting with **ggplot2** and doesn't
66+
#' itself make any plots. Users can call it directly to obtain the underlying
67+
#' data frame that (in most cases) is passed to **ggplot2**. This is useful
68+
#' when you want to customize the appearance of PPC plots beyond what the
69+
#' built-in plotting functions allow, or when you want to construct new types
70+
#' of PPC visualizations based on the same underlying data.
71+
#' }
7272
#' }
7373
#'
7474
#' @template reference-vis-paper

R/ppc-errors.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
#'
3434
#' @section Plot descriptions:
3535
#' \describe{
36-
#' \item{`ppc_error_data()`}{
37-
#' Data-preparation back end for the `ppc_error_*()` family of plotting
38-
#' functions. Users can call `ppc_error_data()` directly to obtain the
39-
#' data frame of predictive errors (`y - yrep`) and create custom error
40-
#' visualizations with **ggplot2**.
41-
#' }
4236
#' \item{`ppc_error_hist()`}{
4337
#' A separate histogram is plotted for the predictive errors computed from
4438
#' `y` and each dataset (row) in `yrep`. For this plot `yrep` should have
@@ -73,6 +67,12 @@
7367
#' this plot `y` and `yrep` should contain proportions rather than counts,
7468
#' and `yrep` should have only a small number of rows.
7569
#' }
70+
#' \item{`ppc_error_data()`}{
71+
#' Data-preparation back end for the `ppc_error_*()` family of plotting
72+
#' functions. Users can call `ppc_error_data()` directly to obtain the
73+
#' data frame of predictive errors (`y - yrep`) and create custom error
74+
#' visualizations with **ggplot2**.
75+
#' }
7676
#' }
7777
#'
7878
#' @template return-ggplot-or-data

R/ppc-intervals.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@
3333
#'
3434
#' @section Plot Descriptions:
3535
#' \describe{
36-
#' \item{`ppc_intervals_data()`, `ppc_ribbon_data()`}{
37-
#' Data-preparation back end for `ppc_intervals()`, `ppc_ribbon()`, and
38-
#' their grouped variants. `ppc_ribbon_data()` is an alias for
39-
#' `ppc_intervals_data()`. Users can call either function directly to
40-
#' obtain the prepared data frame and create custom interval or ribbon
41-
#' visualizations with **ggplot2**.
42-
#' }
4336
#' \item{`ppc_intervals(), ppc_ribbon()`}{
4437
#' `100*prob`% central intervals for `yrep` at each `x`
4538
#' value. `ppc_intervals()` plots intervals as vertical bars with points
@@ -57,6 +50,13 @@
5750
#' Same as `ppc_intervals()` and `ppc_ribbon()`, respectively, but a
5851
#' separate plot (facet) is generated for each level of a grouping variable.
5952
#' }
53+
#' \item{`ppc_intervals_data()`, `ppc_ribbon_data()`}{
54+
#' Data-preparation back end for `ppc_intervals()`, `ppc_ribbon()`, and
55+
#' their grouped variants. `ppc_ribbon_data()` is an alias for
56+
#' `ppc_intervals_data()`. Users can call either function directly to
57+
#' obtain the prepared data frame and create custom interval or ribbon
58+
#' visualizations with **ggplot2**.
59+
#' }
6060
#' }
6161
#'
6262
#' @examples

R/ppc-scatterplots.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
#'
3030
#' @section Plot Descriptions:
3131
#' \describe{
32-
#' \item{`ppc_scatter_data()`, `ppc_scatter_avg_data()`}{
33-
#' Data-preparation back ends for the `ppc_scatter*()` family of plotting
34-
#' functions. `ppc_scatter_data()` returns a data frame with one row per
35-
#' observation per `yrep` draw, while `ppc_scatter_avg_data()` returns a
36-
#' data frame with one row per observation summarising `yrep` draws with
37-
#' the chosen `stat`. Users can call these functions directly to create
38-
#' custom scatterplot visualizations with **ggplot2**.
39-
#' }
4032
#' \item{`ppc_scatter()`}{
4133
#' For each dataset (row) in `yrep` a scatterplot is generated showing `y`
4234
#' against that row of `yrep`. For this plot `yrep` should only contain a
@@ -53,6 +45,14 @@
5345
#' The same as `ppc_scatter_avg()`, but a separate plot is generated for
5446
#' each level of a grouping variable.
5547
#' }
48+
#' \item{`ppc_scatter_data()`, `ppc_scatter_avg_data()`}{
49+
#' Data-preparation back ends for the `ppc_scatter*()` family of plotting
50+
#' functions. `ppc_scatter_data()` returns a data frame with one row per
51+
#' observation per `yrep` draw, while `ppc_scatter_avg_data()` returns a
52+
#' data frame with one row per observation summarising `yrep` draws with
53+
#' the chosen `stat`. Users can call these functions directly to create
54+
#' custom visualizations with **ggplot2**.
55+
#' }
5656
#' }
5757
#'
5858
#' @examples

0 commit comments

Comments
 (0)