mvnconv: Convert Correlations Among Multivariate Normal Test...

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/mvnconv.r

Description

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

Usage

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

Arguments

R

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

side

scalar to specify the sidedness of the \mjseqnp-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).

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 \mjtdeqn\left[\beginarrayc t_i \\ t_j \endarray\right] \sim \mboxMVN \left(\left[\beginarrayc 0 \\ 0 \endarray\right], \left[\beginarraycc 1 & \rho_ij \\ \rho_ij & 1 \endarray\right] \right)\beginbmatrix t_i \\\ t_j \endbmatrix \sim \mboxMVN \left(\beginbmatrix 0 \\\ 0 \endbmatrix, \beginbmatrix 1 & \rho_ij \\\ \rho_ij & 1 \endbmatrix \right)[t_i, t_j]' ~ MVN([0,0]', [1, rho_ij | rho_ij, 1]) is the joint distribution for test statistics \mjseqnt_i and \mjseqnt_j. For side = 1, let \mjeqnp_i = 1 - \Phi(t_i)p_i = 1 - Phi(t_i) and \mjeqnp_j = 1 - \Phi(t_j)p_j = 1 - Phi(t_j) where \mjeqn\Phi(\cdot)Phi(.) denotes the cumulative distribution function of a standard normal distribution. For side = 2, let \mjeqnp_i = 2(1 - \Phi(|t_i|))p_i = 2(1 - Phi(|t_i|)) and \mjeqnp_j = 2(1 - \Phi(|t_j|))p_j = 2(1 - Phi(|t_j|)). These are simply the one- and two-sided \mjseqnp-values corresponding to \mjseqnt_i and \mjseqnt_j.

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

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

If target = "chisq1", the function computes \mjeqn\mboxCov[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 \mjeqnF^-1(\cdot,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 \mjeqn\mboxCov[\Phi^-1(1 - p_i), \Phi^-1(1 - p_j)]Cov[Phi^-1(1 - p_i), Phi^-1(1 - p_j)], where \mjeqn\Phi^-1(\cdot)Phi^-1(.) denotes the inverse of the cumulative distribution function of a standard normal distribution.

Value

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

Note

Since computation of the covariances requires numerical integration, the function doesn't actually compute these covariances on the fly. Instead, it uses the mvnlookup lookup table, which contains the covariances.

Author(s)

Ozan Cinar ozancinar86@gmail.com
Wolfgang Viechtbauer wvb@wvbauer.com

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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)

poolr documentation built on Jan. 27, 2022, 1:12 a.m.