# Generalized chi-squared distribution

In probability theory and statistics, the specific name generalized chi-squared distribution (also generalized chi-square distribution) arises in relation to one particular family of variants of the chi-squared distribution. There are several other such variants for which the same term is sometimes used, or which clearly are generalizations of the chi-squared distribution, and which are treated elsewhere: some are special cases of the family discussed here, for example the noncentral chi-squared distribution and the gamma distribution, while the generalized gamma distribution is outside this family. The type of generalisation of the chi-squared distribution that is discussed here is of importance because it arises in the context of the distribution of statistical estimates in cases where the usual statistical theory does not hold. For example, if a predictive model is fitted by least squares but the model errors have either autocorrelation or heteroscedasticity, then a statistical analysis of alternative model structures can be undertaken by relating changes in the sum of squares to an asymptotically valid generalized chi-squared distribution.[1] More specifically, the distribution can be defined in terms of a quadratic form derived from a multivariate normal distribution.

## Definition

One formulation of the generalized chi-squared distribution is as follows.[1] Let z have a multivariate normal distribution with zero mean and covariance matrix B, then the value of the quadratic form X=zTAz, where A is a matrix, has a generalised chi-squared distribution with parameters A and B. Note that there is some redundancy in this formulation, as for any matrix C, the distribution with parameters CTAC and B is identical to the distribution with parameters A and CBCT. The most general form of generalized chi-squared distribution is obtained by extending the above consideration in two ways: firstly, to allow z to have a non-zero mean and, secondly, to include an additional linear combination of z in the definition of X.

Note that, in the above formulation, A and B need not be positive definite. However, the case where A is restricted to be at least positive semidefinite is an important one.

For the most general case, a reduction towards a common standard form can be made by using a representation of the following form:[2]

$X=(z+a)^\mathrm T A(z+a)+c^\mathrm T z= (x+b)^\mathrm T D(x+b)+d^\mathrm T x+e ,$

where D is a diagonal matrix and where x represents a vector of uncorrelated standard normal random variables. An alternative representation can be stated in the form:[3][4]

$X=\sum_{i=1}^r \lambda_i Y_i + f Z_0 ,$

where the Yi represent random variables having (different) noncentral chi-squared distributions, where Z0 has a standard normal distribution, and where all these random variables are independent. Some important special cases relating to this particular form either omit the additional standard normal term and/or have central rather than non-central chi-squared distributions for the components of the summation.

## Practical implementation

Computer code for evaluating the cumulative distribution function of the generalized chi-squared distribution has been published,[2][4] but some preliminary manipulation of the parameters of the distribution is usually necessary.

## Other applications

The following application arises in the context of Fourier analysis in signal processing, renewal theory in probability theory, and multi-antenna systems in wireless communication. The common factor of these areas is that the sum of exponentially distributed variables is of importance (or identically, the sum of squared magnitudes circular symmetric complex Gaussian variables).

If $Z_i$ are k independent, circular symmetric complex Gaussian random variables with mean 0 and variance $\sigma_i^2$, then the random variable

$\tilde{Q} = \sum_{i=1}^k |Z_i|^2$

has a generalized chi-squared distribution of a particular form. The difference from the standard chi-squared distribution is that $Z_i$ are complex and can have different variances, and the difference from the more general generalized chi-squared distribution is that the relevant scaling matrix A is diagonal. If $\mu=\sigma_i^2$ for all i, then $\tilde{Q}$, scaled down by $\mu/2$ (i.e. multiplied by $2/\mu$), has a chi-squared distribution, $\chi^2(2k)$, also known as an Erlang distribution. If $\sigma_i^2$ have distinct values for all i, then $\tilde{Q}$ has the pdf[5]

$f(x; k,\sigma_1^2,\ldots,\sigma_k^2) = \sum_{i=1}^{k} \frac{e^{-\frac{x}{\sigma_i^2}}}{\sigma_i^2 \prod_{j=1, j\neq i}^{k} (1- \frac{\sigma_j^2}{\sigma_i^2})} \quad\mbox{for }x\geq0.$

If there are sets of repeated variances among $\sigma_i^2$, assume that they are divided into M sets, each representing a certain variance value. Denote $\mathbf{r}=(r_1, r_2, \dots, r_M)$ to be the number of repetitions in each group. That is, the mth set contains $r_m$ variables that have variance $\sigma^2_m.$ It represents an arbitrary linear combination of independent $\chi^2$-distributed random variables with different degrees of freedom:

$\tilde{Q} = \sum_{m=1}^M \sigma^2_m Q_m, \quad Q_m \sim \chi^2(2r_m) \, .$

The pdf of $\tilde{Q}$ is[6]

$f(x; \mathbf{r}, \sigma^2_1, \dots \sigma^2_M) = \prod_{m=1}^M \frac{1}{\sigma^{2r_m}_m} \sum_{k=1}^M \sum_{l=1}^{r_k} \frac{\Psi_{k,l,\mathbf{r}}}{(r_k-l)!} (-x)^{r_k-l} e^{-\frac{x}{\sigma^2_k}} \quad\text{, for }x\geq0 ,$

where

$\Psi_{k,l,\mathbf{r}} = (-1)^{r_k-1} \sum_{\mathbf{i} \in \Omega_{k,l}} \prod_{j \neq k} \Big( \!\!\! \begin{array}{c} i_j + r_j-1\\ i_j \end{array} \!\!\! \Big) \Big(\frac{1}{\sigma^2_j}\!-\!\frac{1}{\sigma^2_k} \Big)^{-(r_j + i_j)},$

with $\mathbf{i}=[i_1,\ldots,i_M]^T$ from the set $\Omega_{k,l}$ of all partitions of $l-1$ (with $i_k=0$) defined as

$\Omega_{k,l} = \Big\{ [i_1,\ldots,i_m]\in \mathbb{Z}^m; \sum_{j=1}^M i_j \!= l-1, i_k=0, i_j\geq 0 \,\, \text{, for all } j \Big\}.$