Fit models to the full series and forecast the next h reporting intervals.
Usage
get_fcast(
x,
models = default_models(),
h = 4,
top_n = 3,
ensemble = c("linear_pool", "quantile_average"),
quantiles = c(0.025, 0.25, 0.5, 0.75, 0.975)
)Arguments
- x
An
insightcast_*object.- models
Named list of ordinary
fableor joint insight.cast model specifications, such asHHH4. Defaults todefault_models. Whenxis aninsightcast_cvobject, leave unset to forecast its models and use the top-ranked models for the ensemble, or provide a custom set of models to forecast and combine.- h
Forecast horizon in reporting intervals. Defaults to
4, or the cross-validation horizon whenxis aninsightcast_cvobject.- top_n
Integer giving the number of top-ranked models to combine into the ensemble for each series. Used only when
xis aninsightcast_cvobject andmodelsis not provided. Defaults to3.- ensemble
Method used to combine the models into the
ENSEMBLEforecast."linear_pool"(default) mixes the models' predictive distributions with equal weights."quantile_average"takes, at each quantile level, the median of the models' quantiles usingsimple_ensemble- quantiles
Numeric vector of quantiles to extract. Defaults to
c(0.025, 0.25, 0.5, 0.75, 0.975)and these default will be included regardless of any additional custom quantiles passed here.
Value
An insightcast_fcast object containing:
- hub
Hub-format forecasts containing
model_out_tblandoracle_output.- score
Cross-validation model performance scores, or
NULL.- meta
Forecast settings including models, model selection, ensemble method, horizon, series keys, target, reporting interval, nowcast information, and evaluation date.
Details
When provided with an insightcast_cv object, the function forecasts every
successfully evaluated model and uses the cross-validation results to select
the best-performing models for each series for the equal-weight ensemble. For
insightcast_data or insightcast_ncast objects, all models in
models are fitted, forecast, and combined.
If the input contains nowcast uncertainty from get_ncast, this
uncertainty is incorporated into the forecast intervals.
Examples
if (FALSE) { # \dontrun{
ncast <- get_data("covid", "ny", revisions = TRUE) |> get_ncast()
cv <- ncast |> get_cv(eval_start_date = "2025-01-01", h = 4)
get_fcast(cv, top_n = 3) # use cross-validation rankings
get_fcast(cv, models = default_models()) # use custom models
get_fcast(ncast) # forecast directly from nowcast data
} # }
