Skip to content

Commit

Permalink
Merge branch 'main' into vectorise-spectral-density
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs authored Aug 28, 2024
2 parents 71eb3be + 5ce0043 commit 13f7f8a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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

Expand Down
14 changes: 8 additions & 6 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ cost of the granularity of estimates or real-time performance, include:
- Adjustment for the remaining susceptible population beyond the
forecast horizon.

By default, all these models are fit with [MCMC
sampling](https://mc-stan.org/docs/reference-manual/mcmc.html) using the
[`rstan`](https://mc-stan.org/users/interfaces/rstan) R package as the
backend. Users can, however, switch to use approximate algorithms like
[variational
inference](https://en.wikipedia.org/wiki/Variational_Bayesian_methods),
the
[pathfinder](https://mc-stan.org/docs/reference-manual/pathfinder.html)
algorithm, or [Laplace
approximation](https://mc-stan.org/docs/reference-manual/laplace.html)
especially for quick prototyping. The latter two methods are provided
through the [`cmdstanr`](https://mc-stan.org/cmdstanr/) R package, so
users will have to install that separately.

The documentation for `estimate_infections` provides examples of the
implementation of the different options available.

Expand Down Expand Up @@ -175,6 +189,12 @@ the two main functions in the package and how to set up them up. It also
discusses how to summarise and visualise the results after running the
models.

More broadly, users can also learn the details of estimating delay
distributions, nowcasting, and forecasting in a structured way through
the free and open short-course, [“Nowcasting and forecasting infectious
disease dynamics”](https://nfidd.github.io/nfidd/), developed by some
authors of this package.

</details>
<details>
<summary>
Expand Down

0 comments on commit 13f7f8a

Please sign in to comment.