diff --git a/NEWS.md b/NEWS.md index a40d01458..0ae098d5c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,7 @@ - a bug was fixed where `forecast_secondary()` did not work with fixed delays. By @sbfnk in #717 and reviewed by @seabbs. - a bug was fixed that caused delay option functions to report an error if only the tolerance was specified. By @sbfnk. - a bug was fixed that led to the truncation PMF being shortened from the wrong side when the truncation PMF was longer than the supplied data. By @seabbs in #736 and reviewed by @sbfnk and @jamesmbaazam. +- a bug was fixed that caused internal validation checks on delay distributions to fail if they contained non-parametric distributions. By @jamesmbaazam in #750 and reviewed by @seabbs. ## Documentation diff --git a/R/checks.R b/R/checks.R index 4ad82662a..a43d8eb29 100644 --- a/R/checks.R +++ b/R/checks.R @@ -81,12 +81,14 @@ check_stan_delay <- function(dist) { # Check that `dist` has parameters that are either numeric or normal # distributions with numeric parameters and infinite maximum numeric_or_normal <- unlist(lapply(seq_len(ndist(dist)), function(id) { - params <- get_parameters(dist, id) - vapply(params, function(x) { - is.numeric(x) || - (is(x, "dist_spec") && get_distribution(x) == "normal" && - is.infinite(max(x))) - }, logical(1)) + if (get_distribution(dist, id) != "nonparametric") { + params <- get_parameters(dist, id) + vapply(params, function(x) { + is.numeric(x) || + (is(x, "dist_spec") && get_distribution(x) == "normal" && + is.infinite(max(x))) + }, logical(1)) + } })) if (!all(numeric_or_normal)) { stop(