Distribution of Difference of Chi-squared Variables
I am trying to get the probability distribution function of $Z=X-Y$. Given that $f_X(x)$ and $f_Y(y)$ are known, and both variables are chi-square distributed, $X\in\mathbb{R}$, $X\ge 0$, and similarly $Y\in\mathbb{R}$, $Y\ge 0$. So how can I get $f_Z(z)$.
Solution 1:
Let's assume that $X$ and $Y$ are independent, and both follow $\chi^2$-distribution with $\nu$ degrees of freedom.
Then $Z = X-Y$ follows symmetric about the origin variance-gamma distribution with parameters $\lambda = \frac{\nu}{2}$, $\alpha=\frac{1}{2}$, and $\beta=0$ and $\mu = 0$.
The best way to see this is through the moment-generating function: $$ \mathcal{M}_X(t) = \mathcal{M}_Y(t) = \left(1-2 \, t\right)^{-\nu/2} $$ Then $$ \mathcal{M}_Z(t) = \mathcal{M}_X(t) \mathcal{M}_Y(-t) = \left( 1-4 t^2 \right)^{-\nu/2} = \left( \frac{1/4}{1/4-t^2}\right)^{\nu/2} $$ We now this that it match the moment generating function of the variance gamma distribution: $$ \mathcal{M}_{\rm{V.G.}(\lambda,\alpha,\beta,\mu)}(t) = \mathrm{e}^{\mu t} \left( \frac{\alpha^2 -\beta^2}{\alpha^2 - (\beta+t)^2 } \right)^\lambda $$ For the said parameters, $\mu=\beta=0$, $\alpha=\frac{1}{2}$ and $\lambda=\frac{\nu}{2}$, the density has the following form: $$ f_Z(z) = \frac{1}{2^{\nu/2}\sqrt{\pi}} \frac{1}{\Gamma\left(\frac{\nu}{2}\right)} \vert z \vert^{\tfrac{\nu-1}{2}} K_\tfrac{\nu-1}{2}\left(\vert z \vert \right) $$ The function $f_Z(z)$ is continuous at $z=0$ for $\nu > 1$, with $$ \lim_{z \to 0} f_Z(z) =\frac{1}{4 \sqrt{\pi }} \frac{\Gamma \left(\frac{\nu }{2}-\frac{1}{2}\right)}{ \Gamma \left(\frac{\nu }{2}\right)} $$