Skip to contents

Creates baseline forecasts for comparison with OSEM

Usage

forecast_comparison(
  model,
  n.ahead,
  forecast_type = c("AR", "RW"),
  lags = NULL,
  mc = TRUE
)

Arguments

model

A model object of class 'osem'.

n.ahead

Periods to forecast ahead

forecast_type

Type of forecast. Either "AR" for autoregressive or "RW" for random walk.

lags

Number of lags to include in the AR model. Ignore for RW model. Default chooses the same as the max.ar setting of the model object.

mc

Logical value whether to include in intercept in the AR model or not.

Value

Returns a data frame with the point forecasts.

Details

The function first determines the maximum forecast horizon by adding the n.ahead argument to the most recent data observation across all modules. For variables whose forecast origin is before that, it creates additional forecasts up to the forecast origin. Hence, the actual number of forecasted values may differ across variables.

When the forecast type is "AR", the function first transforms the variable into logs (if only positive values observed), otherwise using the asinh transformation. Reported forecast values are after conversion back to the level of the variable. Also, the AR model is estimated on the same (sub)sample as the OSEM model. Since OSEM modules may contain explanatory variables whose availability restricts the sample, we ensure that the AR model is estimated on the same data as OSEM to ensure a fair comparison.