# How to deal with more complex transformation distributions

Assume that X1, X2,..., Xn ($$n\ge 2$$) are simple random samples from a normal distribution $$\mathrm{N}(\mu, 1)$$, let $$\overline{\mathbf{X}}=\frac{1}{\mathrm{n}} \sum_{i=1}^{\mathrm{n}} \mathrm{X}_{i}$$. Which of the following four conclusions is wrong ($$\chi^{2}$$ and ChiSquareDistribution[v] have the same meaning)?

$$\begin{array}{c} &(A)& \sum_{i=1}^{n}\left(X_{i}-\mu\right)^{2} \; obeys \; \chi^{2} \; distribution \quad &(B)& 2\left(X_{n}-X_{1}\right)^{2} \; obeys \; \chi^{2} \; distribution.\\ &(C)& \sum_{i=1}^{n}\left(X_{i}-\overline{\mathbf{X}}\right)^{2} \; obeys \; \chi^{2} \; distribution. \quad &(D)& \mathbf{n}(\overline{\mathbf{X}}-\mu)^{2} \; obeys \; \chi^{2} \; distribution \end{array}$$

But I had trouble judging whether the conclusion of the first option was correct:

\[ScriptCapitalD] =
TransformedDistribution[ Sum[(x[i] - 1)^2, {i, 1, 2}],
Table[x[i] \[Distributed] NormalDistribution[1, 1], {i, 1, 2}]]
Plot[PDF[\[ScriptCapitalD], x], {x, 0, 1}, Filling -> Axis]


The above code runs all the time. What should I do to deal with the complex conversion probability problem?

• Sometimes breaking things up into separate steps works. For example consider (A): d1 = TransformedDistribution[(x - \[Mu])^2, x \[Distributed] NormalDistribution[\[Mu], 1]]; n = 4; d = TransformedDistribution[Sum[x[i], {i, n}], Table[x[i] \[Distributed] d1, {i, n}]]. The result is ChiSquareDistribution[4].
– JimB
Commented Aug 8, 2020 at 17:23

Clear["Global*"]


For the first option,

TransformedDistribution[(x - μ),
x \[Distributed] NormalDistribution[μ, 1]]

(* NormalDistribution[0, 1] *)


For a sum of length 1

TransformedDistribution[x^2,
x \[Distributed] NormalDistribution[0, 1]]

(* ChiSquareDistribution[1] *)


By induction

TransformedDistribution[X + x,
{X \[Distributed] ChiSquareDistribution[m - 1],
x \[Distributed] ChiSquareDistribution[1]}]

(* ChiSquareDistribution[m] *)
`