r.vcov {metavcov}R Documentation

Computing Variance-Covariance Matrices for Correlation Coefficients

Description

The function r.vcov computes variance-covariance matrix for multivariate meta-analysis when the effect size is measured by correlation coefficient.

Usage

r.vcov(n, corflat, zscore = FALSE, name = NULL, method = "average", na.impute = NA)

Arguments

n

A NN-dimensional vector containing sample sizes from NN studies.

corflat

A N×pN \times p matrix or data frame storing pp correlation coefficients from each of the NN studies.

zscore

Whether the correlation coefficients in corflat are already transformed into Fisher's zz scores.

name

A pp-dimensional vector containing names for the pp correlation coefficients.

method

Method "average" computes variance and covariances with mean correlation coefficients that are sample-size weighted from all the NN studies (missing values are omitted); method "each" computes variance and covariances with each of the corresponding correlation coefficients.

na.impute

Missing values can be imputed by a numeric value, such as zero by setting na.impute = 0. With the default setting na.impute = NA, missing values are not imputed. If specifying na.impute = "average", missing values are imputed by mean correlation coefficients that are sample-size weighted from the complete records.

Details

How to arrange correlation coefficients of each study from matrix to vector is in Cooper et al book page 385 to 386. Details for average method are in book of Cooper et al page 388. Let ristr_{ist} denote the sample correlation coefficient that describes the relationship between variables ss and tt in study ii. We can calculate its variance as var(rist)=(1ρist2)2/ni,var({{r}_{ist}})={{(1-\rho_{ist}^{2})}^{2}}/{{n}_{i}}, and the covariance between two correlation coefficients is cov(rist,riuv)=[.5ρistρiuv(ρisu2+ρisv2+ρitu2+ρitv2)+ρisuρitv+ρisvρitu(ρistρisuρisv+ρitsρituρitv+ρiusρiutρiuv+ρivsρivtρivu)]/ni, cov({{r}_{ist}},{{r}_{iuv}})=[.5{{\rho }_{ist}}{{\rho }_{iuv}}({{\rho }}_{isu}^{2}+{{\rho }}_{isv}^{2}+{{\rho }}_{itu}^{2}+{{\rho }}_{itv}^{2})+{{\rho }_{isu}}{{\rho }_{itv}}+{{\rho }_{isv}}{{\rho }_{itu}} \nonumber \\ -({{\rho }_{ist}}{{\rho }_{isu}}{{\rho }_{isv}}+{{\rho }_{its}}{{\rho }_{itu}}{{\rho }_{itv}}+{{\rho }_{ius}}{{\rho }_{iut}}{{\rho }_{iuv}}+{{\rho }_{ivs}}{{\rho }_{ivt}}{{\rho }_{ivu}})]/{{n}_{i}}, where ρi..\rho_{i..} represents the population value. In practice, ρi..\rho_{i..} can be substituted by the observed sample correlation or sample-size weighted mean correlation coefficients from all studies.

Value

r

A N×pN \times p data frame that contains the input argument corflat with column names and imputed values according to the input argument na.impute. If the input argument zscore=TRUE, r is transformed from Fisher's zz score in corflat.

list.rvcov

A NN-dimensional list of p(p+1)/2×p(p+1)/2p(p+1)/2 \times p(p+1)/2 matrices of computed variance-covariance matrices.

matrix.rvcov

A N×p(p+1)/2N \times p(p+1)/2 matrix whose rows are computed variance-covariance vectors.

ef

A N×pN \times p data frame that contains Fisher's zz transformed correlation coefficients from the input argument corflat with column names and imputed values according to the input argument na.impute.

list.vcov

A list in the same format of list.rvcov for Fisher's zz transformed correlation coefficients.

matrix.vcov

A matrix matrix.rvcov for Fisher's zz transformed correlation coefficients.

Author(s)

Min Lu

References

Lu, M. (2023). Computing within-study covariances, data visualization, and missing data solutions for multivariate meta-analysis with metavcov. Frontiers in Psychology, 14:1185012.

Examples

##############################################################
# A simple example:
# Checking the example in Harris Cooper et al.'s book page 388
##############################################################
r <- matrix(c(-0.074, -0.127, 0.324, 0.523, -0.416, -0.414), 1)
n <- 142
computvcov <- r.vcov(n = n, corflat = r,
                     name = paste("C", c("st", "su", "sv", "tu", "tv", "uv"), sep = ""),
                     method = "each")
round(computvcov$list.rvcov[[1]], 4)
round(computvcov$ef, 4)
round(computvcov$list.vcov[[1]], 4)
round(computvcov$matrix.vcov, 4)
######################################################
# Example: Craft2003 data
# Preparing covariances for multivariate meta-analysis
######################################################
data(Craft2003)
# extract correlation from the dataset (craft)
corflat <- subset(Craft2003, select=C1:C6)
# transform correlations to z and compute variance-covariance matrix.
computvcov <- r.vcov(n = Craft2003$N, corflat = corflat, method = "average")
# name transformed z scores as y
y <- computvcov$ef
# name variance-covariance matrix of trnasformed z scores as S
S <- computvcov$matrix.vcov
S[1, ]
## fixed-effect model
MMA_FE <- summary(metafixed(y = y, Slist = computvcov$list.vcov))
#######################################################################
# Running random-effects model using package "mixmeta" or "metaSEM"
#######################################################################
# Restricted maximum likelihood (REML) estimator from the mixmeta package
#library(mixmeta)
#mvmeta_RE <- summary(mixmeta(cbind(C1, C2, C3, C4, C5, C6) ~ 1,
#                           S = S, data = y, method = "reml"))
#mvmeta_RE

# maximum likelihood estimators from the metaSEM package
# library(metaSEM)
# metaSEM_RE <- summary(meta(y = y, v = S))
# metaSEM_RE
##############################################################
# Plotting the result:
##############################################################
obj <- MMA_FE
# obj <- mvmeta_RE
# obj <- metaSEM_RE
# pdf("CI.pdf", width = 4, height = 7)
plotCI(y = computvcov$ef, v = computvcov$list.vcov,
        name.y = NULL, name.study = Craft2003$ID,
        y.all = obj$coefficients[,1],
        y.all.se = obj$coefficients[,2])
# dev.off()

[Package metavcov version 2.1.5 Index]