Skip to contents

Iteratively forecast directly on cases

Usage

iterative_direct_case_forecast(
  cases,
  model = NULL,
  horizon = 7,
  samples = 1000,
  timeout = 30,
  bound_rt = TRUE,
  min_points = 3
)

Arguments

cases

A dataframe containing date and cases variables

model

A model object in the format of bsts_model or fable_model. See the corresponding help files for details.

horizon

Numeric, the time horizon over which to predict.

samples

Numeric, number of samples to take.

timeout

Numeric, timeout of model fitting in seconds. Defaults to 30 seconds.

bound_rt

Logical, defaults to TRUE. Should Rt values be bounded to be greater than or equal to 0.

min_points

Numeric, defaults to 3. The minimum number of time points at which to begin iteratively evaluating the forecast.

Value

A tibble of iterative forecasts

Examples

if (FALSE) {
iterative_direct_case_forecast(EpiSoon::example_obs_cases,
  model = function(...) {
    EpiSoon::bsts_model(
      model =
        function(ss, y) {
          bsts::AddSemilocalLinearTrend(ss, y = y)
        }, ...
    )
  },
  horizon = 7, samples = 10, min_points = 4
)
}