Which Statistical Test Should I Use?

A decision tree for common psychology analyses — t-tests, ANOVA, regression, moderation, mediation, and linear mixed models — with ready-to-use R code.

Quick-reference cheat sheet (click to expand)
TestUse when…Main R function
Independent samples t-testCompare means of 2 independent groupst.test()
Paired samples t-testCompare means of 2 related/repeated conditionst.test(paired = TRUE)
One-way ANOVACompare means across 3+ independent groups, 1 factoraov()
ANCOVACompare group means while controlling for a continuous covariateaov(y ~ group + covariate)
Factorial (two-way) ANOVACompare means across groups defined by 2+ factorsaov(y ~ A * B)
Repeated-measures ANOVACompare 3+ within-subject conditions (simple, balanced design)afex::aov_ez()
Simple linear regressionPredict a continuous outcome from 1 predictorlm()
Multiple linear regressionPredict a continuous outcome from 2+ predictorslm()
Logistic regressionPredict a binary outcome from 1+ predictorsglm(family = binomial)
ModerationTest if a third variable changes the strength/direction of a relationshiplm(y ~ x * w)
MediationTest if a third variable explains the mechanism linking two variablesmediation::mediate()
Linear mixed modelRepeated/nested/clustered/unbalanced data with random effectslme4::lmer()
R code quick reference — all tests in one place (click to expand)