Predict cases for Rts based on observed data
predict_current_cases.RdPredict cases for Rts based on observed data
Arguments
- cases
A dataframe containing
dateandcasesvariables- rts
A dataframe of containing two variables
rtanddatewithrtbeing numeric anddatebeing a date.- serial_interval
A numeric vector describing the probability distribution the serial interval. See
EpiNow::covid_serial_intervalfor 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
rpoisif not supplied
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 35.8
#> 2 2020-03-02 42.7
#> 3 2020-03-03 50.8
#> 4 2020-03-04 58.5
#> 5 2020-03-05 70.5
#> 6 2020-03-06 79.9
#> 7 2020-03-07 95.4
#> 8 2020-03-08 109.
#> 9 2020-03-09 127.
#> 10 2020-03-10 148.
#> # ℹ 12 more rows