Tutorials › Statistical Theory I - Probability and Distribution Theory › Calculating Distributions of Weighted Chi-Square Sums

Gaussian Quadratic Forms · Tutorial 768 of 994

Calculating Distributions of Weighted Chi-Square Sums

Use characteristic functions and convolution to calculate weighted chi-square distributions exactly when possible, and to build and assess moment-matched approximations.

Advanced 10 min read

What You'll Learn

  • Write the characteristic function of a finite weighted sum of independent chi-square variables.
  • Recognize when equal positive weights combine into a single scaled chi-square variable.
  • Derive sum densities by convolution, including the differentiation step from a convolution CDF.
  • Calculate a mixed-sign sum by splitting it into independent positive and negative parts.
  • Match the first two moments to a scaled chi-square distribution and assess what the approximation preserves.

From Eigenvalues to a Distribution

After a Gaussian quadratic form has been reduced to independent squared standard normal variables, its distribution is governed by a finite weighted sum of chi-square variables. Equal weights can often be combined exactly. Unequal weights generally produce a convolution, while weights of both signs require a difference of two nonnegative random variables. Characteristic functions provide one calculation that handles all three situations.

Definition: Let \(X_1,\ldots,X_m\) be independent random variables with \(X_j\sim\chi^2_{\nu_j}\), where \(\nu_j>0\), and let \(\lambda_1,\ldots,\lambda_m\) be real constants. The finite weighted chi-square sum is $$ Q=\sum_{j=1}^m\lambda_j X_j. $$ Terms with \(\lambda_j=0\) contribute nothing and may be omitted. A sum is nonnegative-weighted if all remaining weights are positive; it is mixed-sign if at least one weight is positive and at least one is negative.

The degrees of freedom need not be integers for these distributional calculations: \(\chi^2_\nu\) is the gamma distribution with shape \(\nu/2\) and scale \(2\). Independence is essential. The formulas below apply directly when the chi-square components are independent, as can occur after an appropriate Gaussian decomposition.

Characteristic Function and Cumulants

For \(X\sim\chi^2_\nu\), its density is \(x^{\nu/2-1}e^{-x/2}/(2^{\nu/2}\Gamma(\nu/2))\) for \(x>0\). Integrating this density against \(e^{it\lambda x}\) gives the characteristic function of \(\lambda X\). The result, with the complex power chosen continuously from its value \(1\) at \(t=0\), is \((1-2it\lambda)^{-\nu/2}\).

Theorem: If the \(X_j\) are independent chi-square variables as defined above, then $$ \varphi_Q(t)=E[e^{itQ}] =\prod_{j=1}^m(1-2it\lambda_j)^{-\nu_j/2},\qquad t\in\mathbb R. $$ The mean, variance, and cumulants of order \(r\geq 1\) are $$ E[Q]=\sum_{j=1}^m\nu_j\lambda_j,\qquad \operatorname{Var}(Q)=2\sum_{j=1}^m\nu_j\lambda_j^2,\qquad \kappa_r(Q)=2^{r-1}(r-1)!\sum_{j=1}^m\nu_j\lambda_j^r. $$

To verify the characteristic function for one term, insert its density into the defining expectation. The gamma integral \(\int_0^\infty x^{a-1}e^{-cx}\,dx=\Gamma(a)c^{-a}\), valid for \(a>0\) and \(\operatorname{Re}(c)>0\), applies with \(a=\nu/2\) and \(c=(1-2it\lambda)/2\). Since \(\operatorname{Re}(c)=1/2\), it yields \((1-2it\lambda)^{-\nu/2}\). Independence makes the characteristic function of a sum the product of the individual characteristic functions.

For the cumulants, the logarithm of the characteristic function is $$ \log\varphi_Q(t)=-\frac12\sum_{j=1}^m\nu_j\log(1-2it\lambda_j). $$ Expanding \(-\log(1-z)=\sum_{r=1}^\infty z^r/r\) around zero gives the coefficient of \((it)^r/r!\) as \(2^{r-1}(r-1)!\sum_j\nu_j\lambda_j^r\). In particular, \(r=1\) and \(r=2\) give the displayed mean and variance. The expansion is valid in a neighborhood of zero, which is sufficient to identify the cumulants. \(\square\)

Nonnegative Weights: Exact Convolution

If all weights are positive, each summand has a gamma density with shape \(a_j=\nu_j/2\) and scale \(2\lambda_j\). For one term, $$ f_j(x)=\frac{x^{a_j-1}e^{-x/(2\lambda_j)}}{\Gamma(a_j)(2\lambda_j)^{a_j}},\qquad x>0. $$ The sum is supported on \((0,\infty)\). When all the scales are the same, the gamma shapes add, so the sum is again a scaled chi-square variable. Unequal scales usually require convolution.

