Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.0 release PR #653

Merged
merged 25 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
with:
dependencies: NA
extra-packages: |
dplyr
rmarkdown
rcmdcheck
cmdstanr
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/synthetic-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
install-pandoc: false
extra-packages: |
here
dplyr
tidyr
scoringutils
loo
matrixStats
Expand Down
6 changes: 1 addition & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Package
Package: EpiNow2
Title: Estimate Real-Time Case Counts and Time-Varying
Epidemiological Parameters
Version: 1.4.9000
Version: 1.5.0.9000
Authors@R:
c(person(given = "Sam",
family = "Abbott",
Expand Down Expand Up @@ -125,16 +125,12 @@ Imports:
Suggests:
cmdstanr,
covr,
dplyr,
here,
kableExtra,
knitr,
magrittr,
precommit,
rmarkdown,
spelling,
testthat,
tidyr,
usethis,
withr
LinkingTo:
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export(get_generation_time)
export(get_incubation_period)
export(get_parameters)
export(get_pmf)
export(get_raw_result)
export(get_regional_results)
export(gp_opts)
export(growth_to_R)
Expand Down
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# EpiNow2 1.4.9000
# EpiNow2 (development version)

# EpiNow2 1.5.0

This release comes with a change of maintainer, from @seabbs to @sbfnk.
This is to reflect who will handle the upcoming CRAN submission, but is not expected to lead to a change in workflows.

## Major changes

* Delay discretisation is now based on a two-day censoring window (with uniform probability in between), based on recommendations in [Park et al, medRxiv, 2024](https://doi.org/10.1101/2024.01.12.24301247). By @sbfnk in #518 and reviewed by @jamesmbaazam.
* The interface to generating delay distributions has been completely overhauled. Instead of calling `dist_spec()` users now specify distributions using functions that represent the available distributions, i.e. `LogNormal()`, `Gamma()` and `Fixed()`. See `?EpiNow2::Distributions`. Uncertainty is specified using calls of the same nature, to `Normal()`. More information on the underlying design can be found in `inst/dev/design_dist.md` By @sbfnk in #504 and reviewed by @seabbs.
* Delay discretisation is now based on a two-day censoring window (with uniform probability in between), based on recommendations in [Park et al, medRxiv, 2024](https://doi.org/10.1101/2024.01.12.24301247). By @sbfnk in #518 and reviewed by @jamesmbaazam.

## Deprecations

Expand Down
2 changes: 1 addition & 1 deletion R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description `r lifecycle::badge("stable")`
#' `check_reports_valid()` checks that the supplied data is a `<data.frame>`,
#' and that it has the right column names and types. In particular, it checks
#' that the date column is in date format and does not contain NA's, and that
#' that the date column is in date format and does not contain NAs, and that
#' the other columns are numeric.
#'
#' @param data A data frame with either:
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#' An example dataset of observed cases with truncation applied.
#' This data is generated internally for use in the example of
#' `estimate_truncation()`. For details on how the data is generated, see
#' <https://github.com/epiforecasts/EpiNow2/blob/main/data-raw/estimate-truncation.R> #nolint
#' <https://github.com/epiforecasts/EpiNow2/blob/main/data-raw/truncated.R> #nolint
#' @format A list of `data.table`s containing cases reported on each date until
#' a point of truncation.
#' Each element of the list is a `data.table` with the following columns:
Expand Down
4 changes: 3 additions & 1 deletion R/estimate_truncation.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Estimates a truncation distribution from multiple snapshots of the same
#' data source over time. This distribution can then be used passed to the
#' `truncation` argument in [regional_epinow()], [epinow()], and
#' [estimate_infections()] to adjust for truncated data and propagage the
#' [estimate_infections()] to adjust for truncated data and propagate the
#' uncertainty associated with data truncation into the estimates.
#'
#' See [here](https://gist.github.com/seabbs/176b0c7f83eab1a7192a25b28bbd116a)
Expand Down Expand Up @@ -79,6 +79,7 @@
#' @importFrom checkmate assert_character assert_numeric assert_class
#' assert_logical
#' @examples
#' \donttest{
#' # set number of cores to use
#' old_opts <- options()
#' options(mc.cores = ifelse(interactive(), 4, 1))
Expand Down Expand Up @@ -109,6 +110,7 @@
#' )
#' plot(out)
#' options(old_opts)
#' }
estimate_truncation <- function(data, max_truncation, trunc_max = 10,
trunc_dist = "lognormal",
truncation = trunc_opts(
Expand Down
4 changes: 2 additions & 2 deletions R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ extract_static_parameter <- function(param, samples) {

#' Extract all samples from a stan fit
#'
#' If the `object` argument is a <stanfit> object, it simply returns the result
#' of [rstan::extract()]. If it is a `<CmdStanMCMC>` it returns samples
#' If the `object` argument is a `<stanfit>` object, it simply returns the
#' result of [rstan::extract()]. If it is a `<CmdStanMCMC>` it returns samples
#' in the same format as [rstan::extract()] does for `<stanfit>` objects.
#' @param stan_fit A `<stanfit>` or `<CmdStanMCMC>` object as returned by
#' [fit_model()].
Expand Down
1 change: 1 addition & 0 deletions R/stan.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ epinow2_cmdstan_model <- function(model = "estimate_infections",
model <- monitor(cmdstanr::cmdstan_model(
model_file,
include_paths = dir,
dir = tempdir(),
...
))
return(model)
Expand Down
18 changes: 9 additions & 9 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Uncertainty is propagated from all inputs into the final parameter estimates, he

`{EpiNow2}` provides three models:

* [`estimate_infections()`](reference/estimate_infections.html): Reconstruct cases by date of infection from reported cases.
* `estimate_infections()`: Reconstruct cases by date of infection from reported cases.

* [`estimate_secondary()`](reference/estimate_secondary.html): Estimate the relationship between primary and secondary observations, for example, deaths (secondary) based on hospital admissions (primary), or bed occupancy (secondary) based on hospital admissions (primary).
* `estimate_secondary()`: Estimate the relationship between primary and secondary observations, for example, deaths (secondary) based on hospital admissions (primary), or bed occupancy (secondary) based on hospital admissions (primary).

* [`estimate_truncation()`](reference/estimate_truncation.html): Estimate a truncation distribution from multiple snapshots of the same data source over time. For more flexibility, check out the [`{epinowcast}`](https://package.epinowcast.org/) package.
* `estimate_truncation()`: Estimate a truncation distribution from multiple snapshots of the same data source over time. For more flexibility, check out the [`{epinowcast}`](https://package.epinowcast.org/) package.


The default model in `estimate_infections()` uses a non-stationary Gaussian process to estimate the time-varying reproduction number and infer infections. Other options, which generally reduce runtimes at the cost of the granularity of estimates or real-time performance, include:
Expand All @@ -52,17 +52,17 @@ The default model in `estimate_infections()` uses a non-stationary Gaussian proc
* A deconvolution/back-calculation method for inferring infections, followed with calculating the time-varying reproduction number.
* Adjustment for the remaining susceptible population beyond the forecast horizon.

The documentation for [`estimate_infections`](reference/estimate_infections.html) provides examples of the implementation of the different options available.
The documentation for `estimate_infections` provides examples of the implementation of the different options available.

`{EpiNow2}` is designed to be used via a single function call to two functions:

* [`epinow()`](reference/epinow.html): Estimate Rt and cases by date of infection and forecast these infections into the future.
* `epinow()`: Estimate Rt and cases by date of infection and forecast these infections into the future.

* [`regional_epinow()`](reference/regional_epinow.html): Efficiently run `epinow()` across multiple regions in an efficient manner.
* `regional_epinow()`: Efficiently run `epinow()` across multiple regions in an efficient manner.

These two functions call [`estimate_infections()`](reference/estimate_infections.html), which works to reconstruct cases by date of infection from reported cases.
These two functions call `estimate_infections()`, which works to reconstruct cases by date of infection from reported cases.

For more details on using each function see the [function documentation](reference/index.html).
For more details on using each function corresponding function documentation.

</details>

Expand Down Expand Up @@ -117,7 +117,7 @@ discusses how to summarise and visualise the results after running the models.

The package has two websites: one for
[the stable release version on CRAN](https://epiforecasts.io/EpiNow2/), and
another for [the version in development](https://epiforecasts.io/EpiNow2/dev).
another for [the version in development](https://epiforecasts.io/EpiNow2/dev/).
These two provide various resources for learning about the package, including
the function reference, details about each model (model definition), workflows
for each model (usage), and case studies or literature of applications of
Expand Down
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ Models provided

`{EpiNow2}` provides three models:

- [`estimate_infections()`](reference/estimate_infections.html):
Reconstruct cases by date of infection from reported cases.
- `estimate_infections()`: Reconstruct cases by date of infection from
reported cases.

- [`estimate_secondary()`](reference/estimate_secondary.html): Estimate
the relationship between primary and secondary observations, for
example, deaths (secondary) based on hospital admissions (primary), or
bed occupancy (secondary) based on hospital admissions (primary).
- `estimate_secondary()`: Estimate the relationship between primary and
secondary observations, for example, deaths (secondary) based on
hospital admissions (primary), or bed occupancy (secondary) based on
hospital admissions (primary).

- [`estimate_truncation()`](reference/estimate_truncation.html):
Estimate a truncation distribution from multiple snapshots of the same
data source over time. For more flexibility, check out the
- `estimate_truncation()`: Estimate a truncation distribution from
multiple snapshots of the same data source over time. For more
flexibility, check out the
[`{epinowcast}`](https://package.epinowcast.org/) package.

The default model in `estimate_infections()` uses a non-stationary
Expand All @@ -90,25 +90,23 @@ cost of the granularity of estimates or real-time performance, include:
- Adjustment for the remaining susceptible population beyond the
forecast horizon.

The documentation for
[`estimate_infections`](reference/estimate_infections.html) provides
examples of the implementation of the different options available.
The documentation for `estimate_infections` provides examples of the
implementation of the different options available.

`{EpiNow2}` is designed to be used via a single function call to two
functions:

- [`epinow()`](reference/epinow.html): Estimate Rt and cases by date of
infection and forecast these infections into the future.
- `epinow()`: Estimate Rt and cases by date of infection and forecast
these infections into the future.

- [`regional_epinow()`](reference/regional_epinow.html): Efficiently run
`epinow()` across multiple regions in an efficient manner.
- `regional_epinow()`: Efficiently run `epinow()` across multiple
regions in an efficient manner.

These two functions call
[`estimate_infections()`](reference/estimate_infections.html), which
works to reconstruct cases by date of infection from reported cases.
These two functions call `estimate_infections()`, which works to
reconstruct cases by date of infection from reported cases.

For more details on using each function see the [function
documentation](reference/index.html).
For more details on using each function corresponding function
documentation.

</details>

Expand Down Expand Up @@ -178,7 +176,7 @@ Package website

The package has two websites: one for [the stable release version on
CRAN](https://epiforecasts.io/EpiNow2/), and another for [the version in
development](https://epiforecasts.io/EpiNow2/dev). These two provide
development](https://epiforecasts.io/EpiNow2/dev/). These two provide
various resources for learning about the package, including the function
reference, details about each model (model definition), workflows for
each model (usage), and case studies or literature of applications of
Expand Down
9 changes: 8 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## R CMD check results

0 errors ✔ | 0 warnings ✔ | 0 notes ✔
This issue is submitted by a new maintainer as mentioned in a NOTE.

There is also a new NOTE because an additional repository has been specified in
order to suggest cmdstan. This is the same approach used in brms:
https://cran.r-project.org/web/packages/brms/index.html

# Resubmission comments

Size of the tar.gz has been reduced, locally confirmed as 4.7MB.
36 changes: 24 additions & 12 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ CMD
CMF
CMMID
COVID
CSTE
Centers
CoV
Cori
Covid
Dirichlet
Discretise
Dockerfile
ECDC
EpiEstim
EpiNow
Epinow
Gostic
Gruson
HHS
Habakuk
Hain
HalfNormal
Expand All @@ -40,56 +43,66 @@ Nowcasts
ORCID
PLoS
PMF
PRs
Poisson
Quilty
Riutort
Rmarkdown
Rstan
Rtools
Runtimes
SACEMA
SARS
Sanjat
Susswein
VB
Wellcome
ast
backcalc
backcalculation
bp
centered
cmdstanr
codecov
com
csv
dd
defato
detectCores
discretisation
discretise
discretised
dist
div
doi
dt
dynamicaltruncation
epidemia
epiforecasts
epinow
epinowcast
epiparameter
etc
filepath
frac
github
gp
intial
laplace
ldots
lengthscale
leq
lineranges
linters
logmean
lognorm
logsd
lintr
lt
matern
mathcal
mathrm
mc
medRxiv
metacran
negbin
nolint
nonmechanistic
nowcast
nowcasting
nowcasts
Expand All @@ -99,25 +112,24 @@ pak
parallisation
parameterisations
parameterised
params
pkgdown
pmf
pngs
poisson
progressr
rds
realland
reprex
roxygen
rstan
runtimes
rw
sd
se
sim
st
stan
stanfit
testland
testthat
th
tibbles
tidyverse
timelimit
underreporting
varphi
Expand Down
Loading
Loading