pingouin.convert_effsize

pingouin.convert_effsize(ef, input_type, output_type, nx=None, ny=None)[source]

Conversion between effect sizes.

Parameters
effloat

Original effect size.

input_typestring

Effect size type of ef. Must be 'r' or 'd'.

output_typestring

Desired effect size type. Available methods are:

  • 'cohen': Unbiased Cohen d

  • 'hedges': Hedges g

  • 'eta-square': Eta-square

  • 'odds-ratio': Odds ratio

  • 'AUC': Area Under the Curve

  • 'none': pass-through (return ef)

nx, nyint, optional

Length of vector x and y. Required to convert to Hedges g.

Returns
effloat

Desired converted effect size

See also

compute_effsize

Calculate effect size between two set of observations.

compute_effsize_from_t

Convert a T-statistic to an effect size.

Notes

The formula to convert r to d is given in [1]:

\[d = \frac{2r}{\sqrt{1 - r^2}}\]

The formula to convert d to r is given in [2]:

\[r = \frac{d}{\sqrt{d^2 + \frac{(n_x + n_y)^2 - 2(n_x + n_y)} {n_xn_y}}}\]

The formula to convert d to \(\eta^2\) is given in [3]:

\[\eta^2 = \frac{(0.5 d)^2}{1 + (0.5 d)^2}\]

The formula to convert d to an odds-ratio is given in [4]:

\[\text{OR} = \exp (\frac{d \pi}{\sqrt{3}})\]

The formula to convert d to area under the curve is given in [5]:

\[\text{AUC} = \mathcal{N}_{cdf}(\frac{d}{\sqrt{2}})\]

References

1

Rosenthal, Robert. “Parametric measures of effect size.” The handbook of research synthesis 621 (1994): 231-244.

2

McGrath, Robert E., and Gregory J. Meyer. “When effect sizes disagree: the case of r and d.” Psychological methods 11.4 (2006): 386.

3

Cohen, Jacob. “Statistical power analysis for the behavioral sciences. 2nd.” (1988).

4

Borenstein, Michael, et al. “Effect sizes for continuous data.” The handbook of research synthesis and meta-analysis 2 (2009): 221-235.

5

Ruscio, John. “A probability-based measure of effect size: Robustness to base rates and other factors.” Psychological methods 1 3.1 (2008): 19.

Examples

  1. Convert from Cohen d to eta-square

>>> import pingouin as pg
>>> d = .45
>>> eta = pg.convert_effsize(d, 'cohen', 'eta-square')
>>> print(eta)
0.048185603807257595
  1. Convert from Cohen d to Hegdes g (requires the sample sizes of each group)

>>> pg.convert_effsize(.45, 'cohen', 'hedges', nx=10, ny=10)
0.4309859154929578
  1. Convert Pearson r to Cohen d

>>> r = 0.40
>>> d = pg.convert_effsize(r, 'r', 'cohen')
>>> print(d)
0.8728715609439696
  1. Reverse operation: convert Cohen d to Pearson r

>>> pg.convert_effsize(d, 'cohen', 'r')
0.4000000000000001