Description Usage Arguments Value References See Also Examples
This function calculates the expected correlation matrix between Outcomes (Y) and Error Terms (E) 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
, the
correlations between error terms, 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
correlations in corr.x
will be recalculated in terms of non-mixture or 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
. If error_type = "mix"
, the correlations in corr.e
will also be recalculated and
the function result will be in terms of mixture error terms. If error_type = "non_mix"
, the function result will be in terms of non-mixture
error terms. 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.
1 2 3 |
betas |
a matrix of the slope coefficients calculated with |
corr.x |
list of length |
corr.e |
correlation matrix for continuous non-mixture or components of mixture error terms |
vars |
a list of same length as |
mix_pis |
a list of same length as |
mix_mus |
a list of same length as |
mix_sigmas |
a list of same length as |
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" |
corr.ye
the matrix of correlations between Y and E
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
nonnormsys
, calc_betas
, rho_M1M2
, rho_M1Y
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_ye(betas, corr.x, corr.e, vars)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.