fts.VARforecast: Functional Time Series Forecasting using VAR Models

View source: R/fts.VARforecast.R

fts.VARforecastR Documentation

Functional Time Series Forecasting using VAR Models

Description

This function implements Vector Autoregression (VAR) forecasting for functional time series using preprocessed data from "fpcaobj" objects generated by fda.preprocess (FPC) or fts.cumAC (cumulative autocovariances). It allows for both in-sample fit evaluation and out-of-sample forecasting with the option to specify the model as individual autoregressive (AR) processes or a VAR process.

Usage

fts.VARforecast(
  fdaobj,
  K = 3,
  p = 1,
  AR = FALSE,
  start = NULL,
  end = NULL,
  h = 1
)

Arguments

fdaobj

An object of class "fdaobj", typically the output from fda.preprocess or fts.cumAC.

K

Integer specifying the number of factors to consider in the forecast model.

p

Integer defining the number of lags to include in the VAR model.

AR

A logical flag indicating whether to model individual AR(p) processes (TRUE) for each factor, or a collective VAR(p) model (FALSE). Default is FALSE.

start

Optional integer specifying the start index for a restricted sample period.

end

Optional integer specifying the end index for a restricted sample period.

h

Forecast horizon. If h=0, an in-sample fit is returned. If h > 0, an out-of-sample h-step forecast is generated. Default is h=1.

Value

The function returns different outputs based on the value of h. If h > 0: Returns the h-step ahead forecasted functional time series curve. If h = 0: Returns a list containing:

curve.predict

The in-sample predicted curves.

factors.predict

The in-sample predicted factors.

factors

The actual factors from the input object.

MSE

The Mean Squared Error of the in-sample predicted curves.

VARmatrix

The estimated VAR matrix.

Examples

# Load, preprocess data, and perform in-sample prediction
fed = load.fed()
fdaobj = fda.preprocess(data = fed)
in_sample_fit = fts.VARforecast(fdaobj, h=0)
# Perform 1-step ahead prediction
one_step_ahead = fts.VARforecast(fdaobj, h=1)

ottosven/dffm documentation built on Feb. 23, 2025, 1:15 p.m.