hanegreefs.com/ statistics II
Home / Chapters / 06
Chapter 06 · Course ch. 14

Comparing two groups

Welch and pooled t-tests, two-proportion z-tests and paired versus independent data.

About 16 min read · Lecture material: HOC 6

Priority labels: ImportantNeutralLess important show where to spend revision time.

From one group to a differenceImportant

Comparing groups keeps the same machinery but moves the parameter from a single value to a difference: μ₁ − μ₂ for means, p₁ − p₂ for proportions. The first design question is always: are the two sets of measurements independent, or is each value in one set linked to a value in the other?

Each unit contributes to only one group? → independent samples (two-sample t, or two-proportion z).
Each unit measured twice, or naturally matched? → paired data: one-sample t on the differences (chapter 5).

Sampling distribution of a difference in meansImportant

For independent groups, variances add (they never subtract), so the standard error of ȳ₁ − ȳ₂ uses both samples:

Formula
SE(ȳ₁ − ȳ₂) = √( s₁²/n₁ + s₂²/n₂ )

The ratio of the observed difference to this SE follows a t model with degrees of freedom supplied by software (the Welch–Satterthwaite approximation).

The two-sample t-test (Welch, unpooled)Important

Formula
t = ( (ȳ₁ − ȳ₂) − Δ₀ ) / √( s₁²/n₁ + s₂²/n₂ ), usually Δ₀ = 0
  • H₀: μ₁ − μ₂ = Δ₀ against ≠, > or <.
  • The Welch df is generally not an integer and never exceeds n₁ + n₂ − 2. You do not memorise the formula; the calculator or R supplies it.
  • Decide as always: p < α → reject; then state the result in context, naming the groups and the response variable.
Worked example

Two training formats

Group 1 (n₁ = 40) averages ȳ₁ = 52.0 with s₁ = 9.0; group 2 (n₂ = 45) averages ȳ₂ = 47.5 with s₂ = 11.0. Test for a difference at α = 0.05 and give a 95% interval.

1

Standard error

SE = √(81/40 + 121/45) = √4.714 = 2.171
2

Test statistic and df

t = 4.5 / 2.171 = 2.07; df (Welch) ≈ 82.5
3

p-value

two-sided p ≈ 0.041 < 0.05
4

Interval

t* ≈ 1.989 → 4.5 ± 1.989 × 2.171 = [0.18, 8.82]
Answer

Reject H₀. Group 1 scores higher on average, by somewhere between about 0.2 and 8.8 points. The interval excludes 0, matching the test, but it is wide: the effect is detectable yet imprecisely known.

Confidence interval for μ₁ − μ₂Important

Formula
(ȳ₁ − ȳ₂) ± t*ᵈᶠ · SE(ȳ₁ − ȳ₂)

A test only says whether a difference exists; the interval estimates its size. If the interval contains 0, you cannot claim a difference at that confidence level.

The pooled t-testNeutral

If you may assume equal population variances (homoscedasticity) you can pool the spreads and gain a little precision:

Formula
s²_p = ((n₁−1)s₁² + (n₂−1)s₂²) / (n₁ + n₂ − 2), SE = s_p · √(1/n₁ + 1/n₂), df = n₁ + n₂ − 2

Equal variances are hard to verify and the pooled test misleads when they are not equal, whereas Welch loses almost nothing when they are. Default to Welch unless the design clearly justifies equal spreads. R: t.test(y ~ group) is Welch; add var.equal = TRUE for the pooled version.

ConditionsImportant

ConditionHow to check
Independence within groupsRandom sampling or random assignment in each group
Independence between groupsStudy design: the groups must be unrelated (not paired). No test can verify this
10% conditionEach sample ≤ 10% of its population (not needed for randomised experiments)
Nearly Normal in each groupA histogram per group; large groups (≈30+) make the test robust. One failing group violates the condition

Comparing two proportionsImportant

For a binary response use z methods. The interval keeps each group's own estimate; the test, whose null says p₁ = p₂, pools the successes to estimate the shared proportion.

Formula
CI: (p̂₁ − p̂₂) ± z*·√( p̂₁q̂₁/n₁ + p̂₂q̂₂/n₂ )
Formula
Test: p̂_pool = (x₁ + x₂)/(n₁ + n₂), z = (p̂₁ − p̂₂) / √( p̂_pool(1 − p̂_pool)(1/n₁ + 1/n₂) )

Success/failure checks use at least 10 successes and 10 failures in each group (pooled counts for the test). TI-84: 6:2-PropZTest and B:2-PropZInt.

Worked example

Click-through in two layouts

Layout A: 96 clicks from 200 visitors. Layout B: 72 clicks from 180. Is there a difference?

