# Implementing Cochran's theorem using ChiSquareDistribution[ν]

When samples of $$n$$ observations are taken from the normal distribution with mean $$\mu$$ and variance $$\sigma^2$$ then Cochran's theorem states that $$\frac{n S^2}{\sigma^2} \backsim \chi^2_{n-1}$$. Clearly, this distribution is a function of the population variance.

I am having difficulty working out exactly how I can express the distribution of $$S^2$$ using Mathematica's ChiSquareDistribution[ν], which has a single parameter $$v$$ capturing degrees of freedom.

To express the distribution of $$S^2$$ using Mathematica's ChiSquareDistribution[ν], do I simply multiply ChiSquareDistribution[ν] by $$\sigma^2$$ and divide by $$n$$?

Perhaps someone can confirm/dis-confirm my approach, ideaaly by stating the exact expression of how to solve the stated problem?

To obtain the distribution with Mathematica functions one sees that $$S^2$$ is a multiple of a $$\chi^2$$ random variable with $$n-1$$ degrees of freedom: $$S^2=(\sigma^2/n)\chi^2_{n-1}$$.

distS2 = TransformedDistribution[σ^2 x2/n,
x2 \[Distributed] ChiSquareDistribution[n - 1]]


The expectation of $$S^2$$ is found with

Expectation[s2, s2 \[Distributed] distS2]
(* ((-1+n) σ^2)/n *)


If I am not mistaken, the probability distribution pdf and the cummulative probability distribution cdf of $$S^2$$ should be given by

pdf = n/σ^2 PDF[ChiSquareDistribution[n - 1]][t n/σ^2];
cdf = CDF[ChiSquareDistribution[n - 1]][t n/σ^2];


Some wuick consistency tests for the scalings:

Integrate[pdf, {t, 0, ∞}, Assumptions -> {σ > 0, n >= 2}] == 1
Limit[cdf, t -> ∞, Assumptions -> {σ > 0, n >= 2}] == 1
D[cdf, t] == pdf // Simplify


True

True

True

• I think you meant to have $n/\sigma^2$ rather than $\sigma^2/n$: pdf = (n/σ^2) PDF[ChiSquareDistribution[n - 1]][t n/σ^2];. – JimB Dec 18 '18 at 4:23
• @JimB Thanks for the hint! I am not able to figure it out (transformation formula is soo puzzling, you know), so I am relying on your expertise here. =D – Henrik Schumacher Dec 18 '18 at 8:14