Why Degrees of Freedom Matter
A one-sample t test compares a sample mean with a hypothesized population mean while estimating the population standard deviation from the same sample. That estimate affects the reference distribution used to judge the test statistic. The reference distribution is not chosen by sample size alone: it is a t distribution whose degrees of freedom are \(n-1\).
This one-degree reduction has a direct explanation. Once the sample mean has been calculated, the deviations of the observations from that mean cannot vary freely: they must add to zero. The restriction leaves \(n-1\) independent pieces of information for estimating variability. A more formal argument shows that, under a normal-population model, the resulting standardized statistic has exactly a t distribution with \(n-1\) degrees of freedom.
From Residuals to \(n-1\)
Let the observed values be \(x_1,\ldots,x_n\), and let their sample mean be \(\bar{x}\). The residual for observation \(i\) is its deviation from the sample mean, \(x_i-\bar{x}\). By the definition of the sample mean,
So, if \(n-1\) residuals are known, the last one is fixed: it must be the negative of their sum. For example, if three deviations are \(-2,1,3\), a fourth deviation must be \(-2\), because the four deviations must sum to zero. This is the constraint behind \(n-1\) degrees of freedom.
The sample variance is the sum of squared residuals divided by \(n-1\):
The denominator is not simply the number of observations. The sample mean was calculated from those observations, and that calculation imposes the sum-to-zero constraint on the residuals. Using \(n\) instead would not be the usual sample variance used in the one-sample t statistic.
Why the Reference Distribution Is \(t_{n-1}\)
The one-sample t statistic for testing a hypothesized mean \(\mu_0\) is
Its denominator uses \(s\), an estimate of the population standard deviation \(\sigma\). If \(\sigma\) were known and the population were normal, standardizing the sample mean with \(\sigma\) would give a standard normal variable under \(H_0\). Replacing \(\sigma\) with the sample-based \(s\) adds uncertainty. The t distribution accounts for that uncertainty, and its degrees of freedom reflect how \(s\) was estimated.
Here is the normal-model justification. Suppose \(X_1,\ldots,X_n\) are independent observations from a normal population with mean \(\mu\) and standard deviation \(\sigma\). For the exact one-sample t distribution, this normal model is assumed, and the null hypothesis sets \(\mu=\mu_0\). A chi-square random variable with \(\nu\) degrees of freedom is, by definition, the sum of squares of \(\nu\) independent standard normal variables. The relevant results follow by separating the sample mean from the residual variation.
For a normal sample, an orthogonal change of coordinates can take one coordinate in the direction \((1,\ldots,1)/\sqrt{n}\). That coordinate is \(\sqrt{n}\bar{X}\). The other \(n-1\) coordinates describe variation perpendicular to that direction, so they describe the residual variation around \(\bar{X}\).
Orthogonal transformations preserve sums of squares. The \(n-1\) perpendicular coordinates, after centering and scaling by \(\sigma\), are independent standard normal variables. Therefore, their squared sum is chi-square with \(n-1\) degrees of freedom:
The mean-direction coordinate gives \(Z=(\bar{X}-\mu_0)/(\sigma/\sqrt{n})\sim N(0,1)\) under \(H_0\). It is independent of the \(n-1\) residual coordinates. Dividing \(Z\) by the square root of the independent chi-square variable divided by its degrees of freedom gives the t distribution.
In this expression, \(S\) is the random sample standard deviation; \(s\) is its value calculated from observed data. In general, if \(Z\sim N(0,1)\) and \(U\sim\chi^2_\nu\) independently, then \(Z/\sqrt{U/\nu}\) has a t distribution with \(\nu\) degrees of freedom. The equation shows why \(\nu=n-1\) in the one-sample case: the chi-square quantity measuring residual variation has \(n-1\) independent squared components.
Worked Examples
Worked Example: Ten Observations Give Nine Degrees of Freedom
Suppose a hypothetical random sample of \(n=10\) measurements is modeled as independent observations from a normal population. The sample mean is \(42.6\) units and the sample standard deviation is \(5.4\) units. For \(H_0:\mu=40\) units, identify the reference distribution and calculate the statistic.
Degrees of freedom. The sample mean has been estimated from the ten observations, so one degree is lost:
Statistic. The estimated standard error is \(s/\sqrt{n}=5.4/\sqrt{10}\approx1.7076\) units. Thus,
Under the stated normal model and the null hypothesis, the reference distribution is \(t_9\). The statistic is about \(1.523\) standard errors above the hypothesized mean. The sample size is ten, but the t distribution has nine degrees of freedom.
Worked Example: Calculate Degrees of Freedom From Raw Data
A hypothetical normal-population sample consists of \(8,10,11,13,\) and \(13\) units. For the one-sample statistic comparing the mean with \(\mu_0=10\) units, find \(s\), the statistic, and the appropriate t distribution.
The sample size is \(n=5\), and the mean is \(\bar{x}=(8+10+11+13+13)/5=11\) units. The residuals are \(-3,-1,0,2,2\) units. Their sum is zero, as required. Their squared sum is \(9+1+0+4+4=18\) square units, so
The standard error is \(\sqrt{4.5}/\sqrt{5}\approx0.9487\) units. The statistic is
The degrees of freedom are \(5-1=4\), so the reference distribution under the null and the stated model is \(t_4\), not \(t_5\). The four degrees of freedom also appear in the denominator used to calculate the sample variance.
Worked Example: Choose the Distribution for a Larger Sample
In a hypothetical study, \(n=25\) independent measurements are modeled as a normal sample. The sample mean is \(18.4\) minutes, the sample standard deviation is \(3.0\) minutes, and the hypothesized population mean is \(17.5\) minutes. Find the degrees of freedom and reference distribution, and compare the statistic with the usual two-sided 5% cutoff.
First,
The estimated standard error is \(3.0/\sqrt{25}=0.6\) minutes. Therefore,
The correct reference distribution is \(t_{24}\). Its two-sided 5% critical value is approximately \(2.064\), so the corresponding cutoffs are \(-2.064\) and \(2.064\). Since \(|1.500|<2.064\), the statistic does not exceed either cutoff. Choosing \(t_{24}\) rather than a standard normal reference uses the degrees of freedom implied by the sample's estimated standard deviation.
How the Choice Changes With Sample Size
Once \(n\) is known, the degrees of freedom are determined: subtract one, then use the t distribution with that index. The table gives examples of this mapping.
| Sample size \(n\) | Degrees of freedom \(n-1\) | Reference distribution |
|---|---|---|
| 2 | 1 | \(t_1\) |
| 5 | 4 | \(t_4\) |
| 10 | 9 | \(t_9\) |
| 25 | 24 | \(t_{24}\) |
| 100 | 99 | \(t_{99}\) |
With few degrees of freedom, a t distribution has heavier tails than the standard normal distribution. This reflects the additional uncertainty from estimating \(\sigma\) using limited data. As the degrees of freedom increase, the t distribution approaches the standard normal distribution. The correct distribution remains determined by \(n-1\); convergence toward normality does not change the degrees-of-freedom rule.
If \(n=1\), the sample variance formula has denominator \(n-1=0\), and there is no sample-based estimate \(s\) for the one-sample t statistic. Thus, there is no one-sample t distribution with zero degrees of freedom to use in this procedure.
Common Mistakes and a Practical Check
- Using \(n\) instead of \(n-1\). A sample of ten gives \(t_{10}\) only if the degrees of freedom were actually ten. For the usual one-sample t statistic, they are \(10-1=9\), so the reference is \(t_9\).
- Assuming the residuals are all free to vary. They must sum to zero because they are deviations from the sample mean. Knowing all but one determines the last residual.
- Confusing the t statistic with the degrees of freedom. The observed statistic \(t\) is a calculated number, such as \(1.523\). The degrees of freedom are a parameter of the reference distribution, such as \(9\).
- Switching to a normal distribution because the sample seems moderately large. The one-sample t procedure uses the t distribution with \(n-1\) degrees of freedom. The t distribution becomes closer to normal as \(n\) grows, but the degrees-of-freedom choice still follows the rule.
A reliable check is to write both quantities separately before consulting a table or software: \(df=n-1\), followed by the reference distribution \(t_{df}\). Then confirm that the chosen row or output uses that same \(df\). This keeps the sample size, the statistic, and the reference distribution from being mistaken for one another.
Check Your Understanding
Use \(df=n-1\) and the residual constraint to answer these questions.
- A one-sample t statistic is based on \(n=14\) observations. What are its degrees of freedom and reference distribution?
- Four deviations from a sample mean are \(1,-3,2,\) and \(0\). If there are five observations altogether, what must the fifth deviation be?
- For \(n=8\), explain why the sample variance divides the squared residual sum by 7 rather than 8.
- A researcher reports a one-sample statistic of \(t=1.80\) from a sample of 20 observations. What degrees of freedom should be used, and what is the reference distribution?
- Under the normal-population model, what feature of the sample variance produces the \(n-1\) degrees of freedom in the t distribution?