Skip to contents

Iteratively Forecast

Usage

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

Arguments

rts

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

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_rt_forecast(EpiSoon::example_obs_rts,
  model = function(...) {
    EpiSoon::bsts_model(
      model =
        function(ss, y) {
          bsts::AddSemilocalLinearTrend(ss, y = y)
        }, ...
    )
  },
  horizon = 7, samples = 10, min_points = 4
) -> tmp
}