24

I need to find the distribution of the random variable $$Y=\sum_{i=1}^{n}(X_i)^2$$ where $X_i\sim{\cal{N}}(\mu_i,\sigma^2_i)$ and all $X_i$s are independent. I know that it is possible to first find the product of all moment generating functions for $X_i$s, and then transform back to obtain $Y$'s distribution. However, I wonder whether there is a general form for $Y$ like the Gaussian case: we know the sum of independent Gaussian is still a Gaussian, and thus we only need to know the summed mean and summed variance.

How about all $\sigma^2_i=\sigma^2$? Will this condition make a general solution?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
pitfall
  • 427
  • 1
  • 3
  • 7
  • 2
    Looking at the first paragraph under [here](http://en.wikipedia.org/wiki/Noncentral_chi-squared_distribution#Background), clearly the final condition yields a scaled noncentral chi-square (divide through by $\sigma^2$ (the scale factor you take out the front) and make $\sigma_i=1$ in $\sum_{i=1}^k (X_i/\sigma_i)^2$). The more general form you started with looks like a linear combination or scaled-weighted-average, with coefficients $\sigma^2_i$ rather than a plain sum of scaled squares ... and I believe that won't generally have the required distribution. – Glen_b Aug 16 '13 at 03:22
  • Depending on what you need it for, in specific cases you may be able to do numerical convolution, or simulation. – Glen_b Aug 16 '13 at 22:25
  • 1
    This is generalized by the 'weighted sum of log chi-squares to power' distribution. My R package `sadists` provides approximate 'dpqr' functions for $Y$; _c.f._ https://github.com/shabbychef/sadists – shabbychef Mar 21 '15 at 04:37
  • @shabbychef thank you for your work! – runr Oct 19 '20 at 03:33

1 Answers1

22

As Glen_b noted in the comments, if the variances are all the same you end up with a scaled noncentral chi-squared.

If not, there is a concept of a generalized chi-squared distribution, i.e. $x^T A x$ for $x \sim N(\mu, \Sigma)$ and $A$ fixed. In this case, you have the special case of diagonal $\Sigma$ ($\Sigma_{ii} = \sigma_i^2$), and $A = I$.

There has been some work on computing things with this distribution:

You can also write it as a linear combination of independent noncentral chi-squared variables $Y = \sum_{i=1}^n \sigma_i^2 \left( \frac{X_i^2}{\sigma_i^2} \right)$, in which case:

Bausch (2013) gives a more computationally efficient algorithm for the linear combination of central chi-squareds; his work might be extensible to noncentral chi-squareds, and you might find some interesting pointers in the related work section.

Danica
  • 21,852
  • 1
  • 59
  • 115
  • 2
    A comparison of approximation methods is found in Duchesne et al. 2010. Computational Statistics and Data Analysis, 54, 858–862. The authors maintain the R package [CompQuadForm](http://cran.r-project.org/package=CompQuadForm) with implementations. – caracal Mar 17 '15 at 08:55