Statistics Glossary → One-Sample t-Test
One-Sample t-Testanalysis
A test of whether the mean of a sample truly differs from a pre-specified value (a target, a norm, or the value from an earlier study).
Concept
Sometimes we have a single group and a known value to compare it with: the weight printed on a package, the norm mean of a scale, a limit set in a regulation. The sample mean almost always differs a little from this value; the question is whether the difference can be explained by the randomness of sampling alone. The null hypothesis states that the population mean equals this value (H₀: μ = μ₀).
The test divides the difference between the sample mean and μ₀ by the standard error of the mean: t = (x̄ − μ₀) / (s/√n). This ratio is compared with a t distribution with n − 1 degrees of freedom to obtain the p value. If the confidence interval for the difference excludes 0, the difference is significant at the chosen confidence level. Cohen's d = (x̄ − μ₀) / s expresses the difference in standard-deviation units and gives an effect measure that does not depend on sample size.
The test assumes independent observations and an approximately normal variable. As the sample grows, the central limit theorem brings the distribution of the mean close to normal and the test becomes robust to non-normality; with small, skewed samples the result should be read with care. A significant p value does not mean the difference matters in practice; for that, the difference and the effect size are considered together.
When to use it
- When comparing the mean of a single group with a known target, norm or standard (e.g. package weight, a scale's norm score, a legal limit).
- To compare the means of two separate groups use the independent-samples t-test; to compare two measurements on the same people use the paired t-test.
- With a small sample and a clearly skewed distribution, the one-sample Wilcoxon signed-rank test, which compares the median with the target value, is preferred.
An everyday example
A consumer association wonders whether sugar packs labelled 1000 g really weigh that much, so it buys 25 packs at random from a supermarket and weighs them. The mean is 994 g with a standard deviation of 12 g. The one-sample t-test compares this 6-gram shortfall with the standard error (12/√25 = 2.4 g): t = −2.5, p ≈ 0.02. So the shortfall cannot be explained by the luck of which packs were picked; the 95% confidence interval for the difference runs from about 1 to 11 grams short.
Parameters in MerQur
Value Column (multi-select list) and Test value μ (μ₀) (default 0)
Concept: The test value μ₀ is the value the population mean is assumed to take under the null hypothesis. It comes from the research question, not from the data: it should be a target, a norm or a theoretical value.
Everyday example: For the sugar packs μ₀ = 1000 g, because that is what the label says. Entering the sample's own mean (994 g) as μ₀ would make the test meaningless; the difference would always be zero.
What it does: Sets the numeric column(s) to be tested and the population mean under the null hypothesis (H0: μ = μ₀); a separate result block is produced for each column.
Effect on the result: t = (M - μ₀)/SE, p, Cohen d = (M - μ₀)/SD, the mean difference and its CI change with μ₀; the CI of the mean, SD, SE and the descriptives do not.
On the validation data: In the time data (n = 20, mean 89.85, SD 19.1456) μ₀ = 80: t = 2.3008, p = 0.032898, CI of the difference [0.8896, 18.8104]; μ₀ = 100: t = -2.3709, p = 0.028475. The CI of the mean is [80.8896, 98.8104] in every case.
Confidence Level (%90, %95, %99, Other/custom 80.0-99.9)
Concept: The confidence level sets how 'sure' the intervals for the mean and the difference are; subtracting it from 1 gives the significance threshold α used for the decision.
Everyday example: With 95% confidence the packs can be said to be 1 to 11 grams short on average. If the association plans to go to court it may want 99% confidence; the interval widens, perhaps to include 0, and the evidence may be judged insufficient.
What it does: α = 1 - confidence level; sets the CI width and the decision threshold.
Effect on the result: The CIs of the mean and the difference, the CIs of d, the bootstrap CI, the one-sided CI, the decision (p < α) and TOST ((1 - 2α) CI) change; t and p do not. The custom value applies only when "Other" is selected.
On the validation data: For time, CI of the mean 90% [82.4474, 97.2526], 95% [80.8896, 98.8104], 99% [77.6021, 102.0979].
Hypothesis direction (Two-sided, Right-tailed, Left-tailed)
Concept: The direction of the hypothesis states whether the research question asks about any difference (two-sided) or only a difference in a particular direction (one-sided). A one-sided test detects a difference in that direction more easily but ignores a difference in the opposite direction entirely.
Everyday example: If the consumer association only cares whether packs are underweight, the question is left-sided: 'is the mean below 1000 g?'. If overweight packs also count as a problem, a two-sided question is asked. The direction must be chosen before weighing.
What it does: H1: μ ≠ μ₀, μ > μ₀ or μ < μ₀.
Effect on the result: The p value becomes one-tailed; an extra row gives the one-sided (1 - α) CI (one end infinite). The main CI and the d CI remain two-sided.
On the validation data: For time, right-tailed p = 0.016449, one-sided 95% CI [2.4474, ∞]; left-tailed p = 0.983551, [-∞, 17.2526].
Hedges g (checkbox)
Concept: A version of Cohen's d that corrects its tendency to slightly overstate the effect in small samples; as the sample grows it becomes almost identical to d.
Everyday example: If 25 packs give d = −0.50, Hedges' g comes out at about −0.48; the difference is small. Had only 6 packs been weighed, the correction would be more noticeable.
What it does: The small-sample bias correction of Cohen d, g = d·J (Hedges and Olkin, 1985).
Effect on the result: A "Hedges g" row is added to the effect size section.
On the validation data: For time, d = 0.5145, g = 0.4939. The correction factor uses the exact gamma form.
Normal-approximation CI for d (checkbox)
Concept: Cohen's d is itself an estimate from the sample and carries uncertainty; this option gives a confidence interval for d based on a normal approximation. The approximation works well in large samples.
Everyday example: d = −0.50 looks like a 'medium' shortfall. But with 25 packs the confidence interval is roughly [−0.9, −0.1]; the true effect could be small or large.
What it does: Gives the large-sample interval d ± z·√(1/n + d²/(2n)) (Hedges and Olkin, 1985).
Effect on the result: Extra row only.
On the validation data: For time, 95% [0.0481, 0.9808] (equals the manual formula); the noncentral t interval [0.0411, 0.9760] differs slightly (nct is preferred at small n).
d CI, noncentral t (checkbox)
Concept: Computes the confidence interval of d exactly from the noncentral t distribution instead of an approximate formula; in small samples it is more accurate than the normal approximation.
Everyday example: If only 10 packs were weighed, the normal-approximation interval may look narrower than it should. The noncentral-t method gives a more reliable interval here; with 200 packs the two methods give almost the same result.
What it does: Gives the exact confidence interval for d (Steiger and Fouladi, 1997).
Effect on the result: Extra row only.
On the validation data: For time, 95% [0.0411, 0.9760]; 99% [-0.1049, 1.1236].
Shapiro-Wilk (checkbox; default on)
Concept: Tests whether the values are normally distributed; if p < α the distribution departs clearly from normal. It is one of the most powerful normality tests in small and medium samples.
Everyday example: If pack weights come from the random fluctuation of the filling machine, they should be normal. If Shapiro-Wilk gives p = 0.60, the t-test can be trusted for 25 packs; if a few packs are badly underfilled and distort the distribution, the test flags it.
What it does: Tests the normality assumption.
Effect on the result: Extra row only; the row disappears when it is turned off.
On the validation data: For time, W = 0.9629, p = 0.6042.
Kolmogorov-Smirnov (checkbox)
Concept: Compares the cumulative distribution of the data with a normal distribution whose mean and standard deviation are taken from the sample. When the parameters are estimated from the same data, this classical version accepts normality too easily, so on its own it is not suitable for a normality decision.
Everyday example: For the pack weights, Kolmogorov-Smirnov might give p = 0.90 while Shapiro-Wilk gives p = 0.04. In such a conflict trust Shapiro-Wilk; part of the reason for the high K-S p value is that it takes its yardstick from the data themselves.
What it does: Tests the fit to a normal distribution with parameters estimated from the sample (no Lilliefors correction).
Effect on the result: Extra row only. Because the parameters come from the sample, this p is biased in favour of normality; Shapiro-Wilk or Lilliefors should be preferred for normality.
On the validation data: For time, D = 0.1300, p = 0.8458 (from the exact distribution).
Descriptives (checkbox; default on)
Concept: Gives the basic summary of the sample: count, mean, standard deviation, standard error, median, minimum and maximum, skewness and kurtosis. It shows the overall picture of the data before the test result is interpreted.
Everyday example: If the table shows that the lightest pack weighs 940 g, the association first checks whether that pack was torn. A median of 996 g against a mean of 994 g also suggests that a few light packs pull the mean down.
What it does: Gives n, mean, SD, SE, median, minimum, maximum, skewness and kurtosis.
Effect on the result: Extra table only.
On the validation data: For time, M = 89.85, SD = 19.1456, SE = 4.2811, median 92.5, minimum 43, maximum 121, skewness -0.708, kurtosis 0.664 (adjusted G1/G2).
Bootstrap CI (checkbox)
Concept: Obtains the confidence interval of the mean not from the t-distribution formula but by drawing thousands of new samples from the data with replacement and computing each one's mean; it needs no normality assumption.
Everyday example: The 25 pack weights are written on cards in a bag; 25 cards are drawn with replacement and their mean noted. Repeating this 5000 times, the range covered by the middle 95% of those means is the bootstrap confidence interval.
What it does: Gives the percentile bootstrap confidence interval of the mean (B = 5000, fixed seed 12345).
Effect on the result: Extra row only; the t-based interval does not change.
On the validation data: For time, 95% [81.5987, 97.7512]; t-based CI [80.8896, 98.8104]. Bootstrap limits can vary within the Monte Carlo error margin depending on resampling.
Equivalence test, TOST (checkbox; lower and upper bound, default -0.5 / 0.5)
Concept: Aims to show that the mean is practically 'equivalent' to the target rather than merely 'not different'. The range of negligible differences is set in advance, and two one-sided tests check that the difference lies significantly inside both limits.
Everyday example: If regulations allow a ±5 g tolerance on a 1000 g pack, the producer wants to show that the mean lies between 995 and 1005 g. A non-significant t-test does not prove this; TOST tests directly whether the difference lies within the ±5 g limits.
What it does: Schuirmann TOST: tests whether the difference M - μ₀ lies within the [lower, upper] bounds.
Effect on the result: TOST rows only. The bounds are ignored when TOST is off; if lower >= upper, the analysis stops with a warning.
On the validation data: For time with ±0.5: p_TOST = 0.9791 (not equivalent); with ±20: p_TOST = 0.0142, 90% CI [2.4474, 17.2526] within the bounds, equivalent.
Example on real data
Data: UCLA OARC hsb2 (High School and Beyond, n = 200)
Variables: value column write (writing score), μ₀ = 50
- Question: Does the students' mean writing score (n = 200) differ from the default test value μ₀ = 50?
- Assumption: Shapiro-Wilk W = 0.947, p = 9.87e-07; normality is violated, but with n = 200 the t-test is robust for the mean by the central limit theorem.
- Result: t(199) = 4.14, p < .001. The null hypothesis is rejected: the mean writing score (M = 52.78) is significantly higher than 50.
- Effect size: Cohen d = 0.29; the difference is statistically significant but the effect is small.
- Descriptive: The mean difference is 2.78 points (SE = 0.670), 95% CI of the difference [1.45, 4.10]; the interval does not contain 0.
- APA: t(199) = 4.14, p < .001, d = 0.29.
Related concepts
Equivalence test (TOST)Hedges' gCohen's d (effect size)Bootstrap (resampling)Kolmogorov-Smirnov test and Lilliefors correctionNoncentral t confidence intervalShapiro-Wilk testOne-sided and two-sided tests (hypothesis direction)
The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.