r_to_d: Convert Pearson's r to Cohen's d

Description Usage Arguments Details References Examples

View source: R/functions.R

Description

Converts Pearson's r (computed with a continuous X and Y) to Cohen's d for use in meta-analysis. The resulting Cohen's d represents the estimated increase in standardized Y that is associated with a delta-unit increase in X.

Usage

1
r_to_d(r, sx, delta, N = NA, Ns = N, sx.known = FALSE)

Arguments

r

Pearson's correlation

sx

Sample standard deviation of X

delta

Contrast in X for which to compute Cohen's d, specified in raw units of X (not standard deviations).

N

Sample size used to estimate r

Ns

Sample size used to estimate sx, if different from N

sx.known

Is sx known rather than estimated? (By default, assumes sx is estimated, which will almost always be the case.)

Details

To preserve the sign of the effect size, the code takes the absolute value of delta. The standard error estimate assumes that X is approximately normal and that N is large.

References

Mathur MB & VanderWeele TJ (2019). A simple, interpretable conversion from Pearson's correlation to Cohen's d for meta-analysis. Epidemiology.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# d for a 1-unit vs. a 2-unit increase in X
r_to_d( r = 0.5,
        sx = 2,
        delta = 1,
        N = 100 )
r_to_d( r = 0.5,
        sx = 2,
        delta = 2,
        N = 100 )

# d when sx is estimated in the same vs. a smaller sample
# point estimate will be the same, but inference will be a little
# less precise in second case
r_to_d( r = -0.3,
         sx = 2,
         delta = 2,
         N = 300,
         Ns = 300 )

r_to_d( r = -0.3,
        sx = 2,
        delta = 2,
        N = 300,
        Ns = 30 )

Example output

          d         se        lo       hi
1 0.2886751 0.06210718 0.1669473 0.410403
          d        se        lo        hi
1 0.5773503 0.1242144 0.3338946 0.8208059
           d         se         lo         hi
1 -0.3144855 0.06217226 -0.4363408 -0.1926301
           d         se         lo         hi
1 -0.3144855 0.07352003 -0.4585821 -0.1703888

MetaUtility documentation built on Oct. 30, 2021, 5:07 p.m.