transformData: Transform Data for VAR Estimation

View source: R/main_function.R

transformDataR Documentation

Transform Data for VAR Estimation

Description

Transforms the input time series data into the design matrices required for VAR estimation. This includes centering, optional scaling, and constructing the lagged predictor matrix.

Usage

transformData(data, p, opt)

Arguments

data

A numeric matrix or data frame with time series data (observations in rows, variables in columns).

p

Integer. The order of the VAR model (number of lags).

opt

List. Options for data transformation. Supported options include:

  • scale: Logical. Whether to scale the data columns (default is FALSE).

  • center: Logical. Whether to center the data columns (default is TRUE).

Value

A list with the following components:

X

The design matrix (via the Kronecker product) for lagged predictors.

y

A vectorized response corresponding to the lagged data.

series

The (centered and possibly scaled) original time series matrix.

mu

A row vector of the column means used for centering.


VARcpDetectOnline documentation built on April 12, 2025, 1:44 a.m.