# [R-meta] Covariance calculations for effect sizes other than ROM, SMD, or OR?

Sean Bloszies @@blo@zi @ending from nc@u@edu
Tue Jun 5 16:47:53 CEST 2018

```Hi all,
Metafor documentation
<http://www.metafor-project.org/doku.php/analyses:gleser2009#quantitative_response_variable>gives
a calculation for the off-diagonals in the variance-covariance matrix when
you have an odds ratio or standardized mean difference* effect size.

An exchange from April on this mailing list
<https://stat.ethz.ch/pipermail/r-sig-meta-analysis/2018-April/000762.html>gives
a calculation for when log ratio of means** is the effect size.

What about if you are using measure = "CVRC", where as in these examples,
you have a common control CV and multiple treatments' CVs?

What if you have a slope as an effect size? Specifically, b1 coefficient
for a regression of (Treatment-Control) on ((Treatment+Control)/2), where
again there are multiple treatments and one control in individual studies.

What is the covariance in these cases?

For reference, there is an example of what I'm dealing with at the bottom.

Thanks,
Sean

*For SMD:

calc.v <- function(x) {
v <- matrix(1/x\$n2i[1] + outer(x\$yi, x\$yi, "*")/(2*x\$Ni[1]),
nrow=nrow(x), ncol=nrow
<http://stat.ethz.ch/R-manual/R-devel/library/base/html/nrow.html>(x))
diag(v) <- x\$vi
v}

**For ROM:

calc.v <- function(x) {
v <- matrix(x\$SD_C[1]^2 / (x\$N_C[1] * x\$X_C[1]^2), nrow=nrow(x),
ncol=nrow(x))
diag(v) <- x\$vi
v
}

##############
mcvsm<-structure(list(cc = c("sc", "sc", "lm", "tp", "vv", "hv", "cv"
), study = c("bcty", "chspk", "dz", "el", "lach", "lach", "south"
), mns = c(12.13, 8.56, 8.03, 8.52, 13.5, 12.53, 5.49), mnc = c(12.4,
8.48, 7.45, 8.54, 12.26, 12.26, 6.38), sds = c(1.11, 0.92, 1.4,
1.38, 1.66, 1.96, 4.34), sdc = c(0.86, 0.37, 1.52, 1.44, 2.39,
2.39, 3), n = c(6L, 7L, 24L, 31L, 5L, 5L, 6L), id = 1:7, b1 = c(0.27,
1.04, -0.09, -0.04, -0.39, -0.2, 0.37), ses = c(0.24, 0.36, 0.05,
0.05, 0.32, 0.22, 0.13)), .Names = c("cc", "study", "mns", "mnc",
"sds", "sdc", "n", "id", "b1", "ses"), row.names = c(NA, 7L), class =
"data.frame",
digits = 4)
mcvsm\$id<-1:nrow(mcvsm)

mcvsm <- escalc(measure="ROM", m1i=mnc, sd1i=sdc, n1i=n,
m2i=mns, sd2i=sds, n2i=n, data=mcvsm)

calc.v <- function(x) {
v <- matrix(x\$sds[1]^2 / (x\$n[1] * x\$mns[1]^2), nrow=nrow(x), ncol=nrow(x))
diag(v) <- x\$vi
v
}
V <- bldiag(lapply(split(mcvsm, mcvsm\$cc), calc.v))
rma.mv(yi,V,  random = ~ 1 | study/cc/id,data=mcvsm)

#This all works fine. Note that in study == "lach", there are two
levels of  "cc" treatment and each of their "mns" are compared to the
exact same data for one "mnc" control.

The problem is in extending this method of dealing with correlation to

the other effect sizes specified.

[[alternative HTML version deleted]]

```