# Deegrees of freedom of Student's distribution

I'm trying to figure out the distribution of this statistic:

$$S=\frac{\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}}{\sqrt{\hat{\sigma}^2/\sigma^2}}$$

Where:

• $\overline{X}=\frac{1}{n} \sum_{i=1}^n X_i$
• $\hat{\sigma}^2=\frac{1}{n-1} \sum_{i=1}^n (X_i-\overline{X})^2$

And $X_i \sim N(\mu, \sigma^2)$ i.i.d.

The numerator is easy, it is a classical standardization. Thus:

$$\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}} = Z \sim N(0,1)$$

For what it concerns the denominator: $$\frac{\hat{\sigma}^2}{\sigma^2}=\frac{\frac{1}{n-1} \sum_{i=1}^n (X_i-\overline{X})^2}{\sigma^2}=\frac{\frac{1}{\sigma^2}\sum_{i=1}^n (X_i-\overline{X})^2}{n-1}=\frac{\sum_{i=1}^n \left (\frac{X_i-\mu}{\sigma}\right )^2}{n-1}$$

Now, since $Z=\frac{X_i-\mu}{\sigma}$ is a standard normal , then $$\sum_{i=1}^n \left (\frac{X_i-\mu}{\sigma}\right )^2=\sum_{i=1}^n Z^2 \sim \chi^2_n$$

This means that:

$$\frac{\hat{\sigma}^2}{\sigma^2} = \frac{\chi^2_n}{n-1}$$

Combining the results above leads me to this final result:

$$\frac{\frac{\overline{X}-\mu_0}{\sigma / \sqrt{n}}}{\sqrt{\hat{\sigma}^2/\sigma^2}}=\frac{N(0,1)}{\sqrt{\frac{\chi^2_n}{n-1}}} \sim t_n$$

Where $t_n$ is a Student distribution with $n$ degrees of freedom. This result must be wrong, because the right one should give a Student with $n-1$ degrees of freedom. Something is clearly missing but I cannot understand what it is. Could you please help me?

• The $\mu$ in the equation following "For what it concerns the denominator:" should be a $\bar X$. – JimB Aug 17 '15 at 20:21
• You don't need to call in the true mean $\mu$ - the sample variance (using the sample mean) has a finite-sample chi-square distribution, if the sample is i.i.d. normal. – Alecos Papadopoulos Aug 17 '15 at 21:58

What you are missing is that the Student distribution does take on the degrees of freedom of the chi-square in the denominator. I.e. the formula on the left is the definition of $t_{n-1}$, not of $t_{n}$. In other words, you don't miss anything.
Just to make this a bit more rich, see the derivation of the Student's density in this post. Note that in the linked post, the $n$ degrees of freedom of the chi-square are arbitrary -the important thing is to see that the same $n$ ends up being the degrees of freedom of the Student distribution.
In your example the degrees of freedom are $n-1$.
• Ok, thank you very much for the explanation and the interesting link. Though, there is an error in what I have done. Following the definition of the Student distribution on the link, the denominator on the last ratio should have been $$\sqrt{\frac{\chi^2_{n-1}}{n-1}}$$ instead of $$\sqrt{\frac{\chi^2_{n}}{n-1}}$$ The mistake is that I have arbitrarily and erroneously substituted the sample mean ($\overline{X}$) with the true mean ($\mu$), as you said above; this as caused the $\chi^2$ distribution to have $n$ degrees of freedom instead of $n-1$. – ChicagoCubs Aug 18 '15 at 22:27