Research skills

How to choose the right statistical test

A simple decision guide based on your question, the type of data, the number of groups and whether the data are paired.

Choosing a statistical test looks hard, but a few questions lead you to the right family of tests. Ask them in order: what is my question, what type of data do I have, how many groups, and are the groups independent or paired?

Ask these questions

  1. What do I want to know? Compare groups, find a relationship, or predict?
  2. What type is my outcome? Numerical (such as weight or pH) or categorical (such as pass or fail)?
  3. How many groups or conditions am I comparing? Two, or three and more?
  4. Are the groups independent (different samples) or paired (the same samples measured twice)?
  5. Are numerical data roughly normally distributed, and is the sample size large enough? If not, use a non-parametric test.

Decision guide

QuestionData and designUsual testIf assumptions fail
Compare 2 groupsNumerical, independent groupsIndependent t-testMann-Whitney U test
Compare 2 conditionsNumerical, paired dataPaired t-testWilcoxon signed-rank test
Compare 3 or more groupsNumerical, independent groupsOne-way ANOVA (then a post-hoc test)Kruskal-Wallis test
Compare 3 or more conditionsNumerical, repeated measuresRepeated-measures ANOVAFriedman test
Compare proportionsTwo categorical variablesChi-square testFisher's exact test (small counts)
Relationship between 2 variablesTwo numerical variablesPearson correlationSpearman correlation
Predict one variable from othersNumerical outcomeLinear regressionTransform data or use a suitable model

Good habits

  • Look at your data with a chart before testing.
  • Decide the test and the significance level before looking at the results.
  • Report the effect size and a confidence interval, not only the p-value. A small p-value does not mean a large or important effect.
  • Do not run many tests until one is significant. If you compare many groups, use an appropriate method for multiple comparisons.
  • Use software such as Excel, SPSS, R or Jamovi, and keep your steps recorded.

Example

You measure the moisture of bread from two ovens, with 10 loaves each. The data are numerical, there are two independent groups, and the values look roughly normal. Use an independent t-test.

Key points

  • Choose the test from the question, the data type, the number of groups and the design.
  • Paired and independent data need different tests.
  • Check assumptions, and use a non-parametric test if they fail.
  • Report effect size and confidence intervals, not only p-values.

Frequently asked questions

What does the p-value mean?

It is the probability of seeing a result at least as extreme as yours if there were really no effect. It does not tell you the size or importance of the effect.

How do I check if data are normal?

Look at a histogram or Q-Q plot, and use a test such as Shapiro-Wilk. With small samples, be careful, and use a non-parametric test if in doubt.

When should I use a non-parametric test?

When data are clearly not normal, are ranks or scores, or the sample is very small and the assumptions cannot be checked.

Written by Dr. Mokhtar Harb Abdelkhalek, PhD

Associate Professor of Food Science and Technology, Food Technology Research Institute (FTRI), Agricultural Research Center, Egypt. Food safety consultant and instructor.

About the author

This lesson is for education. Always follow the food law and the requirements of your own country, authority or customer.

Want to go deeper?

Take the full course with video lessons, forms and exercises.

Related lessons

Research skills

How to structure a scientific research paper (IMRaD)

Introduction, Methods, Results and Discussion: what goes in each section and the best order to write them.

6 min read
Read the lesson
Food safety

What is HACCP? The 7 principles explained simply

HACCP is a way to prevent food safety problems before they happen. Learn the 7 principles with a simple example.

6 min read
Read the lesson
Food safety

The temperature danger zone: safe cooking, cooling, holding and storage

Bacteria multiply fastest between 5 °C and 60 °C. Learn the temperatures and times that keep food safe.

5 min read
Read the lesson