Description Usage Arguments Value Examples
View source: R/epi_measures_pipeline.R
Estimate time-varying measures and forecast
1 2 3 4 5 6 7 8 9 10 11 12 13 |
nowcast |
A nowcast as produced by |
generation_times |
A matrix with columns representing samples and rows representing the probability of the generation timebeing on that day. |
min_est_date |
Date to begin estimation. |
gt_samples |
Numeric, the number of samples to take from the generaiton times supplied |
rt_samples |
Numeric, the number of samples to take from the estimated R distribution for each time point. |
rt_windows |
Numeric vector, windows over which to estimate time-varying R. The best performing window will be selected per serial interval sample by default (based on which window best forecasts current cases). |
rate_window |
Numeric, the window to use to estimate the rate of spread. |
rt_prior |
A list defining the reproduction number prior containing the mean ( |
forecast_model |
An uninitialised bsts model passed to |
horizon |
Numeric, defaults to 0. The horizon over which to forecast Rts and cases. |
verbose |
Logical, defaults to |
A list of data frames containing reproduction number estimates, case forecasts, rate of growth estimates both summarised and raw.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Construct example distributions
## reporting delay dist
delay_dist <- EpiNow::lognorm_dist_def(mean = 3,
mean_sd = 1,
sd = 3,
sd_sd = 1,
max_value = 30,
samples = 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)
## Estimate parameters
estimates <- epi_measures_pipeline(nowcast[type %in% "infection_upscaled"],
generation_times = EpiNow::covid_generation_times,
rt_prior = list(mean_prior = 2.6, std_prior = 2))
estimates
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.