Learn R Programming

poolr (version 0.8-2)

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 \times 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

is the joint distribution for test statistics \(t_i\) and \(t_j\). For side = 1, let \(p_i = 1 - \Phi(t_i)\) and \(p_j = 1 - \Phi(t_j)\) where \(\Phi(\cdot)\) denotes the cumulative distribution function of a standard normal distribution. For side = 2, let \(p_i = 2(1 - \Phi(|t_i|))\) and \(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 \(\mbox{Cov}[p_i, p_j]\).

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

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

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