Gamma.fromVAR: Calculate the stationary covariance matrix Gamma

View source: R/Calc Gamma_fromVAR.r

Gamma.fromVARR Documentation

Calculate the stationary covariance matrix Gamma

Description

Calculates the stationary covariance matrix (Gamma) from the discrete-time (un)standardized lagged effects matrix (Phi) and residual covariance matrix (SigmaVAR). There is also an interactive web application on my website: Standardizing and/or transforming lagged regression estimates (https://www.uu.nl/staff/RMKuiper/Websites%20%2F%20Shiny%20apps).

Usage

Gamma.fromVAR(Phi, SigmaVAR)

Arguments

Phi

(Un)standardized lagged effects matrix. It also takes a fitted object from the classes "varest" (from the VAR() function in vars package) and "ctsemFit" (from the ctFit() function in the ctsem package); see example below. From such an object, the Phi and SigmaVAR matrices are calculated/extracted.

SigmaVAR

Residual covariance matrix of the first-order discrete-time vector autoregressive (DT-VAR(1)) model.

Value

This function returns the stationary covariance matrix, that is, the contemporaneous covariance matrix of the data.

Examples


# library(CTmeta)

## Example 1 ##
#
Phi <- myPhi[1:2,1:2]
#Phi <- matrix(c(0.50, 0.15, 0.25, 0.40), byrow=T, ncol = 2)
q <- dim(Phi)[1]
SigmaVAR <- diag(q) # for ease
Gamma.fromVAR(Phi, SigmaVAR)


## Example 2: input from fitted object of class "varest" ##
#
data <- myData
if (!require("vars")) install.packages("vars")
library(vars)
out_VAR <- VAR(data, p = 1)
Gamma.fromVAR(out_VAR)


rebeccakuiper/CTmeta documentation built on Nov. 2, 2024, 4:42 p.m.