Skip to contents

meta_vcov_bivariate() builds a dense row-paired sampling covariance matrix for bivariate meta-analysis. It is a convenience helper for constructing the known V matrix used by meta_V() in complete-row bivariate Gaussian meta-analysis.

Usage

meta_vcov_bivariate(v1, v2, cov12 = NULL, cor12 = NULL)

Arguments

v1, v2

Numeric vectors of known sampling variances for response 1 and response 2.

cov12

Optional known sampling covariance between the two response estimates within each study. May be length one or the same length as v1.

cor12

Optional known sampling correlation between the two response estimates within each study. May be length one or the same length as v1. Supply at most one of cov12 and cor12.

Value

A dense 2 * length(v1) by 2 * length(v1) covariance matrix with class "drm_meta_vcov_bivariate".

Details

The returned matrix uses row-paired stacking: y1[1], y2[1], y1[2], y2[2], ..., y1[n], y2[n]. Each study contributes one 2 by 2 block with diagonal entries v1[i] and v2[i] and off-diagonal entries cov12[i]. If cor12 is supplied, the covariance is computed as cor12 * sqrt(v1 * v2).

In a bivariate Gaussian fit, this known sampling covariance is added to the fitted residual covariance from sigma1, sigma2, and rho12. The fitted rho12 therefore remains the residual covariance component after accounting for known within-study sampling covariance. A separate study-level random effect would be needed to label a correlation as a study-level correlation.

Examples

V <- meta_vcov_bivariate(
  v1 = c(0.04, 0.03),
  v2 = c(0.05, 0.02),
  cor12 = c(0.4, 0.2)
)
dim(V)
#> [1] 4 4