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.

Key terms

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?

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.

OutcomeComparisonStandard testNon-parametric alternative
Continuous2 independent groupsIndependent-samples t-test (Welch's)Mann–Whitney U (Wilcoxon rank-sum)
Continuous2 paired measurementsPaired t-testWilcoxon signed-rank
Continuous3+ independent groupsOne-way ANOVAKruskal–Wallis
Continuous3+ repeated measurementsRepeated-measures ANOVA or linear mixed modelFriedman test
ContinuousContinuous predictorPearson correlation / linear regressionSpearman rank correlation
ContinuousSeveral predictorsMultiple linear regression—
CategoricalCategorical predictor, independentChi-square test of independenceFisher's exact test (small expected counts)
Binary2 paired measurementsMcNemar's test—
BinarySeveral predictorsLogistic regression—
CountAny predictorsPoisson or negative binomial regression—
Time-to-event2+ groups / predictorsLog-rank test; Cox proportional hazards regression—
Intuition — Tests are special cases of 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:

Note — Non-parametric tests answer a slightly different question

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?

1
Choose and run the test
1

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.

2

Compute the standard error of the difference.

$$SE = \sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}} = \sqrt{\frac{16}{10} + \frac{25}{10}} = \sqrt{4.1} \approx 2.025$$
3

Compute the test statistic.

$$t = \frac{\bar{x}_1 - \bar{x}_2}{SE} = \frac{12 - 7}{2.025} \approx 2.47$$

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.

Interpretation

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:

R

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

Python (SciPy)

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

Mistake 1 — Running many t-tests instead of one ANOVA

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.

Mistake 2 — Treating paired data as independent

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.

Mistake 3 — Chi-square with small expected counts

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.

Mistake 4 — "p > 0.05, so there is no effect"

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.

1

Thirty students write a math test, receive six weeks of tutoring, then write a similar test. Did their scores improve?

Continuous outcome, the same students measured twice → paired t-test. If the differences are strongly skewed, use the Wilcoxon signed-rank test.
2

In a sample of 500 adults, is smoking status (yes / no) associated with having a lung condition (yes / no)?

Two categorical variables, independent people → chi-square test of independence on the 2×2 table. With a sample this large the expected counts are very likely all above 5; if not, use Fisher's exact test. To adjust for age as well, use logistic regression.
3

Recovery time (days) is compared across three physiotherapy programmes, 8 patients each. The data are strongly right-skewed.

Continuous outcome, 3 independent groups, small and skewed samples → Kruskal–Wallis test, followed by Dunn's test for pairwise comparisons if it is significant. (Analysing log-transformed times with ANOVA is another reasonable option.)
Working on a thesis or paper?

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.