Statistical Tests and Assumptions in R: Which Test Should I Use?

A decision guide — match your research question to the right statistical test, know the assumptions behind it, and switch to a non-parametric test when they fail

Biostatistics

A decision guide to choosing the right statistical test in R. Match your research question (correlation, comparing two or more groups, comparing variances) to the correct parametric test, understand the normality and equal-variance assumptions behind it, learn how to check them, and know which non-parametric test to use when they are violated — with links to a worked lesson for each.

Published

June 23, 2026

Modified

July 7, 2026

TipKey takeaways
  • The right test depends on your research question and the type and number of groups — match them first, then check the assumptions.
  • Parametric tests (correlation, t-test, ANOVA) assume the data are normally distributed and the groups have equal variances; their validity depends on those assumptions.
  • Check before you test: assess normality (Shapiro-Wilk + Q-Q) and equal variance (Levene’s test).
  • When the assumptions are violated, use the non-parametric counterpart (Wilcoxon, Kruskal-Wallis, Friedman) — or transform the data.
  • With large samples (n > 30) the central limit theorem makes parametric tests robust to mild non-normality.

Introduction

Choosing a statistical test comes down to two questions: what are you asking? and does your data meet the test’s assumptions? This guide maps the most common research questions to the right test, explains the assumptions behind the parametric tests, and points to the non-parametric fallback when those assumptions fail — with a worked, runnable lesson behind every link.

Match your question to a test

The most common research questions and their tests:

Your question Parametric test Non-parametric alternative
Are two variables correlated? Correlation test (Pearson) Correlation test (Spearman/Kendall)
Are several variables correlated? Correlation matrix / correlogram
Do two groups differ? t-test Wilcoxon test · sign test
Do more than two groups differ? ANOVA Kruskal-Wallis (independent) · Friedman (repeated)
Do the variances differ? F-test / Bartlett / Levene Fligner-Killeen
Compare proportions? Proportion z-test exact binomial test

For comparing groups, the next branch is how many factors and between- vs within-subjects: one factor → one-way ANOVA; two → two-way; repeated measures → repeated-measures or mixed ANOVA; with a covariate → ANCOVA; several outcomes → MANOVA.

The assumptions behind parametric tests

Correlation, the t-test and ANOVA are parametric — their p-values are trustworthy only when the data behave as the test assumes. The two key assumptions are:

  1. Normality — the outcome (or the model residuals) is approximately normally distributed.
  2. Homogeneity of variance — the groups being compared share a common variance.

Take these seriously: a parametric test on data that badly violate them can give a misleading conclusion.

Check before you compute

Before running a parametric test, run the preliminary checks. Here is the pattern — summarise, then test normality — on the built-in ToothGrowth data:

library(rstatix)

ToothGrowth %>%
  group_by(supp) %>%
  shapiro_test(len)
# A tibble: 2 × 4
  supp  variable statistic      p
  <fct> <chr>        <dbl>  <dbl>
1 OJ    len          0.918 0.0236
2 VC    len          0.966 0.428 

VC is clearly normal (p = 0.43), while OJ shows a mild deviation (p = 0.024). With only ~30 observations per group and a borderline p-value, this is exactly the case to inspect the Q-Q plot and use judgement rather than reject normality outright — Shapiro-Wilk is sensitive, and at this sample size the central limit theorem makes the t-test fairly robust. See the dedicated lessons for the full workflow: normality (Shapiro-Wilk + Q-Q) and homogeneity of variance (Levene’s test).

Tip

Large samples relax normality. With more than ~30 observations per group, the central limit theorem means parametric tests cope well with mild non-normality — the Shapiro-Wilk test also becomes oversensitive at large n, so lean on the Q-Q plot and your judgement rather than the p-value alone.

When assumptions fail

If normality or equal variance is clearly violated, you have three routes:

  • Switch to a non-parametric testWilcoxon (two groups), Kruskal-Wallis (several independent) or Friedman (several repeated). These work on ranks and assume no particular distribution.
  • Use a robust variant — the Welch t-test/ANOVA when variances are unequal.
  • Transform the data — a log or square-root transformation can restore normality so the parametric test applies.

Try it live

Check the assumptions on a dataset, then decide. The sandbox boots on first Run.

🟢 With an AI agent

Ask Prova “here’s my data and my question — which statistical test should I use, what assumptions does it need, and how do I check them?” — it answers with rstatix code you can run on your own data and walks you to the right test. The runtime is the judge. Ask Prova →

Frequently asked questions

Match your question to the test: correlation for associations between variables; the t-test (or Wilcoxon) for two groups; ANOVA (or Kruskal-Wallis) for several groups; a variance test for spread; a proportion test for rates. Then choose the parametric version if the normality and equal-variance assumptions hold, or the non-parametric version if they don’t.

A parametric test (t-test, ANOVA, Pearson correlation) assumes the data follow a particular distribution — usually normal — and tests parameters like the mean. A non-parametric test (Wilcoxon, Kruskal-Wallis, Friedman, Spearman) works on ranks and makes no distributional assumption, so it is used when the parametric assumptions fail, at some cost in power.

Mainly two: the outcome (or the model residuals) is approximately normally distributed, and the groups being compared have equal variances (homogeneity of variance). Observations are also assumed to be independent. Check normality with Shapiro-Wilk + a Q-Q plot and equal variance with Levene’s test before trusting the result.

You have three options: use the non-parametric counterpart of your test (Wilcoxon, Kruskal-Wallis, Friedman); use a robust variant (Welch); or transform the data (log, square-root) to restore normality. With large samples (n > 30) the central limit theorem often makes the parametric test acceptable anyway.

Conclusion

Choosing a statistical test is a two-step decision: match the test to your research question (how many variables or groups, and what you’re comparing), then verify its assumptions — normality and equal variance for the parametric tests. When the assumptions hold, the parametric test (t-test, ANOVA, correlation) is the most powerful choice; when they don’t, switch to the non-parametric counterpart or transform the data. Each test linked above has a full, runnable lesson to take you from question to reported result.

Reuse

Citation

BibTeX citation:
@online{2026,
  author = {},
  title = {Statistical {Tests} and {Assumptions} in {R:} {Which} {Test}
    {Should} {I} {Use?}},
  date = {2026-06-23},
  url = {https://www.datanovia.com/learn/biostatistics/assumptions/statistical-tests-and-assumptions},
  langid = {en}
}
For attribution, please cite this work as:
“Statistical Tests and Assumptions in R: Which Test Should I Use?” 2026. June 23. https://www.datanovia.com/learn/biostatistics/assumptions/statistical-tests-and-assumptions.