# [R-sig-ME] metafor: estimate correlation between response variables (meta-analysis)

Gustaf Granath gustaf.granath at gmail.com
Tue Dec 13 11:42:23 CET 2016

```Hi,
Im trying the estimate the correlation between two response variable in
a meta-analysis. Basically, are effects on y1 associated with effects on
y2 across studies. Unfortunately, I dont have information on y1-y2
correlations within each study. In addition, each study contain multiple
treatments, adding within-study dependence for each response variable.

Because I dont have the y1-y2 covariance in each study, my idea is to
run analyses with different covariance/correlation values to explore how
this covariance affect the result. Reading the rma.mv() documentation,
this seems possible through the R= argument, but I cant figure out how.
Alternatively, I can add covariances in the matrix describing the known
var-covariance matrix of the within-study dependence, but it seemed like
the R argument is a easier solution (I may be wrong though). Below
follow code illustrating my problem using the dat.berkey1998 example.

Cheers

Gustaf

# Estimate correlation between two response variables
# with within-study dependence
library(metafor)

# Make up an example based on the berkey1998 data.
# Multiple outcomes (multiple treatments)
# within each study, for each response variable, are created.
# Covariances between response variables (within studies) are unknown.
dat <- get(data(dat.berkey1998))
st.vcov <- dat[, c("v1i", "v2i")] # save vcov matrices to add later
dat <- rbind(dat, dat)
dat <- dat[order(dat\$trial, dat\$outcome),] # fix order
dat[,c("v1i", "v2i")] <- rbind(st.vcov,st.vcov) # put back matrices
dat\$trial.treat <-paste(rep(1:2, nrow(dat)/2), dat\$trial, sep="_") # id
for treatments within trials

# Covariances within studies, for each response variable, is known.
Hence, a
# varcov-matrix for each study and response, can be made and added as blocks
# in a large varcov-matrix for the data set.
# First a within-study dependence dummy must be added
dat\$stud.unit <-  interaction(dat\$trial, dat\$outcome) # within-trial
dependence dummy
# Put together known varcov matrix
V <- bldiag(lapply(split(dat[,c("v1i", "v2i")], dat\$stud.unit), as.matrix))

# plot relationship between response variables
dat.wide <- reshape(dat, direction="wide",  v.names = "yi", timevar =
"outcome", idvar = "trial.treat")
plot(yi.AL ~yi.PD, dat.wide)
cor(dat.wide\$yi.AL, dat.wide\$yi.PD)
# r = 0.39, if using the study outcomes ignoring all dependence/uncertainty.

# Run analysis
res <- rma.mv(yi, V, mods = ~ outcome - 1,
random = ~ outcome | trial,
struct="UN", data=dat, method="REML")
print(res, digits=3)
# correlation = 0.51, when accounting for dependence etc. But, y1 and y2
are assumed to be independent
# within each study. How to perform sensitivity analyses by adding
different values
# on this within-study correlation between the two response variables?

--
Gustaf Granath (PhD)
Post doc
Swedish University of Agricultural Sciences
Department of Ecology

```