Convolution formula: If independent random variables \(U\) and \(V\) have densities \(f_U\) and \(f_V\), then \(S=U+V\) has density $$ f_S(q)=\int_{-\infty}^{\infty} f_U(u)f_V(q-u)\,du. $$ For nonnegative \(U,V\), this reduces to \(\int_0^q f_U(u)f_V(q-u)\,du\) when \(q>0\).

For nonnegative \(U,V\), the joint density is \(f_U(u)f_V(v)\) on \(u,v>0\). Change variables to \((u,q)=(u,u+v)\), whose inverse is \((u,v)=(u,q-u)\) and whose Jacobian has absolute value \(1\). The transformed joint density is \(f_U(u)f_V(q-u)\) on \(0<u<q\). Integrating out \(u\) gives the displayed density. Equivalently, integrating the joint density over \(u+v\leq q\) gives the CDF of \(S\); differentiating that CDF with respect to \(q\) yields the same convolution density. The integral over that region alone is a CDF, not a density.

Worked Example: Convolving Two Unequal Exponential Terms

Let \(X_1,X_2\) be independent \(\chi^2_2\) variables, and set \(Q=X_1+3X_2\). A \(\chi^2_2\) variable is exponential with mean \(2\), so \(X_1\) has rate \(1/2\), while \(3X_2\) has rate \(1/6\). Their densities are \(f_U(u)=\tfrac12e^{-u/2}\) and \(f_V(v)=\tfrac16e^{-v/6}\) for positive arguments.

For \(q>0\), convolution gives $$ f_Q(q)=\int_0^q \frac12e^{-u/2}\frac16e^{-(q-u)/6}\,du =\frac1{12}e^{-q/6}\int_0^q e^{-u/3}\,du =\frac14\left(e^{-q/6}-e^{-q/2}\right). $$ For \(q\leq0\), the density is zero. Integrating the density from \(0\) to \(q\) gives $$ F_Q(q)=1-\frac32e^{-q/6}+\frac12e^{-q/2},\qquad q>0, $$ and \(F_Q(q)=0\) for \(q\leq0\). At \(q=0\), the formula gives \(1-\tfrac32+\tfrac12=0\); as \(q\to\infty\), it tends to \(1\). The density is nonnegative because \(e^{-q/6}\geq e^{-q/2}\) for \(q>0\).

Worked Example: Combining Equal Weights

Let \(X_1\sim\chi^2_3\) and \(X_2\sim\chi^2_5\) be independent, and define \(Q=\tfrac12X_1+\tfrac12X_2\). The sum \(X_1+X_2\) is \(\chi^2_8\): its characteristic function is the product \((1-2it)^{-3/2}(1-2it)^{-5/2}=(1-2it)^{-4}\), the characteristic function of \(\chi^2_8\). Thus \(Q\sim\tfrac12\chi^2_8\).

This also follows from the gamma representation: both terms have scale \(1\), and their shapes \(3/2\) and \(5/2\) add to \(4\). The resulting density is \(q^3e^{-q}/\Gamma(4)\) for \(q>0\). As a check, its mean is \(4\) and variance is \(4\), matching \(E[Q]=\tfrac12(3+5)=4\) and \(\operatorname{Var}(Q)=2(\tfrac14)(3+5)=4\). Equivalently, \(Q=\tfrac12\chi^2_8\) has mean \(4\) and variance \(4\).

Mixed Signs: A Difference of Positive Sums

With weights of both signs, write \(Q=A-B\), where \(A\) is the sum of the positive-weight terms and \(B\) is the sum of the absolute values of the negative-weight terms. These two sums are independent and nonnegative. If they have densities, the density of \(Q\) is $$ f_Q(q)=\int_{\max(0,-q)}^\infty f_A(q+y)f_B(y)\,dy. $$ This follows by transforming \((A,B)\) to \((q,y)=(A-B,B)\), with inverse \((A,B)=(q+y,y)\) and Jacobian of absolute value \(1\). The constraints \(A,B>0\) require \(y>\max(0,-q)\). Unlike a nonnegative-weighted sum, a mixed-sign sum can take both positive and negative values; in fact its support is the whole real line when both parts are nonempty, since each positive gamma component has positive density throughout \((0,\infty)\).

Worked Example: Difference of Two Exponential Variables

