Comparing Groups

t-tests, ANOVA, and Non-parametric Alternatives

The Clinical Problem

An ICMR trial in Jharkhand randomises 90 women with iron-deficiency anaemia to three arms (n = 30 each):

Arm Mean Hb ± SD (g/dL)
Oral iron 10.8 ± 1.4
IV iron 11.5 ± 1.6
Placebo 9.6 ± 1.5

Questions that cascade:

  1. Is oral iron better than placebo? → t-test
  2. Are all three groups different? → ANOVA
  3. Which pairs differ? → Post-hoc tests
  4. What if data aren’t normal? → Non-parametric alternatives

Roadmap

One-Sample t-Test: When to Use

Scenario: One group vs. a known reference value

Example: 120 MBBS students at KGMU Lucknow — is their mean BMI different from the national average of 22.5?

Hypotheses:

  • H₀: μ = 22.5 (mean BMI equals national average)
  • H₁: μ ≠ 22.5 (two-tailed)

Formula:

\[t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}}, \quad df = n - 1\]

One-Sample t: Worked Example

t = 2.82, df = 119, p = 0.0057

Paired t-Test: Same Subjects, Two Timepoints

Scenario: 40 hypertensive patients at a PHC in Kolar, Karnataka — systolic BP before and after 6 weeks of amlodipine

\[t = \frac{\bar{d}}{s_d / \sqrt{n}}, \quad df = n - 1\]

where \(\bar{d}\) = mean of within-subject differences

Key: Each patient is their own control — reduces between-subject variability

Paired t: Worked Example

Independent Two-Sample t-Test

Scenario: HbA1c at 6 months — metformin (n = 50) vs. glimepiride (n = 50) at KEM Hospital, Pune

\[t = \frac{\bar{x}_1 - \bar{x}_2}{SE}, \quad SE = s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\]

Two versions:

Condition Test
Equal variances (Levene’s p > 0.05) Student’s t-test
Unequal variances Welch’s t-test (default in R)

Independent t: Worked Example

Effect Size: Cohen’s d

Statistical significance alone is not enough — how large is the difference?

\[d = \frac{\bar{x}_1 - \bar{x}_2}{s_p}\]

Cohen’s d Interpretation
0.2 Small
0.5 Medium
0.8 Large

Clinical significance adds context: a difference of 0.5% HbA1c may not meet the MCID of 0.5% — statistically significant but clinically marginal.

Checking Assumptions

Normality

  • Shapiro-Wilk test (p > 0.05 → normal)
  • Q-Q plot (points on diagonal → normal)
  • Histograms
  • CLT: n > 30 often suffices

Equal Variances

  • Levene’s test (p > 0.05 → equal)
  • Rule of thumb: ratio of larger to smaller SD < 2
  • If unequal → use Welch’s t-test

When assumptions fail badly:

→ Use non-parametric alternatives (Section 7)

One-Way ANOVA: Three or More Groups

Why not multiple t-tests?

With 3 groups → 3 pairwise comparisons → inflated Type I error

\[\alpha_{\text{family}} = 1 - (1 - 0.05)^3 = 0.143\]

ANOVA tests all groups simultaneously:

  • H₀: μ₁ = μ₂ = μ₃ (all means equal)
  • H₁: At least one mean differs

\[F = \frac{MS_{\text{between}}}{MS_{\text{within}}} = \frac{\text{Signal (between-group variance)}}{\text{Noise (within-group variance)}}\]

ANOVA: Anaemia Trial Example

The ANOVA Table

Source df SS MS F
Between groups k − 1 SS_B SS_B / (k−1) MS_B / MS_W
Within groups N − k SS_W SS_W / (N−k)
Total N − 1 SS_T

Significant F → at least one group differs, but WHICH ones?

→ Post-hoc tests

Post-Hoc Comparisons

ANOVA says “something differs” — post-hoc says what.

Method When to Use Correction
Tukey HSD All pairwise comparisons Controls familywise error
Bonferroni Conservative; few planned comparisons α / number of tests
Dunnett Compare each treatment to one control Only vs. control
Comparison Mean Diff Lower CI Upper CI Adj. p
Oral Iron-Placebo Oral Iron-Placebo 0.895 0.056 1.734 0.034
IV Iron-Placebo IV Iron-Placebo 1.326 0.487 2.165 0.001
IV Iron-Oral Iron IV Iron-Oral Iron 0.431 -0.408 1.270 0.442

Non-Parametric Alternatives: When to Use

Use when:

  • Data are ordinal (e.g., pain VAS, Likert scales)
  • Distribution is heavily skewed or has outliers
  • Small samples (n < 15–20 per group) and normality uncertain
Parametric Non-Parametric
Independent t-test Mann-Whitney U
Paired t-test Wilcoxon signed-rank
One-way ANOVA Kruskal-Wallis

Mann-Whitney U Test

Example: Length of stay — laparoscopic vs. open cholecystectomy at Safdarjung Hospital, Delhi

Wilcoxon Signed-Rank Test

Example: Pain VAS (0–10) before and after physiotherapy at CMC Vellore — 25 knee OA patients

Kruskal-Wallis Test

Example: Patient satisfaction (Likert 1–5) across 3 CHCs in Chhattisgarh

Decision Flowchart

Scenario Parametric Non-Parametric
One group vs. reference value One-sample t-test Wilcoxon signed-rank*
Two groups, same subjects (paired) Paired t-test Wilcoxon signed-rank
Two independent groups Independent t-test Mann-Whitney U
Three+ independent groups One-way ANOVA Kruskal-Wallis
Note:
* One-sample Wilcoxon signed-rank tests median vs. hypothesised value

Reporting Template

t-test:

Mean HbA1c was lower in the metformin group (7.1 ± 0.9%) than in the glimepiride group (7.5 ± 1.1%); t(98) = −2.14, p = 0.035, 95% CI for difference [−0.77, −0.03], Cohen’s d = 0.40.

ANOVA:

One-way ANOVA showed a significant difference in Hb across treatment groups, F(2, 87) = 12.4, p < 0.001. Post-hoc Tukey HSD revealed IV iron was significantly higher than placebo (mean diff = 1.9 g/dL, p < 0.001).

Non-parametric:

Median LOS was significantly shorter in the laparoscopic group (3 days, IQR 2–4) than the open group (6 days, IQR 5–7); Mann-Whitney U, p < 0.001.

Do’s and Don’ts

Do

  • Check normality and variance before choosing a test
  • Report effect sizes (Cohen’s d, η²)
  • Use Welch’s t-test by default for independent samples
  • Apply post-hoc corrections after ANOVA
  • Report medians and IQR for non-parametric tests

Don’t

  • Run multiple t-tests instead of ANOVA
  • Ignore assumption violations
  • Report only p-values without effect sizes
  • Use parametric tests on ordinal data
  • Forget to state whether the test was one-tailed or two-tailed

Key Takeaways

  1. One-sample t → one group vs. reference value
  2. Paired t → same subjects, two timepoints
  3. Independent t → two separate groups
  4. ANOVA → three or more groups; follow with post-hoc if significant
  5. Non-parametric alternatives for skewed data or ordinal scales
  6. Always report: test statistic, df, p-value, CI, and effect size
  7. Clinical significance ≠ statistical significance — interpret both