calc_corr_yx: Calculate Expected Matrix of Correlations between Outcomes...

Description Usage Arguments Value References See Also Examples

Description

This function calculates the expected correlation matrix between Outcomes (Y) and Covariates (X) in a correlated system of continuous variables. This system is generated with nonnormsys using the techniques of Headrick and Beasley (doi: 10.1081/SAC-120028431). These correlations are determined based on the beta (slope) coefficients calculated with calc_betas, the correlations between independent variables X_{(pj)} for a given outcome Y_p, for p = 1, ..., M, and the variances. The result can be used to compare the simulated correlation matrix to the theoretical correlation matrix. If there are continuous mixture variables and the betas are specified in terms of non-mixture and mixture variables, then the correlations in corr.x will be calculated in terms of non-mixture and mixture variables using rho_M1M2 and rho_M1Y. In this case, the dimensions of the matrices in corr.x should not match the number of columns of betas. The function result will be in terms of non-mixture and mixture variables. Otherwise, the result will be in terms of non-mixture and components of mixture variables. The vignette Theory and Equations for Correlated Systems of Continuous Variables gives the equations, and the vignette Correlated Systems of Statistical Equations with Non-Mixture and Mixture Continuous Variables gives examples. There are also vignettes in SimCorrMix which provide more details on continuous non-mixture and mixture variables.

Usage

1
2
3
calc_corr_yx(betas = NULL, corr.x = list(), vars = list(),
  mix_pis = list(), mix_mus = list(), mix_sigmas = list(),
  error_type = c("non_mix", "mix"))

Arguments

betas

a matrix of the slope coefficients calculated with calc_betas, rows represent the outcomes

corr.x

list of length M, each component a list of length M; corr.x[[p]][[q]] is matrix of correlations for independent variables in equations p (X_{(pj)} for outcome Y_p) and q (X_{(qj)} for outcome Y_q); if p = q, corr.x[[p]][[q]] is a correlation matrix with nrow(corr.x[[p]][[q]]) = # X_{(pj)} for outcome Y_p; if p != q, corr.x[[p]][[q]] is a non-symmetric matrix of correlations where rows correspond to covariates for Y_p so that nrow(corr.x[[p]][[q]]) = # X_{(pj)} for outcome Y_p and columns correspond to covariates for Y_q so that ncol(corr.x[[p]][[q]]) = # X_{(qj)} for outcome Y_q; order is 1st continuous non-mixture and 2nd components of continuous mixture variables

vars

a list of same length as corr.x of vectors of variances for X_{(pj)}, E; E term should be last; order should be the same as in corr.x

mix_pis

a list of same length as corr.x, where mix_pis[[p]][[j]] is a vector of mixing probabilities for X_{mix(pj)} that sum to 1, the j-th mixture covariate for outcome Y_p; the last element of mix_pis[[p]] is for E_p (if error_type = "mix"); if Y_p has no mixture variables, use mix_pis[[p]] = NULL

mix_mus

a list of same length as corr.x, where mix_mus[[p]][[j]] is a vector of means for X_{mix(pj)}, the j-th mixture covariate for outcome Y_p; the last element of mix_mus[[p]] is for E_p (if error_type = "mix"); if Y_p has no mixture variables, use mix_mus[[p]] = NULL

mix_sigmas

a list of same length as corr.x, where mix_sigmas[[p]][[j]] is a vector of standard deviations for X_{mix(pj)}, the j-th mixture covariate for outcome Y_p; the last element of mix_sigmas[[p]] is for E_p (if error_type = "mix"); if Y_p has no mixture variables, use mix_sigmas[[p]] = NULL

error_type

"non_mix" if all error terms have continuous non-mixture distributions, "mix" if all error terms have continuous mixture distributions, defaults to "non_mix"

Value

corr.yx a list of length M, where corr.yx[[p]] is matrix of correlations between Y (rows) and X_p (columns); if the dimensions of betas match the dimensions of the matrices in corr.x, then the correlations will be in terms of non-mixture and components of mixture variables; otherwise, mix_pis, mix_mus, and mix_sigmas must be provided and the correlations will be in terms of non-mixture and mixture variables

References

Headrick TC, Beasley TM (2004). A Method for Simulating Correlated Non-Normal Systems of Linear Statistical Equations. Communications in Statistics - Simulation and Computation, 33(1). doi: 10.1081/SAC-120028431

See Also

nonnormsys, calc_betas, rho_M1M2, rho_M1Y

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Example: system of three equations for 2 independent variables, where each
# error term has unit variance, from Headrick & Beasley (2002)
corr.yx <- list(matrix(c(0.4, 0.4), 1), matrix(c(0.5, 0.5), 1),
  matrix(c(0.6, 0.6), 1))
corr.x <- list()
corr.x[[1]] <- corr.x[[2]] <- corr.x[[3]] <- list()
corr.x[[1]][[1]] <- matrix(c(1, 0.1, 0.1, 1), 2, 2)
corr.x[[1]][[2]] <- matrix(c(0.1974318, 0.1859656, 0.1879483, 0.1858601),
  2, 2, byrow = TRUE)
corr.x[[1]][[3]] <- matrix(c(0.2873190, 0.2589830, 0.2682057, 0.2589542),
  2, 2, byrow = TRUE)
corr.x[[2]][[1]] <- t(corr.x[[1]][[2]])
corr.x[[2]][[2]] <- matrix(c(1, 0.35, 0.35, 1), 2, 2)
corr.x[[2]][[3]] <- matrix(c(0.5723303, 0.4883054, 0.5004441, 0.4841808),
  2, 2, byrow = TRUE)
corr.x[[3]][[1]] <- t(corr.x[[1]][[3]])
corr.x[[3]][[2]] <- t(corr.x[[2]][[3]])
corr.x[[3]][[3]] <- matrix(c(1, 0.7, 0.7, 1), 2, 2)
corr.e <- matrix(0.4, nrow = 3, ncol = 3)
diag(corr.e) <- 1
vars <- list(rep(1, 3), rep(1, 3), rep(1, 3))
betas <- calc_betas(corr.yx, corr.x, vars)
calc_corr_yx(betas, corr.x, vars)

SimRepeat documentation built on May 2, 2019, 9:32 a.m.