Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Common Statistical Tests Are Linear Models

UCSD Psychology

For theoretical background, see Jonas Kristoffer Lindeløv’s Common statistical tests are linear models.

Parametric Tests

Classical Testbossanova CodeTutorial
One-sample t-testmodel("y ~ 1", df)One-Sample
Paired t-testmodel("y ~ condition + (1|subject)", df)Within-Subject
Independent t-testmodel("y ~ group", df)Two-Sample
Welch’s t-testmodel("y ~ group", df).infer(errors="unequal_var")Two-Sample
Pearson correlationmodel("zscore(y) ~ zscore(x)", df) (slope = r)Correlation
One-way ANOVAmodel("y ~ group", df).infer("joint").effectsANOVA
Welch’s ANOVAmodel("y ~ group", df).infer("joint").infer(errors="unequal_var").effectsANOVA
Two-way ANOVAmodel("y ~ a * b", df).infer("joint").effectsANOVA
ANCOVAmodel("y ~ group + covariate", df)ANOVA
RM-ANOVAmodel("y ~ condition + (1|subject)", df)Within-Subject

Rank-Based (Non-Parametric) Tests

Classical Testbossanova CodeTutorial
Wilcoxon signed-rankmodel("signed_rank(y) ~ 1", df)One-Sample
Wilcoxon signed-rank (paired)model("rank(y) ~ condition + (1|subject)", df)Within-Subject
Mann-Whitney Umodel("rank(y) ~ group", df)Two-Sample
Kruskal-Wallismodel("rank(y) ~ group", df).infer("joint").effectsANOVA
Spearman correlationmodel("zscore(rank(y)) ~ zscore(rank(x))", df)Correlation
Friedman testmodel("rank(y) ~ condition + (1|subject)", df)Within-Subject

Count Data (GLM)

Classical Testbossanova CodeTutorial
Chi-square goodness of fitmodel("count ~ category", df, family="poisson")Count Data
Chi-square independencemodel("count ~ row * col", df, family="poisson") (test interaction)Count Data

Robust Inference

Scenariobossanova ApproachTutorial
Unequal group variancesmodel(...).infer(errors="unequal_var")Heteroscedastic Errors
Arbitrary heteroscedasticitymodel(...).infer(errors="hetero")Heteroscedastic Errors
Heavy-tailed / outliersmodel(..., family="tdist")Heteroscedastic Errors
Welch + covariatesmodel("y ~ group + x", df).infer(errors="unequal_var")Heteroscedastic Errors