One-sample t-test
Means (parametric) · One sample · reference distribution: t(n−1)
When to use it
Compare the mean of a sample with a reference value when the population standard deviation is unknown.
Null hypothesis
The population mean equals the reference value: μ = μ₀.
Assumptions
- Independent observations
- Approximately normal data, or large n (≳ 30)
Test statistic
t = \dfrac{\bar{x} - \mu_0}{s / \sqrt{n}}Effect size
Cohen’s d: the difference in standard deviations. Usual benchmarks: 0.2 small, 0.5 medium and 0.8 large.
d = \dfrac{\bar{x} - \mu_0}{s}How to report it
t(24) = 2.31, p = .030, d = 0.46
In R and Python
R
t.test(x, mu = 50)
Python
stats.ttest_1samp(x, popmean=50)
In Python, stats is scipy.stats and np is numpy.
Variants and alternatives
- Z-test, when σ is known
- Sign test, without assuming normality
Where it sits in the catalog
Means (parametric). Parametric tests assume a model for the data, usually the normal distribution, and compare its parameters, such as the mean. When the assumption holds, they are the most powerful.
One sample. A single group compared with a reference value set in advance, such as a target or a standard.
In the decision tree
- What do you want to do? Compare groups, or one group with a reference value
- What kind of response did you measure? Numeric: a measurement, such as weight, time or score
- How many groups or measurements? One group, against a reference value
- Are the data approximately normal, or is the sample large (n ≳ 30)? Yes