calc.TransPhi_Corr: calc.TransPhi_Corr

calc.TransPhi_CorrR Documentation

calc.TransPhi_Corr

Description

Calculates the (vectorized) transformed standardized Phi, their covariance matrix, the corresponding elliptical 95% confidence interval (CI) from a correlation matrix with contemporaneous and lagged correlations. 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.TransPhi_Corr(DeltaTStar, DeltaT = 1, N, corr_YXYX, alpha = 0.05)

Arguments

DeltaTStar

The time interval to which the 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 of measurement occasions - 1 (time series data). This is used in determining the covariance matrix of the vectorized standardized lagged effects.

corr_YXYX

The correlation matrix of the variables and the lagged variables (of size 2q x 2q). The upper q x q matrix is the correlation matrix between the (q) variables and the lower q x q matrix is the correlation matrix between the (q) lagged variables.

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 (i.e., for DeltaTStar), their covariance matrix, and the corresponding elliptical/multivariate 95% CI; SigmaVAR: residual covariance matrix for DeltaTStar; and Gamma: stationary covariance matrix.

Examples


# In the examples below, the following values are used:
DeltaTStar <- 12
DeltaT <- 24
N <- 2235

# Example with full correlation matrix
corr_YXYX <- matrix(c(1.00, 0.40, 0.63, 0.34,
0.40, 1.00, 0.31, 0.63,
0.63, 0.31, 1.00, 0.41,
0.34, 0.63, 0.41, 1.00), byrow = T, ncol = 2*2)
# Run function
calc.TransPhi_Corr(DeltaTStar, DeltaT, N, corr_YXYX)

# Example with vector of lower triangular correlation matrix
LT <- c(0.40, 0.63, 0.34, 0.31, 0.63, 0.41) # corr_YXYX[lower.tri(corr_YXYX,diag = F)]
# Make full correlation matrix of size 2*q times 2*q, with q=2 and thus 2*q=4
corr_YXYX <- diag(4) # As check: length(LT) = 4*(4-1)/2
corr_YXYX[lower.tri(corr_YXYX,diag = F)] <- LT
corr_YXYX[upper.tri(corr_YXYX,diag = F)] <- t(corr_YXYX)[upper.tri(t(corr_YXYX),diag = F)]
# Run function
calc.TransPhi_Corr(DeltaTStar, DeltaT, N, corr_YXYX)

# Example with vector of lower triangular correlation matrix including diagonals
LTD <- c(1.00, 0.40, 0.63, 0.34, 1.00, 0.31, 0.63, 1.00, 0.41, 1.00) # corr_YXYX[lower.tri(corr_YXYX,diag = T)]
# Make full correlation matrix of size 2*q times 2*q, with q=2 and thus 2*q=4
corr_YXYX <- matrix(NA, nrow=(4), ncol=(4))  # As check: length(LTD) = 4*(4+1)/2
corr_YXYX[lower.tri(corr_YXYX,diag = T)] <- LTD
corr_YXYX[upper.tri(corr_YXYX,diag = F)] <- t(corr_YXYX)[upper.tri(t(corr_YXYX),diag = F)]
# Run function
calc.TransPhi_Corr(DeltaTStar, DeltaT, N, corr_YXYX)

# The output (vecStandPhi_DeltaTStar, SigmaVAR_DeltaTStar, and Gamma) can be used to make stacked matrices or arrays which can serve as input for continuous-time meta-analysis CTmeta (using the function CTmeta).


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