CDC baseline forecaster argument constructor
Source:R/cdc_baseline_forecaster.R
cdc_baseline_args_list.Rd
Constructs a list of arguments for cdc_baseline_forecaster()
.
Usage
cdc_baseline_args_list(
data_frequency = "1 week",
aheads = 1:5,
n_training = Inf,
forecast_date = NULL,
quantile_levels = c(0.01, 0.025, 1:19/20, 0.975, 0.99),
nsims = 100000L,
symmetrize = TRUE,
nonneg = TRUE,
quantile_by_key = "geo_value",
nafill_buffer = Inf,
...
)
Arguments
- data_frequency
Integer or string. This describes the frequency of the input
epi_df
. For typical FluSight forecasts, this would be"1 week"
. Allowable arguments are integers (taken to mean numbers of days) or a string like"7 days"
or"2 weeks"
. Currently, all other periods (other than days or weeks) result in an error.- aheads
Integer vector. Unlike
arx_forecaster()
, this doesn't have any effect on the predicted values. Predictions are always the most recent observation. This determines the set of prediction horizons forlayer_cdc_flatline_quantiles()
. It interacts with the
data_frequencyargument. So, for example, if the data is daily and you want forecasts for 1:4 days ahead, then you would use
1:4. However, if you want one-week predictions, you would set this as
c(7, 14, 21, 28). But if
data_frequencyis
"1 week", then you would set it as
1:4`.- 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.- quantile_levels
Vector or
NULL
. A vector of probabilities to produce prediction intervals. These are created by computing the quantiles of training residuals. ANULL
value will result in point forecasts only.- nsims
Positive integer. The number of draws from the empirical CDF. These samples are spaced evenly on the (0, 1) scale, F_X(x) resulting in linear interpolation on the X scale. This is achieved with
stats::quantile()
Type 7 (the default for that function).- symmetrize
Logical. The default
TRUE
calculates symmetric prediction intervals. This argument only applies when residual quantiles are used. It is not applicable withtrainer = quantile_reg()
, for example.- nonneg
Logical. Force all predictive intervals be non-negative. Because non-negativity is forced before propagating forward, this has slightly different behaviour than would occur if using
layer_threshold()
.- quantile_by_key
Character vector. Groups residuals by listed keys before calculating residual quantiles. See the
by_key
argument tolayer_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 withtrainer = 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 toNULL
will result in 1 extra recent row (beyond those required for lag creation) to be used. Note that we require at leastmin(lags)
rows of recent data pergeo_value
to create a prediction. For this reason, settingnafill_buffer < min(lags)
will be treated as additional allowed recent data rather than the total amount of recent data to examine.- ...
Space to handle future expansions (unused).
Examples
cdc_baseline_args_list()
#> • data_frequency : 7
#> • aheads : 1, 2, 3, 4, and 5
#> • n_training : Inf
#> • forecast_date : "NULL"
#> • quantile_levels : 0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4,
#> 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, …, 0.975, and 0.99
#> • nsims : 100000
#> • symmetrize : TRUE
#> • nonneg : TRUE
#> • quantile_by_key : "geo_value"
#> • nafill_buffer : Inf
cdc_baseline_args_list(symmetrize = FALSE)
#> • data_frequency : 7
#> • aheads : 1, 2, 3, 4, and 5
#> • n_training : Inf
#> • forecast_date : "NULL"
#> • quantile_levels : 0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4,
#> 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, …, 0.975, and 0.99
#> • nsims : 100000
#> • symmetrize : FALSE
#> • nonneg : TRUE
#> • quantile_by_key : "geo_value"
#> • nafill_buffer : Inf
cdc_baseline_args_list(quantile_levels = c(.1, .3, .7, .9), n_training = 120)
#> • data_frequency : 7
#> • aheads : 1, 2, 3, 4, and 5
#> • n_training : 120
#> • forecast_date : "NULL"
#> • quantile_levels : 0.1, 0.3, 0.7, and 0.9
#> • nsims : 100000
#> • symmetrize : TRUE
#> • nonneg : TRUE
#> • quantile_by_key : "geo_value"
#> • nafill_buffer : Inf