From a Benchmark to a Test Statistic
A one-sample t test asks whether the population mean of a quantitative variable is consistent with a stated benchmark. For example, a clinic might ask whether the mean waiting time for its patients differs from a service target. The calculation puts the observed sample mean and its uncertainty on a common scale, then asks how unusual the resulting statistic would be if the benchmark were the population mean.
The test uses the sample standard deviation because the population standard deviation is usually unknown. The statistic therefore follows a t distribution under the null hypothesis, provided the test’s sampling conditions are reasonable. The steps below focus on calculating each quantity and matching the p-value to the alternative hypothesis.
Model, Assumptions, and Tail Probabilities
Before calculating a test, identify the population mean \(\mu\), the benchmark \(\mu_0\), and the alternative hypothesis. The null hypothesis states \(\mu=\mu_0\). The alternative may be two-sided, \(H_a:\mu\ne\mu_0\), or directional, \(H_a:\mu>\mu_0\) or \(H_a:\mu<\mu_0\). The choice of alternative follows the research question and must be made before looking at the sample results.
The basic model is a random sample of independent observations from a population with mean \(\mu\) and standard deviation \(\sigma\). If the population is normal, then under \(H_0\) the statistic \(t\) has a t distribution with \(n-1\) degrees of freedom. For larger samples, the test can be reasonably robust to some departures from normality, but independence and the absence of severe outliers remain important. For small samples, the population should be approximately normal; a strongly skewed population or influential outlier can make the test unreliable.
The estimated standard error follows from the variability of a sample mean. For independent observations with common variance \(\sigma^2\), the variance of their mean is $$ \operatorname{Var}(\bar{x})=\operatorname{Var}\left(\frac{1}{n}\sum_{i=1}^{n}X_i\right) =\frac{1}{n^2}\sum_{i=1}^{n}\operatorname{Var}(X_i) =\frac{n\sigma^2}{n^2} =\frac{\sigma^2}{n}. $$ Thus the standard deviation of \(\bar{x}\) is \(\sigma/\sqrt{n}\). Because \(\sigma\) is unknown, the test estimates it with \(s\), giving \(SE=s/\sqrt{n}\). Under \(H_0\), the t statistic measures how many estimated standard errors separate \(\bar{x}\) from \(\mu_0\).
The p-value is calculated from the t distribution specified by the null model and the degrees of freedom. It is the probability, assuming \(H_0\) is true, of observing a test statistic at least as extreme in the direction or directions specified by \(H_a\). For an observed statistic \(t_{\text{obs}}\):
- For \(H_a:\mu>\mu_0\), the p-value is \(P(T\ge t_{\text{obs}})\).
- For \(H_a:\mu<\mu_0\), the p-value is \(P(T\le t_{\text{obs}})\).
- For \(H_a:\mu\ne\mu_0\), the p-value is \(P(|T|\ge |t_{\text{obs}}|)\), which doubles the probability in the more extreme tail because the t distribution is symmetric.
Here \(T\) denotes a random variable with a t distribution having \(df=n-1\). A numerical t-distribution calculation gives the p-value; the hand-worked parts are the sample summaries, standard error, statistic, degrees of freedom, and correct tail selection.
Worked Calculations
Worked Example: A Two-Sided Test With Six Observations
Suppose a hypothetical laboratory records six processing times, in minutes: \(11-2k,\ 11-k,\ 11-k,\ 11+k,\ 11+k,\ 11+2k\), where \(k=\sqrt{10/27}\approx0.6086\). Assume these are independent observations from a population that is approximately normal, with no data-collection issue that would invalidate the random-sample model. Test \(H_0:\mu=10\) minutes against \(H_a:\mu\ne10\) minutes.
The positive and negative deviations from 11 cancel, so \(\bar{x}=11\) minutes. Their squared deviations from the sample mean sum to $$ \sum(x_i-\bar{x})^2=(4+1+1+1+1+4)k^2 =12\left(\frac{10}{27}\right)=\frac{40}{9}. $$ Therefore, $$ s^2=\frac{40/9}{6-1}=\frac{8}{9},\qquad s=\sqrt{\frac{8}{9}}\approx0.9428\text{ minutes}. $$ The estimated standard error is $$ SE=\frac{s}{\sqrt{n}}=\frac{\sqrt{8/9}}{\sqrt{6}} =\sqrt{\frac{4}{27}}\approx0.3849\text{ minutes}. $$ The degrees of freedom are \(df=6-1=5\), and the observed statistic is $$ t=\frac{11-10}{0.3849}\approx2.598. $$ Because the alternative is two-sided, the p-value is the probability of a t statistic at least this far from zero in either direction: $$ p=P(|T|\ge2.598),\quad T\sim t(5),\qquad p\approx0.04837. $$ If the significance level is \(\alpha=0.05\), this p-value is slightly smaller than \(\alpha\), so the test provides evidence against the benchmark of 10 minutes in favor of a difference. The p-value does not give the probability that the null hypothesis is true.
Worked Example: A One-Sided Test for an Increase
In a hypothetical quality check, eight independently selected components have measured lifetimes, in hours: 9, 10, 10, 11, 11, 12, 12, and 13. Assume the sample is representative and independent, and that the population distribution is sufficiently close to normal for this small-sample test. Test whether the population mean exceeds the 10-hour benchmark: \(H_0:\mu=10\) versus \(H_a:\mu>10\).
The sum of the observations is 88 hours, giving $$ \bar{x}=\frac{88}{8}=11\text{ hours}. $$ The deviations from 11 are \(-2,-1,-1,0,0,1,1,2\), whose squared values sum to 12. Thus $$ s^2=\frac{12}{8-1}=\frac{12}{7},\qquad s=\sqrt{\frac{12}{7}}\approx1.309\text{ hours}. $$ The standard error is $$ SE=\frac{\sqrt{12/7}}{\sqrt{8}} =\sqrt{\frac{3}{14}}\approx0.4629\text{ hours}. $$ There are \(df=8-1=7\) degrees of freedom. The test statistic is $$ t=\frac{11-10}{0.4629}\approx2.160. $$ The sample mean is above the benchmark and the alternative is an increase, so the relevant probability is the upper-tail probability, not a two-sided probability: $$ p=P(T\ge2.160),\quad T\sim t(7),\qquad p\approx0.03380. $$ At \(\alpha=0.05\), the result is statistically significant in the stated direction. In context, the data provide evidence that the population mean lifetime exceeds 10 hours. They do not establish that every component lasts longer than 10 hours, nor do they show that the increase is practically important.
Worked Example: A Statistic at the Center of the Null Distribution
A hypothetical random sample of five independent readings, in milligrams, is 18, 20, 20, 20, and 22. Assume the population is approximately normal and the observations were collected without dependence. Test \(H_0:\mu=20\) against the two-sided alternative \(H_a:\mu\ne20\).
The sample mean is $$ \bar{x}=\frac{18+20+20+20+22}{5}=20\text{ mg}. $$ The squared deviations from the sample mean sum to \(4+0+0+0+4=8\), so $$ s^2=\frac{8}{5-1}=2,\qquad s=\sqrt{2}\approx1.414\text{ mg}. $$ Then \(SE=\sqrt{2}/\sqrt{5}=\sqrt{0.4}\approx0.6325\) mg and \(df=5-1=4\). The statistic is $$ t=\frac{20-20}{0.6325}=0. $$ For the two-sided test, every possible t value is at least zero units from zero, so \(P(|T|\ge0)=1\). The p-value is therefore 1. The sample mean exactly matches the benchmark; these data provide no evidence against \(H_0\). A p-value of 1 does not prove that the population mean equals 20 mg.
How to Keep the Calculation on Track
Write the benchmark \(\mu_0\) and the alternative direction before using the data to calculate a p-value.
Find \(\bar{x}\), then sum the squared deviations from \(\bar{x}\) and divide by \(n-1\) to obtain \(s^2\).
Use \(SE=s/\sqrt{n}\), then divide \(\bar{x}-\mu_0\) by \(SE\). Preserve the sign: it records which side of the benchmark the sample mean falls on.
Use \(df=n-1\), and take the tail probability or probabilities required by \(H_a\).
Compare the p-value with the prespecified \(\alpha\), then describe the evidence about the population mean in the units of the problem.
A common mistake is to double every one-sided p-value because the t distribution has two tails. That is incorrect: for \(H_a:\mu>\mu_0\), evidence in the opposite direction is not counted as equally extreme under the stated research question. A two-sided alternative counts both tails; a one-sided alternative counts only its specified tail. Another frequent error is dividing \(s\) by \(n\) instead of by \(\sqrt{n}\). The standard error is \(s/\sqrt{n}\), which estimates the variability of the sample mean, not the variability of individual observations.
Small p-values can be sensitive to assumptions and sample design. A correct arithmetic result cannot compensate for dependent observations, a biased sampling process, or a severe outlier in a small sample. Check that the observations represent independent sampling units, and assess whether the distributional conditions are plausible before treating the test as reliable. Statistical significance also does not measure the size or practical importance of a difference; the estimate \(\bar{x}-\mu_0\), in context and with its units, remains important.
Check Your Understanding
Use the definitions and calculation steps above to answer these questions.
- A sample has \(n=12\), \(\bar{x}=24\) minutes, and \(s=6\) minutes. For a test of \(\mu_0=21\) minutes, calculate \(SE\), \(t\), and \(df\).
- For the statistic in question 1, explain which tail probability is needed for \(H_a:\mu>21\), and which is needed for \(H_a:\mu\ne21\).
- Why does a one-sample t test use \(s/\sqrt{n}\) rather than \(s/n\) as its estimated standard error?
- A student obtains a positive t statistic for a test with \(H_a:\mu<\mu_0\). Which tail contains the p-value, and why?
- State two features of a small sample that could make the one-sample t test unreliable.