Introduction
You have collected your data, opened R, SPSS or Python, and now face a menu of dozens of tests. Picking the wrong one is one of the most common reasons a thesis chapter or a journal submission comes back with "please reconsider the statistical analysis".
The good news: you don't need to memorise every test. The right choice follows almost mechanically from a few facts about your study design and your data. This guide walks you through those facts, gives you a decision table you can keep beside you, and shows a complete worked example.
The outcome (dependent variable) is what you measured and want to explain — blood pressure, exam score, whether a patient recovered. The predictor (independent variable or grouping variable) is what you think explains it — treatment group, age, smoking status.
The Four Questions
1. What type is your outcome?
- Continuous — a measurement on a scale: weight, blood pressure, reaction time, test score.
- Categorical — a group or label: recovered / not recovered, blood type, yes / no.
- Count — how many times something happened: number of hospital visits, number of errors.
- Time-to-event — how long until something happens, where some people may not have had the event by the end of the study (survival data).
2. What are you comparing or relating?
Are you comparing two groups, three or more groups, or looking at the relationship with a continuous predictor (for example, does blood pressure rise with age)? Do you need to account for several predictors at once? If so, you are in regression territory.
3. Are the observations independent or paired?
Groups are independent when each person appears in only one group (treatment vs. placebo). They are paired (or repeated measures) when the same people are measured more than once (before vs. after), or when observations are deliberately matched (twins, matched case–control pairs). Paired data need paired tests.
4. Do the assumptions of the standard test hold?
Most "standard" tests for continuous outcomes assume the data (or, more precisely, the residuals) are roughly normally distributed. With a small, heavily skewed sample, or with ordinal data such as Likert ratings, a non-parametric alternative is often safer. More on this below.
The Decision Table
Match your answers to questions 1–3 to a row. The last column is the alternative when assumptions are doubtful.
| Outcome | Comparison | Standard test | Non-parametric alternative |
|---|---|---|---|
| Continuous | 2 independent groups | Independent-samples t-test (Welch's) | Mann–Whitney U (Wilcoxon rank-sum) |
| Continuous | 2 paired measurements | Paired t-test | Wilcoxon signed-rank |
| Continuous | 3+ independent groups | One-way ANOVA | Kruskal–Wallis |
| Continuous | 3+ repeated measurements | Repeated-measures ANOVA or linear mixed model | Friedman test |
| Continuous | Continuous predictor | Pearson correlation / linear regression | Spearman rank correlation |
| Continuous | Several predictors | Multiple linear regression | — |
| Categorical | Categorical predictor, independent | Chi-square test of independence | Fisher's exact test (small expected counts) |
| Binary | 2 paired measurements | McNemar's test | — |
| Binary | Several predictors | Logistic regression | — |
| Count | Any predictors | Poisson or negative binomial regression | — |
| Time-to-event | 2+ groups / predictors | Log-rank test; Cox proportional hazards regression | — |
A t-test is a linear regression with one binary predictor; one-way ANOVA is a linear regression with one categorical predictor. Once you have more than one predictor — say treatment and age — move to the regression model for your outcome type (linear, logistic, Poisson, Cox). It answers the same question while adjusting for the other variables.
Parametric or Non-Parametric?
Parametric tests (t-test, ANOVA, Pearson) assume a particular distribution, usually normal. Non-parametric tests (Mann–Whitney, Kruskal–Wallis, Spearman) work on ranks and make weaker assumptions. Some practical rules:
- Look at the data first. A histogram or Q–Q plot per group tells you more than a formal normality test.
- Large samples are forgiving. Thanks to the Central Limit Theorem, t-tests and ANOVA are fairly robust to non-normality once each group has a few dozen observations, unless there are extreme outliers.
- Small, skewed samples or ordinal data (e.g. 1–5 ratings) are where non-parametric tests earn their place.
- Prefer Welch's t-test to the classic "equal variances" version. It doesn't assume the two groups have the same spread and loses almost nothing when they do. It is the default in R.
A t-test compares means. Mann–Whitney asks whether values in one group tend to be larger than in the other; it is only a comparison of medians under extra assumptions (similar shapes). Report it accordingly.
Worked Example — Drug vs. Placebo
A small pilot trial randomises 20 patients: 10 receive a new drug and 10 a placebo. After eight weeks, the reduction in systolic blood pressure (mmHg) is recorded. Drug group: mean 12, standard deviation 4. Placebo group: mean 7, standard deviation 5. Does the drug reduce blood pressure more than placebo?
Answer the four questions. Outcome: continuous (mmHg). Comparison: two groups. Design: independent (each patient is in one group only). Assumptions: a histogram of each group shows no strong skew or outliers. → Welch's independent-samples t-test.
Compute the standard error of the difference.
Compute the test statistic.
Welch's formula gives about 17.2 degrees of freedom. The two-sided p-value is about 0.024, and the 95% confidence interval for the difference is roughly 0.7 to 9.3 mmHg.
Patients on the drug had, on average, a 5 mmHg greater reduction than those on placebo (95% CI 0.7 to 9.3 mmHg; Welch's t = 2.47, df ≈ 17.2, p = 0.024). The interval is wide: the true benefit could be anywhere from negligible to substantial, which is typical of a small pilot and a good argument for a larger trial.
Running It in R and Python
With the raw data in a table with columns reduction and group:
t.test(reduction ~ group, data = trial) — Welch's test by default
wilcox.test(reduction ~ group, data = trial) — Mann–Whitney alternative
chisq.test(table(trial$smoker, trial$disease)) — chi-square for two categorical variables
stats.ttest_ind(drug, placebo, equal_var=False) — Welch's test
stats.mannwhitneyu(drug, placebo) — Mann–Whitney alternative
stats.chi2_contingency(table) — chi-square on a contingency table
Common Mistakes
With 4 groups there are 6 pairwise t-tests. At a 5% significance level each, the chance of at least one false positive across all six is much higher than 5%. Run one ANOVA (or Kruskal–Wallis) first, then use a post-hoc procedure such as Tukey's HSD that controls the overall error rate.
Before-and-after measurements on the same people are correlated. An independent t-test ignores that and usually loses a lot of power. Use the paired t-test or Wilcoxon signed-rank test.
The chi-square approximation becomes unreliable when expected cell counts are small (a common rule: any expected count below 5). Use Fisher's exact test instead.
A non-significant result means the data are not strong enough to rule out no effect — not that the effect is zero. Always report the effect size and its confidence interval alongside the p-value.
Practice Scenarios
Use the four questions to pick a test for each study. Then check with the hint.
Thirty students write a math test, receive six weeks of tutoring, then write a similar test. Did their scores improve?
In a sample of 500 adults, is smoking status (yes / no) associated with having a lung condition (yes / no)?
Recovery time (days) is compared across three physiotherapy programmes, 8 patients each. The data are strongly right-skewed.
Choosing the test is only the start: sample size, checking assumptions, handling missing data and writing up results all matter to examiners and reviewers. TutorDice offers one-on-one statistics and biostatistics consultation for graduate students and researchers — your first session is free. New to the normal distribution? Start with our normal distribution guide.