# [R-meta] Comparing dependent, overlapping correlation coefficients

Viechtbauer, Wolfgang (SP) wolfg@ng@viechtb@uer @ending from m@@@trichtuniver@ity@nl
Tue Aug 14 22:02:38 CEST 2018

```With var-cov matrix, I mean the var-cov matrix of cor(X,Y) and cor(X,Z), not the var-cov matrix of Y and Z. The rmat() function allows you to compute the former.

Using your example, but adding some made-up values for cor(Y,Z):

dat <- read.table(header=TRUE, text = "
study    var1 var2  ri  ni
1    X    Y    .20  50
1    X    Z    .30  50
1    Y    Z    .52  50
2    X    Y    .34  35
2    X    Z    .43  35
2    Y    Z    .44  35")

res <- rmat(ri ~ var1 + var2 | study, n=c(50,35), data=dat)
res

The 'V' element is the var-cov matrix of the three correlations within the two studies.

Best,
Wolfgang

-----Original Message-----
From: Anna-Lena Schubert [mailto:anna-lena.schubert using psychologie.uni-heidelberg.de]
Sent: Monday, 13 August, 2018 14:32
To: Viechtbauer, Wolfgang (SP); r-sig-meta-analysis using r-project.org
Subject: Re: [R-meta] Comparing dependent, overlapping correlation coefficients

Hi Wolfgang,

thanks four sharing your rmat-code, that is extremely helpful!

If you say I need the var-cov matrix for each study, do you mean the
var-cov matrix for Y and Z? And if I have that, how do I feed this into
the meta-analysis? Do I add those matrices to a single large matrix that
contains all variances/covariances, or do I add each matrix separately
somehow? Would I do this in a similar vein as Berkey et al. (1998) --
http://www.metafor-project.org/doku.php/analyses:berkey1998 -- or do I
need a different approach?

Best,
Anna-Lena

Am 10.08.2018 um 17:02 schrieb Viechtbauer, Wolfgang (SP):
> Hi Anna-Lena,
>
> Do you have cor(Y,Z)? Then this allows you to compute the covariance between cor(X,Y) and cor(X,Z) -- which is what you need to do a proper test. Indeed, you want the data in long format as you have them, but you also need the 2x2 var-cov matrix for each study. You can compute this with:
>
> https://gist.github.com/wviechtb/700983ab0bde94bed7c645fce770f8e9
>
> See also this thread in the archives:
>
> https://stat.ethz.ch/pipermail/r-sig-meta-analysis/2018-January/000483.html
>
> Best,
> Wolfgang
>
> -----Original Message-----
> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On Behalf Of Anna-Lena Schubert
> Sent: Friday, 10 August, 2018 16:21
> To: r-sig-meta-analysis using r-project.org
> Subject: [R-meta] Comparing dependent, overlapping correlation coefficients
>
> Dear all,
>
> I want to run a meta-analysis that compares dependent, overlapping
> correlation coefficients (i.e., I want to see if X correlates more
> strongly with Y than it does with Z). I already ran a meta-analysis
> separately for both of these correlations and would now like to compare
> those two pooled effect sizes statistically. Confidence intervals of the
> two correlations do not overlap (r1 = .18 [.12; .24]; r2 = .32 [.25;
> .39]), but I wonder if there may be a more elegant way to compare these
> correlations than just based on CIs.
>
> I wonder, for example, if a factorial variable could be used to identify
> those correlations in a "long" data format style, and if I could test
> for a significant interaction between variable type (Y vs. Z) and the
> correlation in a meta-analysis:
>
>     Study    Variable    r
>     1    Y    .20
>     1    Z    .30
>     2    Y    .34
>     2    Z    .43
>
> I would greatly appreciate if anyone could tell me if that's a good idea
> or could recommend other approaches. Thanks in advance for any offers of
> help!
>
> Best,
> Anna-Lena
```

More information about the R-sig-meta-analysis mailing list