The One-Sample t-Test
The One-Sample t-Test
Question: Is there a significant difference between the mean of your sample and a known benchmark?
Use it when: You have one group and want to compare its mean to a fixed value.
Hypotheses:
- : The sample mean equals the benchmark.
- : The sample mean differs from the benchmark.
Test statistic:
where is the sample mean, is the benchmark, is the sample standard deviation, and is the sample size.
In Python: scipy.stats.ttest_1samp(sample, popmean=benchmark)
One-Sample t-Test
Choose a scenario
Adjust inputs
Sample mean (x̄)4.7
Std dev (s)0.3
Sample size (n)100
Benchmark (μ₀)4.5
t-Distribution (df = 99)
Shaded tails = p-value region. Orange marker = t-statistic.
Results
Standard error
0.0300
t-statistic
6.667
Degrees of freedom
99
p-value (two-tailed)
< 0.001
Interpretation (α = 0.05)
p = < 0.001 < 0.05 — reject H₀. The sample mean (4.7) differs significantly from the benchmark (4.5).
Step-by-step
1. SE = s / √n = 0.3 / √100 = 0.0300
2. t = (x̄ − μ₀) / SE = (4.7 − 4.5) / 0.0300 = 6.667
3. df = n − 1 = 100 − 1 = 99
4. p = < 0.001 (significant at α = 0.05)
p-value region (shaded tails)t = observed t-statistic−t = mirror (two-tailed)
Enter sample statistics (mean, SD, n). Compute the t-statistic and p-value, and see where the statistic falls on the t-distribution.