Skip to contents

Iteratively Forecast Cases Using an Iterative Rt Forecast

Usage

iterative_case_forecast(
  it_fit_samples = NULL,
  cases = NULL,
  serial_interval,
  rdist = NULL
)

Arguments

it_fit_samples

Dataframe of iterative forecasts as produced by iterative_rt_forecast.

cases

A dataframe containing date and cases variables

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

A dataframe of iterative case forecasts

Examples

if (FALSE) {
## Iterative Rt forecast
it_forecast <-
  iterative_rt_forecast(EpiSoon::example_obs_rts,
    model = function(...) {
      EpiSoon::bsts_model(
        model =
          function(ss, y) {
            bsts::AddSemilocalLinearTrend(ss, y = y)
          }, ...
      )
    },
    horizon = 7, samples = 10
  )


## Iterative case forecast
iterative_case_forecast(
  it_fit_samples = it_forecast,
  cases = EpiSoon::example_obs_cases,
  serial_interval = EpiSoon::example_serial_interval
)
}