Learn R Programming

poolr (version 1.1-1)

mvnconv: Convert Correlations Among Multivariate Normal Test Statistics to Covariances for Various Target Statistics

Description

Function to convert a matrix with the correlations among multivariate normal test statistics to a matrix with the covariances among various target statistics.

Usage

mvnconv(R, side = 2, target, cov2cor = FALSE)

Arguments

R

a k kk * k symmetric matrix that contains the correlations among the test statistics.

side

scalar to specify the sidedness of the p-values that are obtained from the test statistics (2, by default, for two-sided tests; 1 for one-sided tests).

target

the target statistic for which the covariances are calculated (either "p", "m2lp", "chisq1", or "z"). See ‘Details’.

cov2cor

logical to indicate whether to convert the covariance matrix to a correlation matrix (default is FALSE).

Value

The function returns the covariance matrix (or the correlation matrix if cov2cor = TRUE).

Details

The function converts a matrix with the correlations among multivariate normal test statistics to a matrix with the covariances among various target statistics. In particular, assume [arrayc t_i \\ t_j array] MVN ([arrayc 0 \\ 0 array], [arraycc 1 & _ij \\ _ij & 1 array] )bmatrix t_i \\\ t_j bmatrix MVN (bmatrix 0 \\\ 0 bmatrix, bmatrix 1 & _ij \\\ _ij & 1 bmatrix )[t_i, t_j]' ~ MVN([0,0]', [1, rho_ij | rho_ij, 1]) is the joint distribution for test statistics t_i and t_j. For side = 1, let p_i = 1 - (t_i)p_i = 1 - Phi(t_i) and p_j = 1 - (t_j)p_j = 1 - Phi(t_j) where ()Phi(.) denotes the cumulative distribution function of a standard normal distribution. For side = 2, let p_i = 2(1 - (|t_i|))p_i = 2(1 - Phi(|t_i|)) and p_j = 2(1 - (|t_j|))p_j = 2(1 - Phi(|t_j|)). These are simply the one- and two-sided p-values corresponding to t_i and t_j.

If target = "p", the function computes Cov[p_i, p_j]Cov[p_i, p_j].

If target = "m2lp", the function computes Cov[-2 (p_i), -2 (p_j)]Cov[-2 ln(p_i), -2 ln(p_j)].

If target = "chisq1", the function computes Cov[F^-1(1 - p_i, 1), F^-1(1 - p_j, 1)]Cov[F^-1(1 - p_i, 1), F^-1(1 - p_j, 1)], where F^-1(,1)F^-1(.,1) denotes the inverse of the cumulative distribution function of a chi-square distribution with one degree of freedom.

If target = "z", the function computes Cov[^-1(1 - p_i), ^-1(1 - p_j)]Cov[Phi^-1(1 - p_i), Phi^-1(1 - p_j)], where ^-1()Phi^-1(.) denotes the inverse of the cumulative distribution function of a standard normal distribution.

References

Cinar, O. & Viechtbauer, W. (2022). The poolr package for combining independent and dependent p values. Journal of Statistical Software, 101(1), 1--42. https://doi.org/10.18637/jss.v101.i01

Examples

Run this code
# NOT RUN {
# illustrative correlation matrix
R <- matrix(c(   1,  0.8,  0.5,  0.3,
               0.8,    1,  0.2,  0.4,
               0.5,  0.2,    1,  0.7,
               0.3,  0.4,  0.7,    1), nrow = 4, ncol = 4)

# convert R into covariance matrices for the chosen targets
mvnconv(R, target = "p")
mvnconv(R, target = "m2lp")
mvnconv(R, target = "chisq1")
mvnconv(R, target = "z")

# convert R into correlation matrices for the chosen targets
mvnconv(R, target = "p",      cov2cor = TRUE)
mvnconv(R, target = "m2lp",   cov2cor = TRUE)
mvnconv(R, target = "chisq1", cov2cor = TRUE)
mvnconv(R, target = "z",      cov2cor = TRUE)
# }

Run the code above in your browser using DataLab