Skip to content

Commit

Permalink
857: improve language around the use of dist_spec (#940)
Browse files Browse the repository at this point in the history
* improve language around the use of dist_spec

* add news item

* add reviewer / fix typo

Co-authored-by: James Azam <[email protected]>

---------

Co-authored-by: James Azam <[email protected]>
  • Loading branch information
sbfnk and jamesmbaazam authored Jan 30, 2025
1 parent 6cb7e86 commit 4b9c821
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- Brought the docs on `alpha_sd` up to date with the code change from prior PR #853. By @zsusswein in #862 and reviewed by @jamesmbaazam.
- The `...` argument in `estimate_secondary()` has been removed because it was not used. By @jamesmbaazam in #894 and reviewed by @.
- All examples now use the natural parameters of distributions rather than the mean and standard deviation when specifying uncertain distributions. This is to eliminate warnings and encourage best practice. By @jamesmbaazam in #893 and reviewed by @sbfnk.
- The ways that `dist_spec()` with certain/uncertain parameters can be constrained has been clarified. By @sbfnk in #940 and reviewed by @jamesmbaazam.

# EpiNow2 1.6.1

Expand Down
5 changes: 3 additions & 2 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ check_stan_delay <- function(dist) {
if (any(is.infinite(max(dist))) && !(attr(dist, "cdf_cutoff") > 0)) {
cli_abort(
c(
"i" = "All distribution passed to the model need to have a
"i" = "All distributions passed to the model need to have a
{col_blue(\"finite maximum\")}, which can be achieved either by
setting {.var max} or non-zero {.var cdf_cutoff}."
setting {.var max} or, if using a distribution with fixed parameters,
non-zero {.var cdf_cutoff}."
)
)
}
Expand Down
4 changes: 2 additions & 2 deletions R/dist_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@ plot.dist_spec <- function(x, samples = 50L, res = 1, cumulative = TRUE, ...) {
c(
"!" = "All distributions in {.var x} must have a finite
maximum value.",
"i" = "You can set a finite maximum either as an
argument to {.fn plot} or when defining the distribution."
"i" = "You can set a finite maximum or CDF cutoff
when defining the distribution."
)
)
}
Expand Down
3 changes: 2 additions & 1 deletion R/opts.R
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,8 @@ filter_opts <- function(opts, region) {
#' @param dist A <dist_spec>
#' @param default_cdf_cutoff Numeric; default CDF cutoff to be used if an
#' unconstrained distribution is passed as `dist`. If `dist` is already
#' constrained by having a maximum or CDF cutoff this is ignored.
#' constrained by having a maximum or CDF cutoff this is ignored. Note that
#' this can only be done for <dist_spec> objects with fixed parameters.
#' @param cdf_cutoff_set Logical; whether the default CDF cutoff has been set by
#' the user; if yes and `dist` is constrained a warning is issued
#' @importFrom cli cli_inform cli_warn
Expand Down
3 changes: 2 additions & 1 deletion man/apply_default_cdf_cutoff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/delay_opts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/generation_time_opts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/trunc_opts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b9c821

Please sign in to comment.