generateVAR: Generate VAR Data

View source: R/main_function.R

generateVARR Documentation

Generate VAR Data

Description

This function generates Vector Auto-Regressive (VAR) data based on the provided parameters.

Usage

generateVAR(n, As, Sig, h, isOldProvided = FALSE, oldxs = NULL)

Arguments

n

Integer. The length of the VAR data to be generated.

As

List. A list containing the transition matrices for the VAR process.

Sig

Matrix. The covariance matrix of errors.

h

Integer. The order of the VAR process.

isOldProvided

Logical. If TRUE, the VAR data will be generated based on the last observations from the previous segment of data. Defaults to FALSE.

oldxs

Matrix. A p by h matrix containing the last observations from the previous segment of data. Required if isOldProvided = TRUE.

Value

A data matrix of dimensions p by n.

Examples

# Example usage
As <- list(matrix(c(0.5, 0.2, 0.1, 0.4), 2, 2))
Sig <- diag(2)
data <- generateVAR(n = 100, As = As, Sig = Sig, h = 1)

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