LabCanvas
Free account · save your work, full figure editorSign up free

Which statistical test should I use?

Answer a few questions about your experiment: what you want to do (compare groups, relate two variables, predict an outcome or compare survival), what kind of data you measured, how many groups, whether they are independent or paired, whether the data look normal and how large the sample is. The guide recommends the test, explains why, lists its assumptions and gives the non-parametric (or parametric) alternative. It covers t-tests, Mann–Whitney, Wilcoxon signed-rank, one-way and repeated-measures ANOVA, Kruskal–Wallis, Friedman, chi-square, Fisher’s exact, McNemar, Pearson and Spearman correlation, linear and logistic regression and the log-rank test, with a full table below.

What it does
Recommends a statistical test from your answers about the goal, outcome type, number of groups, pairing, normality and sample size, with the reason, assumptions and alternative.
Formula
2 groups: Welch t (normal) or Mann–Whitney (not); paired: paired t or Wilcoxon; 3+ groups: ANOVA or Kruskal–Wallis (paired: repeated-measures ANOVA or Friedman); counts: χ² (expected ≥ 5) or Fisher’s exact; paired yes/no: McNemar.
Example
Comparing tumour volume between 2 independent groups of 8 mice, not normally distributed → Mann–Whitney U test (e.g. U = 63 of 64, exact p = 0.00031 for the box plot maker’s example).

Last updated

FreeNo sign-upRuns in your browserData analysis

Loading Statistical test chooser…

At a glance

Statistical test chooser at a glance
QuestionsGoal, outcome type, number of groups, independent or paired, normality, sample size
Tests covered17: t-tests, Mann–Whitney, Wilcoxon, ANOVA, repeated-measures ANOVA, Kruskal–Wallis, Friedman, χ2, Fisher, McNemar, Cochran’s Q, Pearson, Spearman, linear and logistic regression, log-rank
GivesThe test, why, its assumptions, the alternative and an example
Run the testBox plot maker (2–k group tests) or the LabCanvas Graphs app (all except Cochran’s Q)
Runs inYour web browser; nothing is uploaded
PriceFree, no account needed

What it does

How to use the statistical test chooser

  1. Say what you want to doCompare groups, relate two variables, predict an outcome or compare survival curves.
  2. Describe the dataPick the outcome type, the number of groups, independent or paired, and whether the data look normal and how many values you have.
  3. Read the recommendationRead the test, why it fits, its assumptions and the alternative, then run it on your data in the box plot maker or the Graphs app.

How it works

The guide applies the standard decision rules taught in biostatistics courses. Four things decide the test:

  • The type of outcome. A continuous measurement (volume, concentration) can use tests of means; scores and ranks (ordinal) need rank-based tests; categories and yes/no outcomes are counts and need tests on contingency tables.
  • How many groups. Two groups use a t-test or its rank equivalent; three or more need one overall test (ANOVA, Kruskal–Wallis) followed by post hoc comparisons, because running every pairwise t-test inflates the false-positive rate.
  • Independent or paired. Measurements on the same subjects (before/after, time points, matched pairs) are correlated, and paired tests use the within-subject differences, which is usually more powerful.
  • Normality and sample size. Tests of means assume roughly normal data in each group. With about 30 or more per group they are robust to moderate skew (central limit theorem); with small, skewed samples or outliers, rank-based tests are safer. Check with a histogram or Q–Q plot; a Shapiro–Wilk test (Shapiro and Wilk 1965) has little power in small samples and flags trivial departures in large ones, so it should not decide alone.

For two independent groups the guide recommends Welch’s t-test rather than Student’s, because it does not assume equal variances and loses little when they are equal (Welch 1947; Delacre et al. 2017). For counts it recommends Fisher’s exact test when any expected count is below 5 and the χ2 test otherwise. The rank tests are those of Wilcoxon (1945), Mann and Whitney (1947), Kruskal and Wallis (1952) and Friedman (1937); paired proportions use McNemar’s test (1947); survival curves use the log-rank test (Mantel 1966).

Sources: Welch BL. Biometrika 1947;34:28–35, doi:10.1093/biomet/34.1-2.28. Delacre M, Lakens D, Leys C. Why psychologists should by default use Welch’s t-test instead of Student’s t-test. Int Rev Soc Psychol 2017;30:92–101, doi:10.5334/irsp.82. Wilcoxon F. Individual comparisons by ranking methods. Biometrics Bull 1945;1:80–83, doi:10.2307/3001968. Mann HB, Whitney DR. Ann Math Stat 1947;18:50–60, doi:10.1214/aoms/1177730491. Kruskal WH, Wallis WA. J Am Stat Assoc 1952;47:583–621, doi:10.1080/01621459.1952.10483441. Friedman M. The use of ranks to avoid the assumption of normality implicit in the analysis of variance. J Am Stat Assoc 1937;32:675–701. McNemar Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 1947;12:153–157, doi:10.1007/BF02295996. Mantel N. Evaluation of survival data and two new rank order statistics arising in its consideration. Cancer Chemother Rep 1966;50:163–170, PMID 5910392. Shapiro SS, Wilk MB. An analysis of variance test for normality (complete samples). Biometrika 1965;52:591–611, doi:10.1093/biomet/52.3-4.591.

