
Convert effect sizes to a common metric (Pearson's r)
convert_effect_sizes.RdConverts a variety of effect sizes and test statistics to Pearson's r for
comparability. Effect sizes that cannot be meaningfully converted are
returned as NA with appropriate warnings.
Arguments
- es_values
Numeric vector of effect sizes, or character vector for test statistics formatted in APA style (e.g.,
"t(10) = 2.5").- es_types
Character vector of effect size types (case-insensitive). See Details for accepted values. Unrecognized types trigger a warning.
- quiet
Logical. If
TRUE, suppresses warnings about unknown effect size types and messages about non-convertible or missing values.- return_reasons
Logical. If
TRUE, return a data frame with the converted value (r) and the reason it is missing (na_reason; currently recorded for chi-squared statistics that cannot be converted).
Value
Numeric vector of effect sizes converted to Pearson's r. Returns
NA for values that cannot be converted or are missing. With
return_reasons = TRUE, a data frame with columns r and
na_reason.
Details
Supported Effect Sizes
The following effect sizes can be converted to r. Accepted es_types
values are case-insensitive.
- Pearson's r / phi
"r","phi","φ"
Conversion: Returned as-is.
Sign: Preserved.- R-squared
"r2","r^2","r²","r-square","r-squared"
Conversion: \(r = \sqrt{R^2}\)
Sign: Always positive (R² is non-directional).- Cohen's d / Hedges' g
"d","cohen's d","hedges' g","smd"
Conversion: \(r = \frac{d}{\sqrt{d^2 + 4}}\)
Sign: Preserved (if input d is negative, r is negative).- Odds ratio
"or","odds ratio"
Conversion: \(d = \ln(OR) \cdot \sqrt{3} / \pi\), then d to r.
Sign: Preserved (OR < 1 implies negative r).- Eta-squared
"etasq","eta^2","η²"
Conversion: \(d = 2\sqrt{\frac{\eta^2}{1 - \eta^2}}\), then d to r.
Sign: Always positive.- Cohen's f / f²
"f","cohen's f","f2","f^2","f²","f-square","f-squared"
Conversion (f): \(d = 2f\), then d to r.
Conversion (f²): \(R^2 = \frac{f^2}{1 + f^2}\), then \(r = \sqrt{R^2}\).
Sign: Always positive.
Test Statistics
When es_types is "test statistic" the function parses APA-formatted strings in es_values.
- t-test
Format:
"t(df) = value"
Conversion: \(r = \frac{t}{\sqrt{t^2 + df}}\)
Sign: Preserved.- F-test
Format:
"F(df1, df2) = value"
Constraint: df1 must equal 1.
Conversion: \(t = \sqrt{F}\), then t to r.
Sign: Always positive.- z-test
Format:
"z = value, N = value"
Conversion: \(r = \frac{z}{\sqrt{z^2 + N}}\)
Sign: Preserved.- Chi-squared (sometimes convertible)
Format:
"x2(1, N = value) = value"
Constraint: Only a \(\chi^2(1)\) test of a 2 x 2 contingency table can be converted, with N equal to the number of units counted in that table.
Conversion: \(r = \sqrt{\frac{\chi^2}{N}}\) (phi)
Sign: Always positive.
Not converted: \(\chi^2\) with df > 1, without N, or with \(\chi^2 / N > 1\) returnsNAwith a reason. The test statistic itself cannot show whether a \(\chi^2(1)\) comes from a contingency table or from a model (Wald, likelihood-ratio, model fit) or goodness-of-fit test. Such values are therefore only excluded when the data flag them (seeadd_common_effect_sizes).
References
Sánchez-Meca, J., Marín-Martínez, F., & Chacón-Moscoso, S. (2003). Effect-size indices for dichotomized outcomes in meta-analysis. Psychological Methods, 8(4), 448–467. doi:10.1037/1082-989X.8.4.448