Statistics Quest

Two-sample t-test (Welch and pooled)

Compares the means of two independent groups; Welch's version (the engine default) does not assume equal variances, the pooled version does.

t=xˉ1−xˉ2−Δ0s12/n1+s22/n2,ν=(v1+v2)2v12/(n1−1)+v22/(n2−1), vi=si2nit = \frac{\xbar_1 - \xbar_2 - \Delta_0}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}, \qquad \nu = \frac{(v_1 + v_2)^2}{v_1^2/(n_1-1) + v_2^2/(n_2-1)},\ v_i = \frac{s_i^2}{n_i}
Welch's t-test with Welch–Satterthwaite degrees of freedom (usually not a whole number).
xˉi,si,ni\xbar_i, s_i, n_i
Mean, SD (n − 1) and size of group i.
Δ0\Delta_0
Difference stated by H₀ (usually 0).
ν\nu
Welch–Satterthwaite degrees of freedom.
t=xˉ1−xˉ2−Δ0sp1/n1+1/n2,sp2=(n1−1)s12+(n2−1)s22n1+n2−2,df=n1+n2−2t = \frac{\xbar_1 - \xbar_2 - \Delta_0}{s_p\sqrt{1/n_1 + 1/n_2}},\quad s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2},\quad df = n_1+n_2-2
Pooled-variance (Student) t-test: assumes equal population variances.
sps_p
Pooled standard deviation.

When to use

A quantitative outcome compared between two independent groups (different people/units in each group). Use Welch by default; the pooled test is only marginally more powerful when variances really are equal and can be badly wrong when they are not (especially with unequal group sizes).

Assumptions

  • Independent observations within and between groups (random samples or random assignment).
  • Each group roughly normal, or large enough samples for the CLT; watch for outliers.
  • Pooled version only: equal population variances.

How to interpret

  • The estimate is xˉ1−xˉ2\xbar_1 - \xbar_2 (first minus second); report it with its CI.
  • A small p-value is evidence that the population means differ. Whether a difference is caused by the grouping depends on the design (random assignment) — not on the test.
  • Effect size: Cohen's d with the pooled SD (the engine reports it for both versions).

Common mistakes

  • Using the two-sample test on paired data (it ignores the pairing and usually loses a lot of power).
  • Running a variance test first and switching between pooled and Welch based on it — just use Welch.
  • Reading the CI for the difference as "the overlap of two separate CIs": overlapping individual CIs do not imply a non-significant difference.

Example

Group A: 23, 25, 28, 30, 26, 27 (mean 26.5, SD 2.43); group B: 20, 22, 24, 21, 25, 19, 23 (mean 22.0, SD 2.16). Welch: t=3.50t = 3.50, ν=10.18\nu = 10.18, p=0.0055p = 0.0055, 95% CI for μA−μB\mu_A - \mu_B: 1.64 to 7.36. Pooled: t=3.54t = 3.54, df = 11, p=0.0047p = 0.0047, CI 1.70 to 7.30. Cohen's d=1.97d = 1.97.