Examples and the full table of tests

Five common lab questions and the test the guide recommends:

  1. Tumour volume in 2 independent groups of 8 mice, skewed with one large tumour. Compare groups → continuous → 2 groups → independent → not normal → small: Mann–Whitney U test. In the box plot maker’s example (vehicle vs Drug A), U=63 of a possible 64, exact p=0.00031; Welch’s t-test on the same data gives p=0.0014.
  2. Cell viability under 3 doses and a vehicle, triplicate wells, roughly normal. 3 or more groups, independent, normal: one-way ANOVA, followed by Dunnett’s test against the vehicle or Tukey’s test for all pairs.
  3. Blood glucose of the same 8 rats at 0, 30, 60 and 120 min. 3 or more conditions, paired: repeated-measures ANOVA if the values are roughly normal, otherwise the Friedman test.
  4. Tumours in 2 of 9 treated and 7 of 10 control mice. Categorical outcome, independent, small counts: Fisher’s exact test, since several expected counts are below 5.
  5. Survival of mice on drug vs vehicle over 60 days, some still alive at the end. Survival: log-rank test on Kaplan–Meier curves.
The decision in one table (continuous or ordinal outcome)
Independent, normalIndependent, not normal / ordinalPaired, normalPaired, not normal / ordinal
2 groupsUnpaired (Welch’s) t-testMann–Whitney UPaired t-testWilcoxon signed-rank
3 or more groupsOne-way ANOVAKruskal–WallisRepeated-measures ANOVAFriedman
Categorical outcome (counts)
Independent groupsPaired
Expected counts ≥5Chi-square testMcNemar (2 conditions), Cochran’s Q (3 or more)
Small countsFisher’s exact testExact McNemar (binomial)
Statistical tests: when to use each, assumptions and alternatives
TestUse it toAssumptionsAlternativeExampleRun it in
Unpaired t-test (Welch's)Compare the means of 2 independent groups of a continuous, roughly normal measurement.Independent observations; each group roughly normal (or n ≳ 30 per group). Welch’s version does not assume equal variances.Mann–Whitney U testBody weight of 10 knockout vs 10 wild-type mice.Box plot maker, Graphs app
Paired t-testCompare 2 measurements on the same subjects (before/after, left/right, matched pairs).The paired differences are roughly normal; pairs are independent of each other.Wilcoxon signed-rank testBlood pressure of 12 patients before and after treatment.Graphs app
Mann–Whitney U test (Wilcoxon rank-sum)Compare 2 independent groups when the data are ordinal, skewed or have outliers.Independent observations; the outcome can be ranked. Tests whether values in one group tend to be larger; it compares medians only if the two distributions have the same shape.Unpaired t-testTumour volume in 8 treated vs 8 control mice, skewed.Box plot maker, Graphs app
Wilcoxon signed-rank testCompare 2 paired measurements when the differences are not normal, or the data are ordinal.Paired data; differences can be ranked and are roughly symmetric around their median.Paired t-testPain score (0–10) of 15 patients before and after a drug.Graphs app
One-way ANOVACompare the means of 3 or more independent groups of a continuous, roughly normal measurement.Independent observations; each group roughly normal; similar variances (otherwise Welch’s ANOVA). Follow with Tukey’s or Dunnett’s post hoc test.Kruskal–Wallis testCell viability with 3 drug doses and a vehicle control.Box plot maker, Graphs app
Repeated-measures ANOVACompare 3 or more measurements on the same subjects (time points or conditions).Differences roughly normal; sphericity (equal variances of all pairwise differences; else Greenhouse–Geisser correction). A mixed model handles missing values.Friedman testGlucose in 8 rats at 0, 30, 60 and 120 min.Graphs app
Kruskal–Wallis testCompare 3 or more independent groups when the data are ordinal, skewed or have outliers.Independent observations; the outcome can be ranked; groups of similar shape to compare medians. Follow with Dunn’s test.One-way ANOVAHistology score (0–4) in 4 treatment groups.Box plot maker, Graphs app
Friedman testCompare 3 or more paired or repeated measurements when they are not normal or are ordinal.Each subject measured under every condition; values can be ranked within each subject.Repeated-measures ANOVARatings of 4 formulations by the same 10 tasters.Graphs app
Chi-square test (χ²) of independenceCompare proportions or categories between independent groups (a contingency table of counts).Independent observations; counts, not percentages; expected count ≥ 5 in at least 80% of cells and none below 1.Fisher’s exact test (small counts)Responders vs non-responders in 60 treated and 60 control patients.Graphs app
Fisher’s exact testCompare proportions between independent groups when counts are small (2 × 2 table, any expected count < 5).Independent observations; counts. Exact, so valid at any sample size.Chi-square test (large counts)Tumours in 2 of 9 treated vs 7 of 10 control mice.Graphs app
McNemar’s testCompare a yes/no outcome measured twice on the same subjects (paired proportions).Paired binary data; uses only the discordant pairs (exact binomial version when they are few).Cochran’s Q for 3 or more time pointsPositive/negative by two diagnostic tests on the same 50 samples.Graphs app
Cochran’s Q testCompare a yes/no outcome across 3 or more paired conditions.Binary outcome; every subject measured in every condition.McNemar’s test for 2 conditionsWhether each of 20 patients responds to 3 different drugs.—
Pearson correlation (r)Measure the strength of a linear relation between two continuous variables.Linear relation; both variables roughly normal (for the p-value); no strong outliers.Spearman rank correlationProtein concentration vs absorbance.Graphs app
Spearman rank correlation (ρ)Measure a monotonic relation when data are ordinal, skewed or have outliers.Monotonic (always rising or always falling) relation; values can be ranked.Pearson correlationTumour grade vs expression of a marker.Graphs app
Linear regressionPredict or explain a continuous outcome from one or more predictors.Linear relation; independent, normally distributed residuals with constant variance.Rank-based or robust regression; transform the outcomeEnzyme activity against temperature and pH.Graphs app
Logistic regressionPredict or explain a yes/no outcome from one or more predictors (gives odds ratios).Independent observations; a linear relation between predictors and the log-odds; about 10 events per predictor.Fisher’s exact or chi-square test for a single categorical predictorDisease (yes/no) against age, sex and a biomarker.Graphs app
Log-rank test (Kaplan–Meier)Compare survival (time-to-event) curves between 2 or more groups, with censored data.Censoring unrelated to outcome; proportional hazards for best power. For covariates use Cox regression.Gehan–Breslow–Wilcoxon test (weights early events)Survival of mice on drug vs vehicle over 60 days.Graphs app

Frequently asked questions

Which statistical test should I use to compare two groups?

For a continuous measurement in two independent groups, use Welch’s unpaired t-test if the data are roughly normal (or each group has about 30 or more values), and the Mann–Whitney U test if they are skewed, ordinal or have outliers. For the same subjects measured twice, use the paired t-test or the Wilcoxon signed-rank test.

Which test do I use for more than two groups?

One-way ANOVA for roughly normal data in independent groups, Kruskal–Wallis otherwise; for repeated measurements on the same subjects, repeated-measures ANOVA or the Friedman test. Follow a significant result with post hoc tests (Tukey, Dunnett or Dunn) rather than separate t-tests.

How do I know if my data are normally distributed?

Look at a histogram, box plot or Q–Q plot of each group. Concentrations, volumes, counts and times are often right-skewed and become normal after a log transform. Normality tests such as Shapiro–Wilk are weak with small samples and over-sensitive with large ones, so use them only as a guide.

When should I use a non-parametric test?

When the outcome is ordinal (scores, grades), or when the data are clearly skewed or have outliers and the groups are small (under about 30). Non-parametric tests compare ranks, so they are robust but somewhat less powerful when the data really are normal.

What is the difference between paired and unpaired tests?

Unpaired tests compare different subjects in each group. Paired tests are for the same subjects measured under each condition (before/after, left/right) or matched pairs; they analyse the differences within each subject, which removes between-subject variation.

Chi-square or Fisher’s exact test?

Both test whether proportions differ between groups. Use chi-square when every expected count is at least 5 (at least 80% of cells ≥5 and none below 1 for larger tables), and Fisher’s exact test when counts are smaller; Fisher’s is valid at any size.

Can I use a t-test with a small sample, like n = 3?

Yes, if the data are plausibly normal, as replicate measurements often are; the t-test was designed for small samples. With n=3 you cannot check normality, and a Mann–Whitney test cannot reach p<0.05 with 3 per group (the smallest exact two-sided p is 0.1), so rank tests are not a fix for tiny samples.

Which test for correlation: Pearson or Spearman?

Pearson’s r for a linear relation between two roughly normal continuous variables; Spearman’s ρ for ordinal data, skewed data, outliers or a monotonic but curved relation. Plot the data first.

Run the test on your data

The LabCanvas Graphs app runs the tests in this guide, from t-tests to log-rank and logistic regression, and draws the graph with the p-values for your paper.

Open the Graphs app