# [R-meta] Query lost on the mailing list

Viechtbauer, Wolfgang (NP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Mon Jul 18 10:57:49 CEST 2022

```Hi Yuhang,

One can also use rcalc() for more complex situations with multiple time points (multiple samples aren't an issue, since they are independent, so one can just combine a study ID with a sample ID for the purposes of using rcalc()). But if the same sample is measured multiple times on some variable of interest, then one just needs to reflect this as distinct 'var1' (or 'var2') values. For example:

study time var1 var2
1     1    x1   y1
1     2    x2   y2

study time var1 var2 ri ni
1     1    x1   y1   0.4 60
1     2    x2   y2   0.5 60")

tmp <- rcalc(ri ~ var1 + var2 | study, ni=ni, data=dat)
tmp\$V

However, in order to compute the covariance between r(x1,y1) and r(x2,y2), one also needs r(x1,x2), r(y1,y2), r(x1,y2), and r(y1,x2). For example:

study time var1 var2 ri ni
1     1    x1   y1   0.4 60
1     2    x2   y2   0.5 60
1     12   x1   x2   0.7 60
1     12   y1   y2   0.8 60
1     12   x1   y2   0.3 60
1     12   y1   x2   0.2 60")

tmp <- rcalc(ri ~ var1 + var2 | study, ni=ni, data=dat)
tmp\$V

In the end, one might only keep the first two rows from that study (and the first two rows and columns from tmp\$V), but the computation of the covariance requires the info from the full 4x4 correlation matrix (i.e., all 6 correlations).

It isn't entirely clear to me why there are two rows with var1=ext and var2=math in the two studies you are showing, so I cannot comment on this specific case further.

Best,
Wolfgang

>Date: Tue, 12 Jul 2022 21:40:01 -0700
>From: Yuhang Hu <yh342 using nau.edu>
>To: r-sig-meta-analysis using r-project.org
>Subject: [R-meta] rcalc() or vcalc() for correlated Pearson rs in
>
>Hello Everyone,
>
>I'm meta-analyzing the correlation (Pearson r) between extroversion (ext)
>and achievement in math, reading, and arts.
>
>My data looks like what is shown below. I wonder whether "rcalc()" is a
>suitable option for building a var-covariance matrix for Pearson r
>coefficients in each study OR "vcalc()" is a more suitable option?
>
>ps. It seems "rcalc()" requires var1 and var2 in each row to be distinct in
>each study which makes me think "rcalc()" may not be suitable for cases
>where there are multiple time points or samples etc.
>
>study  ri  var1    var2   scale  outcome  ni  sample_id
>1      .1   ext    math   epq    math     50  1
>1      .2   ext    math   epq    read     50  1
>1      .3   ext    art    epq    art      50  1
>2      .4   ext    math   pf     math     35  1
>3      .5   ext    read   pf     read     80  1
>3      .6   ext    math   pf     math     64  2
>
>Thank you for your time in advance.
>
>Sincerely,
>
>Yuhang Hu
>Ph.D. Student
>Northern Arizona University
```