rt_pipeline.Rd
Combine fitting a delay distribution, constructing a set of complete sampled linelists, nowcast cases by onset date, and estimate the time-varying effective reproduction number and rate of spread.
rt_pipeline( cases = NULL, linelist = NULL, delay_defs = NULL, incubation_defs = NULL, delay_cutoff_date = NULL, rt_samples = 5, rt_windows = 1:7, rate_window = 7, earliest_allowed_onset = NULL, merge_actual_onsets = TRUE, approx_delay = FALSE, approx_threshold = 10000, max_delay = 120, generation_times = NULL, rt_prior = NULL, nowcast_lag = 8, forecast_model = NULL, horizon = 0, report_forecast = FALSE, onset_modifier = NULL, min_forecast_cases = 200, target_folder = NULL, target_date = NULL, max_upscale = 5, dt_threads = 1, verbose = FALSE )
cases | A dataframe of cases (in date order) with the following variables:
|
---|---|
linelist | A dataframe of of cases (by row) containing the following variables:
|
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 |
delay_cutoff_date | Character string, in the form "2020-01-01". Cutoff date to use to estimate the delay distribution. |
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. |
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 |
approx_threshold | Numeric, defaults to 10,000. Threshold of cases below which explicit sampling of onsets always occurs. |
max_delay | Numeric, maximum delay to allow. Defaults to 120 days |
generation_times | A matrix with columns representing samples and rows representing the probability of the serial intervel being on
that day. Defaults to |
rt_prior | A list defining the reproduction number prior containing the mean ( |
nowcast_lag | Numeric, defaults to 4. The number of days by which to lag nowcasts. Helps reduce bias due to case upscaling. |
forecast_model | An uninitialised bsts model passed to |
horizon | Numeric, defaults to 0. The horizon over which to forecast Rts and cases. |
report_forecast | Logical, defaults to |
onset_modifier | data.frame containing a |
min_forecast_cases | Numeric, defaults to 200. The minimum number of cases required in the last 7 days of data in order for a forecast to be run. This prevents spurious forecasts based on highly uncertain Rt estimates. |
target_folder | Character string indicating the folder into which to save results. Also used to extract previously generated results. |
target_date | Character string, in the form "2020-01-01". Date to cast. |
max_upscale | Numeric, maximum upscaling of cases allowed at each time point. Defaults to 100 times the observed cases. |
dt_threads | Numeric, the number of data.table threads to use. Set internally to avoid issue when running in parallel. Defaults to 1 thread. |
verbose | Logical, defaults to |