Choosing a statistical test (t-test, ANOVA, chi-square)
The right statistical test depends on the type of outcome variable and the number of groups. Compare means of two groups with a t-test, three or more groups with ANOVA, proportions with chi-square (or Fisher exact for small samples), and two continuous variables with correlation.
Overview
To pick a test, ask two questions: (1) What type of data is the outcome? (continuous vs categorical) and (2) How many groups are compared, and are they independent or paired?
Test selection table
| Outcome / comparison | Test | Example |
|---|---|---|
| Means of 2 independent groups | Two-sample (unpaired) t-test | Mean HbA1c in drug vs placebo group |
| Means in the same people before and after (or matched pairs) | Paired t-test | Blood pressure before and after a drug in one group |
| Sample mean vs a known population mean | One-sample t-test | Mean height in a clinic vs national mean |
| Means of 3 or more groups | ANOVA (analysis of variance) | Mean LDL in vegans, vegetarians and omnivores |
| Proportions / categorical outcomes in 2 or more groups | Chi-square test | Percentage with MI in smokers vs nonsmokers |
| Categorical, small expected counts (under 5 in a cell) | Fisher exact test | Rare complication in a small trial |
| Paired categorical data | McNemar test | Same patients' symptom yes/no before and after |
| Two continuous variables | Pearson correlation; linear regression | Age and systolic blood pressure |
| Ordinal or skewed data | Nonparametric: Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis, Spearman | Pain scores |
| Time to event | Kaplan-Meier with log-rank; Cox regression | Survival after cancer surgery |
| Binary outcome with multiple predictors | Logistic regression (gives adjusted OR) | Predictors of readmission |
Memory aids
- T-test: two means.
- ANOVA: three or more means ("Analysis Of VAriance").
- Chi-square: categories ("chi-tegorical"), percentages and proportions.
- Paired = same people measured twice.
Why not multiple t-tests?
Comparing three groups with three separate t-tests inflates the type I error rate. ANOVA tests all groups at once; if significant, post hoc tests (for example Tukey) identify which pairs differ. A significant ANOVA only says at least one mean differs.
Parametric vs nonparametric
Parametric tests (t-test, ANOVA, Pearson) assume roughly normal distributions and continuous data. When data are skewed, ordinal, or samples are small, nonparametric tests based on ranks are used. They are less powerful when data really are normal.
Worked examples
- Compare mean birth weight in babies of smoking vs nonsmoking mothers: unpaired t-test.
- Compare mean birth weight among mothers who smoke none, 1-10, or more than 10 cigarettes daily: ANOVA.
- Compare the percentage of low-birth-weight babies between smokers and nonsmokers: chi-square.
- Compare a patient group's cholesterol before and after a diet: paired t-test.
- Relationship between number of cigarettes per day and birth weight: correlation/linear regression.
Exam approach in three steps
- Find the outcome variable in the question stem and decide whether it is a number (mean blood pressure, weight, score) or a category (yes/no, percentage with disease, stage).
- Count the groups being compared and check whether the same people are measured twice (paired) or different people are compared (independent).
- Check for special features: time-to-event data, very small counts, skewed data, or the need to adjust for several confounders at once (regression).
Most exam questions resolve after step 2: numbers in two groups means t-test, numbers in three or more groups means ANOVA, and categories means chi-square. Watch for distractors that describe the predictor rather than the outcome; the test is chosen by the type of outcome data being compared.
🧭 Algorithm: Choosing a statistical test
A number (mean BP, weight) → continuous. A category (yes/no, % with disease) → categorical. Time until an event → survival. Two continuous variables together → correlation/regression.
2 independent groups → unpaired t-test · same people twice → paired t-test · vs a known mean → one-sample t-test · ≥3 groups → ANOVA (+ post hoc, e.g., Tukey).
Nonparametric: Mann–Whitney U · Wilcoxon signed-rank (paired) · Kruskal–Wallis (≥3 groups).
Chi-square; Fisher exact if any expected cell <5; McNemar for paired proportions.
Pearson r (Spearman for ranks); linear regression for a continuous outcome; logistic regression → adjusted OR for a binary outcome.
Kaplan–Meier + log-rank test; Cox proportional hazards → hazard ratio.
Same subjects measured twice? Several groups (don't run multiple t-tests)? Need to adjust for confounders?
Key thresholds
- Two means → t-test; ≥3 means → ANOVA
- Proportions → chi-square; expected count <5 → Fisher exact
- Multiple t-tests inflate the type I error
- r² = proportion of variance explained
📚 Source: USMLE epidemiology/biostatistics content outline; standard biostatistics references — reviewed 2026-11
🔥 Exam pearls
- Two group means = t-test (paired if same subjects).
- Three or more group means = ANOVA.
- Proportions or categorical outcomes = chi-square; small counts = Fisher exact.
- Two continuous variables = correlation or regression.
- Time-to-event = Kaplan-Meier, log-rank, Cox (hazard ratio).
- Skewed or ordinal data = nonparametric tests.
