Description Usage Arguments Value Examples
View source: R/nowcast_pipeline.R
Impute Cases Date of Infection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
reported_cases |
A dataframe of reported cases |
linelist |
A linelist of report dates and onset dates |
target_date |
Character string, in the form "2020-01-01". Date to cast. |
earliest_allowed_onset |
A character string in the form of a date ("2020-01-01") indiciating the earliest allowed onset. |
merge_actual_onsets |
Logical, defaults to |
approx_delay |
Logical, defaults to |
max_delay |
Numeric, maximum delay to allow. Defaults to 120 days |
verbose |
Logical, defaults to |
delay_defs |
A data.table that defines the delay distributions (model, parameters and maximum delay for each model).
See |
incubation_defs |
A data.table that defines the incubation distributions (model, parameters and maximum delay for each model).
See |
nowcast_lag |
Numeric, defaults to 4. The number of days by which to lag nowcasts. Helps reduce bias due to case upscaling. |
max_upscale |
Numeric, maximum upscaling of cases allowed at each time point. Defaults to 100 times the observed cases. |
onset_modifier |
data.frame containing a |
A dataframe of nowcast cases from each step of the nowcasting process (defined by type
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Construct example distributions
## reporting delay dist
delay_dist <- suppressWarnings(
EpiNow::get_dist_def(rexp(25, 1 / 10),
samples = 1, bootstraps = 1))
## incubation delay dist
incubation_dist <- delay_dist
## Uses example case vector from EpiSoon
cases <- data.table::setDT(EpiSoon::example_obs_cases)
cases <- cases[, `:=`(confirm = as.integer(cases), import_status = "local")]
## Basic nowcast
nowcast <- nowcast_pipeline(reported_cases = cases,
target_date = max(cases$date),
delay_defs = delay_dist,
incubation_defs = incubation_dist)
nowcast
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.