Skip to contents

Constructs a list of arguments for arx_forecaster().

Usage

arx_args_list(
  lags = c(0L, 7L, 14L),
  ahead = 7L,
  n_training = Inf,
  forecast_date = NULL,
  target_date = NULL,
  quantile_levels = c(0.05, 0.95),
  symmetrize = TRUE,
  nonneg = TRUE,
  quantile_by_key = character(0L),
  nafill_buffer = Inf,
  check_enough_data_n = NULL,
  check_enough_data_epi_keys = NULL,
  ...
)

Arguments

lags

Vector or List. Positive integers enumerating lags to use in autoregressive-type models (in days). By default, an unnamed list of lags will be set to correspond to the order of the predictors.

ahead

Integer. Number of time steps ahead (in days) of the forecast date for which forecasts should be produced.

n_training

Integer. An upper limit for the number of rows per key that are used for training (in the time unit of the epi_df).

forecast_date

Date. The date on which the forecast is created. The default NULL will attempt to determine this automatically.

target_date

Date. The date for which the forecast is intended. The default NULL will attempt to determine this automatically.

quantile_levels

Vector or NULL. A vector of probabilities to produce prediction intervals. These are created by computing the quantiles of training residuals. A NULL value will result in point forecasts only.

symmetrize

Logical. The default TRUE calculates symmetric prediction intervals. This argument only applies when residual quantiles are used. It is not applicable with trainer = quantile_reg(), for example.

nonneg

Logical. The default TRUE enforces nonnegative predictions by hard-thresholding at 0.

quantile_by_key

Character vector. Groups residuals by listed keys before calculating residual quantiles. See the by_key argument to layer_residual_quantiles() for more information. The default, character(0) performs no grouping. This argument only applies when residual quantiles are used. It is not applicable with trainer = quantile_reg(), for example.

nafill_buffer

At predict time, recent values of the training data are used to create a forecast. However, these can be NA due to, e.g., data latency issues. By default, any missing values will get filled with less recent data. Setting this value to NULL will result in 1 extra recent row (beyond those required for lag creation) to be used. Note that we require at least min(lags) rows of recent data per geo_value to create a prediction. For this reason, setting nafill_buffer < min(lags) will be treated as additional allowed recent data rather than the total amount of recent data to examine.

check_enough_data_n

Integer. A lower limit for the number of rows per epi_key that are required for training. If NULL, this check is ignored.

check_enough_data_epi_keys

Character vector. A character vector of column names on which to group the data and check threshold within each group. Useful if training per group (for example, per geo_value).

...

Space to handle future expansions (unused).

Value

A list containing updated parameter choices with class arx_flist.

Examples

arx_args_list()
#> List of 13
#>  $ lags                      : int [1:3] 0 7 14
#>  $ ahead                     : int 7
#>  $ n_training                : num Inf
#>  $ quantile_levels           : num [1:2] 0.05 0.95
#>  $ forecast_date             : NULL
#>  $ target_date               : NULL
#>  $ symmetrize                : logi TRUE
#>  $ nonneg                    : logi TRUE
#>  $ max_lags                  : int 14
#>  $ quantile_by_key           : chr(0) 
#>  $ nafill_buffer             : num Inf
#>  $ check_enough_data_n       : NULL
#>  $ check_enough_data_epi_keys: NULL
#>  - attr(*, "class")= chr [1:2] "arx_fcast" "alist"
arx_args_list(symmetrize = FALSE)
#> List of 13
#>  $ lags                      : int [1:3] 0 7 14
#>  $ ahead                     : int 7
#>  $ n_training                : num Inf
#>  $ quantile_levels           : num [1:2] 0.05 0.95
#>  $ forecast_date             : NULL
#>  $ target_date               : NULL
#>  $ symmetrize                : logi FALSE
#>  $ nonneg                    : logi TRUE
#>  $ max_lags                  : int 14
#>  $ quantile_by_key           : chr(0) 
#>  $ nafill_buffer             : num Inf
#>  $ check_enough_data_n       : NULL
#>  $ check_enough_data_epi_keys: NULL
#>  - attr(*, "class")= chr [1:2] "arx_fcast" "alist"
arx_args_list(quantile_levels = c(.1, .3, .7, .9), n_training = 120)
#> List of 13
#>  $ lags                      : int [1:3] 0 7 14
#>  $ ahead                     : int 7
#>  $ n_training                : num 120
#>  $ quantile_levels           : num [1:4] 0.1 0.3 0.7 0.9
#>  $ forecast_date             : NULL
#>  $ target_date               : NULL
#>  $ symmetrize                : logi TRUE
#>  $ nonneg                    : logi TRUE
#>  $ max_lags                  : int 14
#>  $ quantile_by_key           : chr(0) 
#>  $ nafill_buffer             : num Inf
#>  $ check_enough_data_n       : NULL
#>  $ check_enough_data_epi_keys: NULL
#>  - attr(*, "class")= chr [1:2] "arx_fcast" "alist"