recursiveforecast: Recursively Forecasts a VAR

View source: R/recursiveforecast.R

recursiveforecastR Documentation

Recursively Forecasts a VAR

Description

Recursively forecasts a VAR estimated using sparseVAR. lambda can either be NULL, in which case all lambdas that were used for model estimation are used for forecasting, or a single value, in which case only the model using this lambda will be used for forecasting.

Usage

recursiveforecast(mod, h = 1, lambda = NULL)

Arguments

mod

VAR model estimated using sparseVAR

h

Desired forecast horizon. Default is h=1.

lambda

Either NULL in which case a forecast will be made for all lambdas for which the model was estimated, or a single value in which case a forecast will only be made for the model using this lambda. Choice is redundant if the model was estimated using a selection procedure.

Value

Returns an object of S3 class bigtime.recursiveforecast containing

fcst

Matrix or 3D array of forecasts

h

Selected forecast horizon

lambda

List of lambdas for which the forecasts were made

Y

Data used for recursive forecasting

Examples

sim_data <- simVAR(periods=200, k=5, p=5, seed = 12345)
summary(sim_data)
mod <- sparseVAR(Y=scale(sim_data$Y), selection = "bic")
is.stable(mod)
fcst_recursive <- recursiveforecast(mod, h = 4)
plot(fcst_recursive, series = "Y1")
fcst_direct <- directforecast(mod)
fcst_direct
fcst_recursive$fcst

bigtime documentation built on Aug. 22, 2023, 1:08 a.m.