Skip to contents

Forecast OSEM model

Usage

forecast_model(
  model,
  exog_predictions = NULL,
  n.ahead = 10,
  ci.levels = c(0.5, 0.66, 0.95),
  exog_fill_method = "AR",
  ar.fill.max = 4,
  plot = TRUE,
  uncertainty_sample = 100,
  quiet = FALSE
)

Arguments

model

A model object of class 'osem'.

exog_predictions

A data.frame or tibble with values for the exogenous values. The number of rows of this data must be equal to n.ahead.

n.ahead

Periods to forecast ahead

ci.levels

Numeric vector. Vector with confidence intervals to be calculated. Default: c(0.5,0.66,0.95)

exog_fill_method

Character, either 'AR', 'auto', or 'last'. When no exogenous values have been provided, these must be inferred. When option 'exog_fill_method = "AR"' then an autoregressive model is used to further forecast the exogenous values. With 'last', simply the last available value is used. 'auto' is an auto.arima model.

ar.fill.max

Integer. When no exogenous values have been provided, these must be inferred. If option 'exog_fill_method = "AR"' then an autoregressive model is used to further forecast the exogenous values. This options determines the number of AR terms that should be used. Default is 4.

plot

Logical. Should the result be plotted? Default is TRUE.

uncertainty_sample

Integer. Number of draws to be made for the error bars. Default is 100.

quiet

Logical. Should messages about the forecast procedure be suppressed?

Value

An object of class osem.forecast

Examples

spec <- dplyr::tibble(
  type = c(
    "d",
    "d",
    "n"
  ),
  dependent = c(
    "StatDiscrep",
    "TOTS",
    "Import"
  ),
  independent = c(
    "TOTS - FinConsExpHH - FinConsExpGov - GCapitalForm - Export",
    "GValueAdd + Import",
    "FinConsExpHH + GCapitalForm"
  )
)

fa <- list(geo = "AT", s_adj = "SCA", unit = "CLV05_MEUR")
fb <- list(geo = "AT", s_adj = "SCA", unit = "CP_MEUR")
filter_list <- list("P7" = fa, "YA0" = fb, "P31_S14_S15" = fa,
"P5G" = fa, "B1G" = fa, "P3_S13" = fa, "P6" = fa)
if (FALSE) { # \dontrun{
a <- run_model(specification = spec, dictionary = NULL,
inputdata_directory = NULL, filter_list = filter_list,
download = TRUE, save_to_disk = NULL, present = FALSE)
forecast(a)
} # }