Let \(X,Y\) be independent \(\chi^2_2\) variables and take \(Q=X-2Y\). Then \(X\) is exponential with rate \(\alpha=1/2\), and \(2Y\) is exponential with rate \(\beta=1/4\). For \(q\geq0\), use \(Q=X-2Y\) and integrate over \(2Y=y>0\): $$ f_Q(q)=\int_0^\infty \alpha e^{-\alpha(q+y)}\beta e^{-\beta y}\,dy =\frac{\alpha\beta}{\alpha+\beta}e^{-\alpha q} =\frac16e^{-q/2}. $$ For \(q<0\), the positive variable \(X\) must equal \(q+2Y\), so \(2Y>-q\). Integrating over \(x=X>0\) instead gives $$ f_Q(q)=\int_0^\infty \beta e^{-\beta(x-q)}\alpha e^{-\alpha x}\,dx =\frac{\alpha\beta}{\alpha+\beta}e^{\beta q} =\frac16e^{q/4}. $$ The right-side probability is \(\int_0^\infty \tfrac16e^{-q/2}\,dq=1/3\); the left-side probability is \(\int_{-\infty}^0 \tfrac16e^{q/4}\,dq=2/3\). They sum to \(1\), checking the normalization. Its characteristic function is also \((1-2it)^{-1}(1+4it)^{-1}\), the product for the two independent terms.

Moment-Matched Approximation

When the positive weights are unequal and the convolution has no convenient closed form, a scaled chi-square distribution can approximate the sum. This is commonly called the Satterthwaite approximation. It matches the mean and variance, not the full distribution.

Moment-matching rule: For a sum with positive weights, let \(\mu=\sum_j\nu_j\lambda_j\) and \(v=2\sum_j\nu_j\lambda_j^2\). Match \(Q\) to \(c\chi^2_d\), where $$ c=\frac{v}{2\mu},\qquad d=\frac{2\mu^2}{v}. $$ These formulas require \(\mu>0\) and \(v>0\).

Indeed, \(c\chi^2_d\) has mean \(cd\) and variance \(2c^2d\). Solving \(cd=\mu\) and \(2c^2d=v\) gives the displayed values. This positive gamma approximation is naturally suited to positive sums. For a mixed-sign sum, mean matching alone may put substantial approximation mass on the wrong side of zero, so it should not be applied mechanically.

Worked Example: Matching the First Two Moments

Take independent \(X_1,X_2\sim\chi^2_1\) and \(Q=X_1+2X_2\). Its mean and variance are $$ \mu=1+2=3,\qquad v=2(1^2+2^2)=10. $$ The matched scale and degrees of freedom are \(c=10/(2\cdot3)=5/3\) and \(d=2\cdot 3^2/10=9/5\). Thus \(Q\) is approximated by \(\tfrac53\chi^2_{9/5}\), which has mean \((5/3)(9/5)=3\) and variance \(2(5/3)^2(9/5)=10\).

The match does not make the distributions identical. The exact third cumulant is \(8(1^3+2^3)=72\). The matched gamma has third cumulant \(8c^3d=8(125/27)(9/5)=200/3\), which is not \(72\). Thus even this simple check shows that the approximation preserves the first two moments but not every feature of the distribution.

Practical Checks and Common Pitfalls

The characteristic function is useful for more than deriving formulas: it provides a compact exact description even when an elementary density is unavailable. For numerical work, one may evaluate the product characteristic function and use a suitable Fourier inversion method; direct convolution is another option for a small number of terms. Before trusting either calculation, check the mean, variance, support, and density normalization against the formulas above.

  • Confusing a convolution CDF with a density. Integrating a joint density over \(u+v\leq q\) gives \(P(U+V\leq q)\). To obtain a density, differentiate with respect to \(q\), or change variables to the sum and integrate out the other coordinate.
  • Combining unequal scales as if they were equal. Chi-square degrees of freedom add when the variables have the same scale after weighting. Unequal scales do not generally produce a chi-square sum.
  • Using only the mean to infer support. A mixed-sign sum can have positive mean and still take negative values. Its support is determined by the signs of the weights, not by the sign of its expectation.
  • Calling a moment match exact. Matching two moments does not generally match the characteristic function, tail behavior, or higher cumulants.
Key takeaway: Use the product characteristic function for an exact distributional description, combine equal positive scales when possible, and use convolution for explicit densities. For mixed signs, split the sum into independent positive and negative parts; for approximation, state clearly which moments are matched.

Check Your Understanding

Use independence throughout, and distinguish exact distributional identities from approximations.

  1. Write the characteristic function of \(Q=2X_1-X_2\) when \(X_1\sim\chi^2_3\) and \(X_2\sim\chi^2_4\) independently.
  2. When can a weighted sum of independent chi-square variables be combined into one scaled chi-square variable?
  3. Explain why integrating a joint density over \(u+v\leq q\) does not by itself give the density of \(U+V\).
  4. For a mixed-sign sum \(A-B\) with independent positive \(A\) and \(B\), state the density integral for \(q<0\).
  5. What two features does the Satterthwaite approximation match, and what does it not guarantee?