Understanding Cohen’s d: The Complete Guide to Effect Size

If you run a t-test and get a statistically significant p-value (like $p < 0.05$), you know that a difference exists between your two groups. But there is a catch: a p-value does not tell you how large or important that difference actually is.

If your sample size is massive, even a microscopic, meaningless difference can produce a significant p-value.

To understand the practical importance of your results, you need an effect size. The most common measurement for the difference between two independent means is Cohen’s d.

What is Cohen’s d?

Cohen’s d measures the distance between two group means in terms of standard deviations.

Instead of measuring the difference in raw units (like “Group A lost 2 more kilograms than Group B”), it standardises the difference (like “Group A is 0.5 standard deviations lower than Group B”). This allows you to compare the effectiveness of entirely different studies, even if they used different measurement scales.

The Formula

To calculate Cohen’s d, you subtract the mean of one group from the mean of the other, and divide by the pooled standard deviation:

$$d = \frac{M_1 – M_2}{SD_{pooled}}$$

Because the two groups might have different variances and sample sizes, the pooled standard deviation ($SD_{pooled}$) uses a weighted average of both groups’ standard deviations:

$$SD_{pooled} = \sqrt{\frac{(n_1 – 1)s_1^2 + (n_2 – 1)s_2^2}{n_1 + n_2 – 2}}$$

  • $M_1$ and $M_2$ = the sample means
  • $s_1^2$ and $s_2^2$ = the sample variances (standard deviation squared)
  • $n_1$ and $n_2$ = the sample sizes

How to Interpret Cohen’s d

In 1988, statistician Jacob Cohen proposed a standard rule of thumb for interpreting effect sizes. While context always matters (a “small” effect in medical research might save thousands of lives), these benchmarks are the standard for most scientific literature:

Cohen’s dInterpretationWhat it means visually
0.20Small EffectThe two distributions heavily overlap. The difference is subtle.
0.50Medium EffectThe difference is noticeable to the naked eye.
0.80Large EffectThe distributions have minimal overlap. The difference is obvious.
How to Calculate Cohen’s d in Excel

Excel does not have a native =COHENS_D() function, so you have to build the formula using basic summary statistics.

Assuming Group 1’s data is in cells A2:A30 and Group 2’s data is in B2:B30:

  1. Find the Means:
    • =AVERAGE(A2:A30)
    • =AVERAGE(B2:B30)
  2. Find the Standard Deviations:
    • =STDEV.S(A2:A30)
    • =STDEV.S(B2:B30)
  3. Find the Sample Sizes:
    • =COUNT(A2:A30)
    • =COUNT(B2:B30)
  4. Calculate Pooled SD: Assuming your sizes are in N1 and N2, and standard deviations are in SD1 and SD2, use this formula: =SQRT( ((N1-1)*(SD1^2) + (N2-1)*(SD2^2)) / (N1+N2-2) )
  5. Calculate d: =ABS(Mean1 - Mean2) / Pooled_SD

(Tip: To skip the manual math, you can just paste your raw data directly into our free Cohen’s d Calculator.)

How to Calculate Cohen’s d in Python

While libraries like statsmodels and pingouin have built-in effect size functions, it is often easier and faster to calculate it using standard numpy without installing extra dependencies.

import numpy as np

def cohens_d(group1, group2):
    # Calculate sample sizes
    n1, n2 = len(group1), len(group2)
    
    # Calculate means and variances (ddof=1 for sample variance)
    m1, m2 = np.mean(group1), np.mean(group2)
    var1, var2 = np.var(group1, ddof=1), np.var(group2, ddof=1)
    
    # Calculate pooled standard deviation
    pooled_sd = np.sqrt( ((n1 - 1) * var1 + (n2 - 1) * var2) / (n1 + n2 - 2) )
    
    # Calculate Cohen's d
    d = (m1 - m2) / pooled_sd
    return abs(d)

# Example usage
group_a = [12, 14, 15, 18, 12, 11]
group_b = [18, 19, 22, 21, 24, 20]

effect_size = cohens_d(group_a, group_b)
print(f"Cohen's d: {effect_size:.4f}")
How to Calculate Cohen’s d in R

R users can calculate this instantly using the popular effsize package.

# Install the package if you haven't already
# install.packages("effsize")

library(effsize)

# Example Data
group_a <- c(12, 14, 15, 18, 12, 11)
group_b <- c(18, 19, 22, 21, 24, 20)

# Calculate Cohen's d
result <- cohen.d(group_a, group_b)

# Print the result
print(result)

The output will automatically provide the $d$ estimate, the 95% confidence interval for the effect size, and a text interpretation (e.g., “Large effect”) based on Cohen’s standard thresholds.