Skip to contents

Forecasts Cases for a Rt Forecasts

Usage

forecast_cases(
  cases = NULL,
  fit_samples = NULL,
  serial_interval = NULL,
  forecast_date = NULL,
  horizon = NULL,
  rdist = NULL
)

Arguments

cases

A dataframe containing date and cases variables

fit_samples

A dataframe as produced by EpiSoon::forecast.

serial_interval

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

forecast_date

A character string date (format "yyyy-mm-dd") indicating the forecast date. Defaults to NULL in which case it will be assumed that the forecast date is the day before the first date present in the fit_samples dataframe

horizon

Numeric, the time horizon over which to predict.

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 over a future forecast horizon

Examples

if (FALSE) {
## Rt forecast
forecast <- forecast_rt(EpiSoon::example_obs_rts[1:10, ],
  model = function(...) {
    EpiSoon::bsts_model(model = function(ss, y) {
      bsts::AddAutoAr(ss, y = y, lags = 10)
    }, ...)
  },
  horizon = 7, samples = 10
)


forecast_cases(EpiSoon::example_obs_cases,
  fit_samples = forecast,
  serial_interval = EpiSoon::example_serial_interval
)
}