Skip to contents

This is an autoregressive forecasting model for epiprocess::epi_df data. It does "direct" forecasting, meaning that it estimates a model for a particular target horizon.

Usage

arx_forecaster(
  epi_data,
  outcome,
  predictors = outcome,
  trainer = linear_reg(),
  args_list = arx_args_list()
)

Arguments

epi_data

An epi_df object

outcome

A character (scalar) specifying the outcome (in the epi_df).

predictors

A character vector giving column(s) of predictor variables. This defaults to the outcome. However, if manually specified, only those variables specifically mentioned will be used. (The outcome will not be added.) By default, equals the outcome. If manually specified, does not add the outcome variable, so make sure to specify it.

trainer

A {parsnip} model describing the type of estimation. For now, we enforce mode = "regression".

args_list

A list of customization arguments to determine the type of forecasting model. See arx_args_list().

Value

A list with (1) predictions an epi_df of predicted values and (2) epi_workflow, a list that encapsulates the entire estimation workflow

Examples

jhu <- case_death_rate_subset %>%
  dplyr::filter(time_value >= as.Date("2021-12-01"))

out <- arx_forecaster(
  jhu, "death_rate",
  c("case_rate", "death_rate")
)

out <- arx_forecaster(jhu, "death_rate",
  c("case_rate", "death_rate"),
  trainer = quantile_reg(),
  args_list = arx_args_list(quantile_levels = 1:9 / 10)
)