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

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Tue Dec 13 13:41:00 CET 2016

```I have a hard time making sense of that toy example.

But if I understand you correctly, you have data like this:

study trt respvar yi vi
-----------------------
1     1   1       .  .
1     1   2       .  .
1     2   1       .  .
1     2   2       .  .
2     1   1       .  .
2     1   2       .  .
2     2   1       .  .
2     2   2       .  .
...

where 'yi' and 'vi' are the observed outcomes and corresponding variances.

Within studies, can we assume that 'yi' is independent for different treatments? Then V (the var-cov matrix of the 'yi' vector) will be block-diagonal, each block being a 2x2 matrix (since you only need to consider the covariance between 'yi' for respvar 1 and 'yi' for respvar 2). And the problem is that the covariances are unknown. Correct so far?

If so, the 'R' argument has nothing to do with this. If you want to approach this by means of a sensitivity analysis, then just impute the unknown covariances directly into 'V' and analyze by means of an appropriate multilevel/multivariate model. Something like this:

dat\$study.trt <- interaction(dat\$study, dat\$trt)
rma.mv(yi, V, mods = ~ factor(trt) - 1, random = list(~ 1 | study, ~ respvar | study.trt), struct="UN", data=dat)

To impute the covariances, you may be able to use cor*sqrt(v1*v2), where 'cor' is some kind of assumed correlation (maybe constant across studies, maybe not). However, whether this is appropriate depends on your outcome measure. For example, this would be fine for means or mean differences, but the covariance between standardized mean differences cannot be computed that way (see Gleser & Olkin, 2009, for the correct equation).

Gleser, L. J., & Olkin, I. (2009). Stochastically dependent effect sizes. In H. Cooper, L. V. Hedges, & J. C. Valentine (Eds.), The handbook of research synthesis and meta-analysis (2nd ed., pp. 357-376). New York: Russell Sage Foundation.

Best,
Wolfgang

> -----Original Message-----
> From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-
> project.org] On Behalf Of Gustaf Granath
> Sent: Tuesday, December 13, 2016 11:42
> To: r-sig-mixed-models at r-project.org
> Subject: [R-sig-ME] metafor: estimate correlation between response
> variables (meta-analysis)
>
> 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
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

```