calc.CovMxStandTransPhi: calc.CovMxStandTransPhi

View source: R/HelpFiles_Calc CovMx stand transformed Phi.r

calc.CovMxStandTransPhiR Documentation

calc.CovMxStandTransPhi

Description

This function calculates the (vectorized) transformed standardized Phi, their covariance matrix and elliptical 95% confidence interval (CI). 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

calc.CovMxStandTransPhi(
  DeltaTStar,
  DeltaT = 1,
  N,
  Phi,
  Gamma = NULL,
  SigmaVAR = NULL,
  alpha = 0.05
)

Arguments

DeltaTStar

The time interval to which the (un)standardized lagged effects matrix (Phi) should be transformed to.

DeltaT

The time interval used. Hence, Phi(DeltaT) will be transformed to Phi(DeltaTStar) and standardized. By default, DeltaT = 1.

N

Number of persons (panel data) or number measurement occasions - 1 (time series data). This is used in determining the covariance matrix of the vectorized standardized lagged effects.

Phi

(Un)standardized lagged effects matrix. If necessary, it is standardized, then it is transformed and for this vectorized Phi the covariance matrix is determined. 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, SigmaVAR, and Gamma matrices are calculated/extracted.

Gamma

Stationary covariance matrix, that is, the contemporaneous covariance matrix of the data. Note that if Phi and SigmaVAR are known, Gamma can be calculated; hence, only SigmaVAR or Gamma is needed as input (if only Gamma, then use 'Gamma = Gamma' or set SigmaVAR to NULL, see examples below).

SigmaVAR

Residual covariance matrix of the first-order discrete-time vector autoregressive (DT-VAR(1)) model. Note that if Phi and SigmaVAR are known, Gamma can be calculated; hence, only SigmaVAR or Gamma is needed as input (if only Gamma, then use 'Gamma = Gamma' or set SigmaVAR to NULL, see examples below).

alpha

The alpha level in determining the (1-alpha)*100% CI. By default, alpha = 0.05; resulting in a 95% CI

Value

This function returns the vectorized transformed standardized lagged effects, their covariance matrix, and the corresponding elliptical/multivariate 95% CI.

Examples

## Example 1 ##

# Input for examples below
DeltaTStar <- 1
DeltaT <- 2
N <- 643
# Phi(DeltaT)
Phi <- myPhi[1:2,1:2]
#Phi <- matrix(c(0.25, 0.10,
#               0.20, 0.36), byrow=T, ncol = 2)
# SigmaVAR(DeltaT)
SigmaVAR <- diag(q) # for ease
# Calculate the Gamma corresponding to Phi and SigmaVAR - used in the second example
Gamma <- calc.Gamma.fromVAR(Phi, SigmaVAR) # ?calc.Gamma.fromVAR

#Example where only SigmaVAR is known and not Gamma
calc.CovMxStandTransPhi(DeltaTStar, DeltaT, N, Phi, NULL, SigmaVAR)
# or
calc.CovMxStandTransPhi(DeltaTStar, DeltaT, N, Phi, SigmaVAR = SigmaVAR)

#Example where only Gamma is known and not SigmaVAR
calc.CovMxStandTransPhi(DeltaTStar, DeltaT, N, Phi, Gamma)
# or
calc.CovMxStandTransPhi(DeltaTStar, DeltaT, N, Phi, Gamma, NULL)


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


rebeccakuiper/CTmeta documentation built on Oct. 17, 2023, 7:01 a.m.