Skip to content

Commit 963b026

Browse files
committed
clean up doc and tests
1 parent 1df4ea3 commit 963b026

File tree

4 files changed

+33
-36
lines changed

4 files changed

+33
-36
lines changed

R/ppc-distributions.R

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@
4141
#' }
4242
#' \item{`ppc_ecdf_overlay()`, `ppc_dens_overlay()`,
4343
#' `ppc_ecdf_overlay_grouped()`, `ppc_dens_overlay_grouped()`}{
44-
#' Kernel density or empirical CDF estimates of each dataset (row) in
45-
#' `yrep` are overlaid, with the distribution of `y` itself on top
46-
#' (and in a darker shade). `ppc_ecdf_overlay()` uses step functions,
47-
#' consistent with the mathematical definition of the ECDF.
48-
#' For an example of `ppc_dens_overlay()` also see Gabry et al. (2019).
44+
#' Kernel density or empirical CDF estimates of each dataset (row) in `yrep`
45+
#' are overlaid, with the distribution of `y` itself on top (and in a darker
46+
#' shade). For an example of `ppc_dens_overlay()` also see Gabry et al.
47+
#' (2019).
4948
#' }
5049
#' \item{`ppc_violin_grouped()`}{
5150
#' The density estimate of `yrep` within each level of a grouping
@@ -85,7 +84,7 @@
8584
#'
8685
#' ppc_dens_overlay(y, yrep[1:25, ])
8786
#' \donttest{
88-
#' # ppc_ecdf_overlay (always uses step functions)
87+
#' # ppc_ecdf_overlay
8988
#' ppc_ecdf_overlay(y, yrep[sample(nrow(yrep), 25), ])
9089
#'
9190
#' # PIT-ECDF and PIT-ECDF difference plot of the PIT values of y compared to
@@ -258,10 +257,9 @@ ppc_dens_overlay_grouped <- function(y,
258257

259258
#' @export
260259
#' @rdname PPC-distributions
261-
#' @param discrete
262-
#' `r lifecycle::badge("deprecated")` The `discrete` argument is
263-
#' deprecated. The ECDF is a step function by definition, so `geom_step()`
264-
#' is now always used.
260+
#' @param discrete `r lifecycle::badge("deprecated")` The `discrete` argument is
261+
#' deprecated. The ECDF is a step function by definition, so `geom_step()` is
262+
#' now always used.
265263
#' @param pad A logical scalar passed to [ggplot2::stat_ecdf()].
266264
#'
267265
ppc_ecdf_overlay <- function(y,

man/PPC-distributions.Rd

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

man/PPD-distributions.Rd

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

tests/testthat/test-ppc-distributions.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ test_that("ppc_ecdf_overlay returns a ggplot object", {
5050
expect_gg(ppd_ecdf_overlay(yrep2))
5151
})
5252

53+
test_that("ppc_ecdf_overlay discrete argument is deprecated", {
54+
lifecycle::expect_deprecated(
55+
ppc_ecdf_overlay(vdiff_y2, vdiff_yrep2, discrete = TRUE)
56+
)
57+
lifecycle::expect_deprecated(
58+
ppc_ecdf_overlay_grouped(vdiff_y2, vdiff_yrep2, vdiff_group2, discrete = TRUE)
59+
)
60+
lifecycle::expect_deprecated(
61+
ppd_ecdf_overlay(vdiff_yrep2, discrete = TRUE)
62+
)
63+
64+
# no warning when discrete is not supplied
65+
expect_no_warning(ppc_ecdf_overlay(vdiff_y2, vdiff_yrep2))
66+
expect_no_warning(ppd_ecdf_overlay(vdiff_yrep2))
67+
})
68+
5369
test_that("ppc_dens,pp_hist,ppc_freqpoly,ppc_boxplot return ggplot objects", {
5470
expect_gg(ppc_hist(y, yrep[1,, drop = FALSE], binwidth = 0.1))
5571
expect_gg(ppc_hist(y, yrep[1:8, ], binwidth = 0.1))
@@ -392,22 +408,6 @@ test_that("ppc_ecdf_overlay_grouped renders correctly", {
392408
)
393409
})
394410

395-
test_that("ppc_ecdf_overlay discrete argument is deprecated", {
396-
lifecycle::expect_deprecated(
397-
ppc_ecdf_overlay(vdiff_y2, vdiff_yrep2, discrete = TRUE)
398-
)
399-
lifecycle::expect_deprecated(
400-
ppc_ecdf_overlay_grouped(vdiff_y2, vdiff_yrep2, vdiff_group2, discrete = TRUE)
401-
)
402-
lifecycle::expect_deprecated(
403-
ppd_ecdf_overlay(vdiff_yrep2, discrete = TRUE)
404-
)
405-
406-
# no warning when discrete is not supplied
407-
expect_no_warning(ppc_ecdf_overlay(vdiff_y2, vdiff_yrep2))
408-
expect_no_warning(ppd_ecdf_overlay(vdiff_yrep2))
409-
})
410-
411411
test_that("ppc_dens renders correctly", {
412412
testthat::skip_on_cran()
413413
testthat::skip_if_not_installed("vdiffr")

0 commit comments

Comments
 (0)