Skip to content
Omnikalc

One-sample t-test: does the mean differ from a reference value?

Test a sample mean against a reference value, or paired data through the mean and SD of the differences: t, p-value, critical value and confidence interval.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Results

p-value

0.2234

Not significant: p is at or above α, so the data do not reject the null hypothesis
t statistic
1.250
Degrees of freedom
24
Critical t for this test
2.064
Standard error of the mean
2.4000
Confidence interval of the mean, lower bound (1 − α)
98.047
Confidence interval of the mean, upper bound
107.953
Effect size, Cohen's d
0.250

What the one-sample t-test does

The one-sample t-test checks whether a sample mean differs from a reference value μ₀: a specification, a historical average or a theoretical value. With the same calculation, the paired t-test compares two measurements on the same subjects (before and after, left and right) by testing whether the mean of the differences is zero.

The formula

t = (x̄ − μ₀) ÷ (s ÷ √n), with n − 1 degrees of freedom

where x̄ is the sample mean, s the sample standard deviation and n the sample size. The quantity s ÷ √n is the standard error of the mean.

Example

A filling machine should deliver 100 g. A sample of 25 packs has a mean of 103 g and an SD of 12 g:

  • standard error: 12 ÷ 5 = 2.4 g;
  • t = 3 ÷ 2.4 = 1.25 with 24 degrees of freedom;
  • two-tailed p ≈ 0.22: not significant at α = 0.05;
  • 95% confidence interval of the mean: 103 ± 2.064 × 2.4, about 98.0 to 108.0 g, which includes 100.

Paired data

For paired measurements, compute the difference for each pair (after − before), then enter:

  • the mean of the differences as the sample mean;
  • the SD of the differences as the standard deviation;
  • the number of pairs as n;
  • 0 as the reference value.

Pairing removes the variation between subjects, which often makes the test far more sensitive than comparing two independent groups.

Reading the result

  • p below α: the mean differs significantly from the reference value.
  • p at or above α: the data are compatible with the reference value, which is not the same as proving it.
  • The confidence interval gives the range of plausible true means; when it excludes μ₀, the two-tailed test is significant at the same α.

Effect size

Cohen’s d = (x̄ − μ₀) ÷ s expresses the difference in standard deviations. Around 0.2 is often called small, 0.5 medium and 0.8 large. With large samples, tiny differences become significant, so always look at the size of the effect too.

Assumptions

The observations should be independent and roughly normally distributed, or the sample large enough (often 30 or more). Outliers can distort both the mean and the SD: check the data before testing. For clearly non-normal small samples, the Wilcoxon signed-rank test is an alternative.

Frequently asked questions

How do I run a paired t-test here?

Compute each pair's difference, then enter the mean and SD of the differences, the number of pairs and a reference value of 0.

What is the standard error of the mean?

The sample standard deviation divided by the square root of the sample size; it measures how precisely the mean is estimated.

How many degrees of freedom does a one-sample t-test have?

n − 1, where n is the number of observations (or pairs).

When should I use a z-test instead?

Only when the population standard deviation is truly known. With an estimated SD, the t-test is correct.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.