1

Proportions

p̂₁ = 0.48, p̂₂ = 0.40, p̂_pool = 168/380 = 0.442
2

Pooled SE

√(0.442 × 0.558 × (1/200 + 1/180)) = 0.0510
3

z and p

z = 0.08 / 0.0510 = 1.57; two-sided p ≈ 0.117
4

Interval (unpooled)

SE = 0.0508 → 0.08 ± 1.96 × 0.0508 = [−0.020, 0.180]
Answer

No significant difference at α = 0.05: the interval includes 0, though differences up to 18 points remain plausible. A bigger sample would settle it.

Paired versus independent: the recurring trapImportant

Treating paired data as independent inflates the SE and wastes power; treating independent data as paired is conceptually wrong (and needs equal sizes). Look at the study design, not the numbers. For paired data compute each difference dᵢ, then use t = d̄/(s_d/√n) with n − 1 df.

Worked example

Paired example (8 stores, before and after)

Differences in weekly sales (after − before): 4, 7, 1, 6, 3, 5, 2, 8.

1

Summaries

d̄ = 4.5, s_d = 2.449
2

Statistic

t = 4.5 / (2.449/√8) = 5.20, df = 7 → p ≈ 0.0013
Answer

Strong evidence of an increase. With a before-after design and no control group, remember that time itself could be part of the effect.

PitfallsImportant

PitfallRemedy
Paired data analysed as independentAsk whether each unit appears in both conditions
Pooled test with unequal spreadsUse Welch
Nearly-Normal condition ignored for small nPlot each group; consider a non-parametric test
Significant but tiny differenceReport the interval and judge practical size
Causal claims from an observational comparisonOnly randomised designs support them

ToolsNeutral

WelchPooledPaired
SE√(s₁²/n₁ + s₂²/n₂)s_p√(1/n₁ + 1/n₂)s_d/√n
dftechnology (Satterthwaite)n₁ + n₂ − 2n − 1
Extra assumptionnoneσ₁² = σ₂²data genuinely paired
TI-844:2-SampTTest, Pooled: No4:2-SampTTest, Pooled: YesT-Test on L1 − L2
Rt.test(y ~ g)var.equal = TRUEpaired = TRUE

Key takeaways

  • Independent groups: add variances; default to Welch. Paired data: analyse the differences.
  • Two proportions: pool for the test, don't pool for the interval.
  • Pair the test with an interval that shows how big the difference is.
Question
Tap or press space to reveal
Answer
Did you know it?

Multiple choice

Ch 06 · Question 1

The standard error of ȳ₁ − ȳ₂ (independent) is…

Why: Variances add.
Ch 06 · Question 2

Which design is paired?

Why: Same units measured twice.
Ch 06 · Question 3

Welch's df is typically…

Why: Satterthwaite approximation.
Ch 06 · Question 4

If a 95% CI for μ₁ − μ₂ is [−1.2, 3.4], then at α = 0.05 a two-sided test of equality…

Why: 0 is inside.
Ch 06 · Question 5

The pooled proportion is used in a two-proportion…

Why: Under H₀ both share a common p.
Ch 06 · Question 6

Pooled t-test requires additionally…

Why: Equal-variance assumption.
Ch 06 · Question 7

Treating paired data as independent usually…

Why: The SE ignores the positive correlation.
Ch 06 · Question 8

Success/failure for a two-proportion test means…

Why: At least 10 successes and 10 failures in each group.

Exam-style questions

Exam-style · Ch 06

Compare two call centres: A has n = 40, mean 6.2 min, SD 1.5; B has n = 35, mean 5.6, SD 1.1. Is there a difference in mean handling time? Which test, and why not the pooled one?

Show outline of a full answer
  1. Independent samples → Welch.
  2. SE = √(1.5²/40 + 1.1²/35) ≈ 0.301; t ≈ 1.99; df ≈ 71.
  3. Two-sided p ≈ 0.05 (borderline).
  4. Pooled needs equal variances; unequal SDs and sizes make Welch safer.
Exam-style · Ch 06

In an A/B test, 120 of 1000 visitors convert on page A and 150 of 1100 on page B. Test whether the conversion rates differ and construct a 95% interval for the difference.

Show outline of a full answer
  1. p̂_A = 0.12, p̂_B = 0.1364; pooled 0.1286.
  2. Pooled SE ≈ 0.0146, z ≈ −1.12, p ≈ 0.26 → no evidence.
  3. Interval uses unpooled SE ≈ 0.0146: −0.016 ± 0.029.
  4. Contains 0 → consistent with the test.

Two-sample calculatorInteractive

Welch, pooled and two-proportion procedures from summary statistics.