15  Converting to Cohen’s \(d\)

Keywords

collaboration, confidence interval, effect size, open educational resource, open scholarship, open science

15.1 From Independent Samples \(t\)-statistic

To calculate a between subject standardized mean difference (\(d_p\), i.e., pooled standard deviation standardizer), we can use the sample size in each group (\(n_A\) and \(n_B\)) as well as the \(t\)-statistic from an independent sample t-test and plug it into the following formula:

\[ d_{p} = t\sqrt{\frac{1}{n_A}+\frac{1}{n_B} } \tag{15.1}\]

Note that this only works for Student’s t-tests and not Welch’s t-test (unless the sample sizes are equal). Using the escalc() function in the metafor package we can convert \(t\) to \(d_p\) or the associated p-value from the t-test to \(d_p\).

library(metafor)

# Example:
# independent samples t-statistic = 3.25
# nA = 50, nB = 40

# calculate dp from t
stats <- escalc(measure = "SMD", 
                ti = 3.25,
                n1i = 50,
                n2i = 40,
                var.names = c("dp","variance"))

# display results
summary(stats)

      dp variance    sei     zi   pval  ci.lb  ci.ub 
1 0.6835   0.0476 0.2182 3.1331 0.0017 0.2559 1.1111 
# Example:
# p-value = .0016
# nA = 50, nB = 40

# calculate dp from p-value
stats <- escalc(measure = "SMD", 
                pi = .0016,
                n1i = 50,
                n2i = 40,
                var.names = c("dp","variance"))

# display results
summary(stats)

      dp variance    sei     zi   pval  ci.lb  ci.ub 
1 0.6850   0.0476 0.2182 3.1395 0.0017 0.2574 1.1127 

15.2 From Paired Sample \(t\)-statistic

To calculate a within-subject standardized mean difference (\(d_z\), i.e., difference score standardizer), we can use the sample size (\(n\)) as well as the \(t\)-statistic from a paired sample t-test and plug it into the following formula:

\[ d_{z} = \frac{t}{\sqrt{n}} \tag{15.2}\]

Note that if we want to get the repeated measures \(d_{rm}\) value we can use \(d_{rm} = d_z \times \sqrt{2(1-r)}\), but this will require the correlation between conditions. Using the escalc() function in the metafor package we can convert \(t\) to \(d_z\).

# Example:
# paired t-statistic = 3.25
# n = 50

# calculate dz from t-statistic
stats <- escalc(measure = "SMCC", 
                ti = 3.25,
                ni = 50,
                var.names = c("dz","variance"))

# display results
summary(stats)

      dz variance    sei     zi   pval  ci.lb  ci.ub 
1 0.4525   0.0220 0.1485 3.0477 0.0023 0.1615 0.7436 
# Example:
# p-value = 3.25
# n = 50

# calculate dz from p-value
stats <- escalc(measure = "SMCC", 
                pi = .0021,
                ni = 50,
                var.names = c("dz","variance"))

# display results
summary(stats)

      dz variance    sei     zi   pval  ci.lb  ci.ub 
1 0.4523   0.0220 0.1485 3.0462 0.0023 0.1613 0.7433 

15.3 From Pearson Correlation

If a Pearson correlation is calculated between a continuous score and a dichotomous score (grouping variable with groups \(A\) and \(B\)), this is considered a point-biserial correlation. The point-biserial correlation can be converted into a \(d_p\) value using the following formula:

\[ d_p = \frac{r}{\sqrt{1-r^2}} \sqrt{\frac{n_A+n_B-2}{n_A} + \frac{n_A+n_B-2}{n_B}}. \tag{15.3}\]

If the group sample sizes are equal (\(n_A=n_B\)), then the equation simplifies to be,

\[ d_p = \frac{r\sqrt{4}}{\sqrt{1-r^2}} \tag{15.4}\]

Using the escalc() function in the metafor package we can convert \(r\) to \(d_p\).

# Example:
# r = .40
# nA = 50, nB = 40

# calculate dp
stats <- escalc(measure = "SMD", 
                ri = .4,
                n1i = 50,
                n2i = 40,
                var.names = c("dp","variance"))

# display results
summary(stats)

      dp variance    sei     zi   pval  ci.lb  ci.ub 
1 0.8611   0.0491 0.2216 3.8852 0.0001 0.4267 1.2955 

15.4 From Odds-Ratio

An odds-ratio from a contingency table can also be converted to a \(d_p\). Note that this formula is an approximation:

\[ d_{p} = \frac{\log(OR)\sqrt{3}}{\pi} \tag{15.5}\]

This method is the called the logit method as it uses the variance of the logistic distribution, however, it may actually be preferable to use the Cox logit method which is simply,

\[ d_{p} = \frac{\log(OR)}{1.65} \tag{15.6}\]

Using the oddsratio_to_d function in the effectsize package we can convert \(OR\) to \(d_p\) with the logit method. we will use base R to calculate \(d_p\) with the Cox logit method.

library(effectsize)

# Example:
# OR = 1.46
OR <- 1.46

# calculate dp using logit method
oddsratio_to_d(OR = OR)
[1] 0.2086429
# calculate dp using cox logit method
OR / 1.65
[1] 0.8848485