Skip to contents

Predict cases for Rts based on observed data

Usage

predict_current_cases(
  cases = NULL,
  rts = NULL,
  serial_interval = NULL,
  rdist = NULL
)

Arguments

cases

A dataframe containing date and cases variables

rts

A dataframe of containing two variables rt and date with rt being numeric and date being a date.

serial_interval

A numeric vector describing the probability distribution the serial interval. See EpiNow::covid_serial_interval for an example of the format.

rdist

A function to be used to sample the number of cases. Must take two arguments with the first specfying the number of samples and the second the mean. Defaults to rpois if not supplied

Value

Forecast cases for the current timestep

Examples


purrr::map_dfr(1:100, ~ predict_current_cases(
  cases = EpiSoon::example_obs_cases,
  rts = EpiSoon::example_obs_rts,
  serial_interval = EpiSoon::example_serial_interval
)) %>%
  dplyr::group_by(date) %>%
  dplyr::summarise(cases = mean(cases))
#> # A tibble: 22 × 2
#>    date       cases
#>    <date>     <dbl>
#>  1 2020-03-01  34.4
#>  2 2020-03-02  41.3
#>  3 2020-03-03  51.0
#>  4 2020-03-04  59.2
#>  5 2020-03-05  70.7
#>  6 2020-03-06  80.4
#>  7 2020-03-07  94.2
#>  8 2020-03-08 110. 
#>  9 2020-03-09 127. 
#> 10 2020-03-10 151. 
#> # … with 12 more rows