Learn R Programming

mlmts (version 1.1.2)

mts_forecasting: A forecasting procedure for MTS based on lag-embedding matrices

Description

mts_forecasting computes a general forecasting method for MTS based on fitting standard regression models to lag-embedding matrices.

Usage

mts_forecasting(X, max_lag = 1, model_caret = "lm", h = 1)

Value

A list containing the \(h\)-step ahead forecast (matrix) for each one of the MTS.

Arguments

X

A list of MTS (numerical matrices).

max_lag

The maximum lag considered to construct the lag-embedding matrices.

model_caret

The corresponding regression model.

h

The prediction horizon.

Author

Ángel López-Oriona, José A. Vilar

Details

This function performs a forecasting procedure based on lag-embedding matrices. Given a list of MTS, it returns the corresponding list of \(h\)-step ahead forecasts. We assume we want to forecast a given MTS \(\boldsymbol X_T\) with certain univariate components for a given forecasting horizon \(h\) and a maximum number of lags \(L\). For each component, the corresponding lag-embedded matrix is constructed by considering the past information about that component and all the remaining ones. The selected regression model is fitted to all the constructed matrices (considering the last column as the response variables), and the fitted models are used to construct the \(h\)-step ahead forecasts in a recursive manner.

Examples

Run this code
predictions <- mts_forecasting(RacketSports$data[1], model_caret = 'lm', h = 1)
# Obtaining the predictions for the first series in dataset RacketSports
# by using standard linear regression and a forecasting horizon of 1
predictions <- mts_forecasting(RacketSports$data[1], model_caret = 'rf', h = 3)
# Obtaining the predictions for the first series in dataset RacketSports
# by using the random forest and a forecasting horizon of 3

Run the code above in your browser using DataLab