Page 1 of 1

distribution of a quadratic function of a multivariate normal

Posted: Sat Jul 01, 2017 7:10 pm UTC
by >-)
if x is drawn from a multivariate normal with mean mu and covariance sigma, what's the distribution of z = x.T P x
(.T denotes transpose and P is an arbitrary square matrix)

i suspect that f(z) = ∫ p(x) dx
where the integral is over all x such that x.T P x = z
but i'm not sure how to carry out this integral over that strange region

for the special case that P = sigma^-1 = identity, then z is the sum of squares of normals, which is chi-squared
possibly this problem can also be solved for P = sigma^-1 != I, but i'm not sure how

i would also be satisfied with knowing if there is no nice expression for the resulting distribution

Re: distribution of a quadratic function of a multivariate normal

Posted: Tue Jul 04, 2017 2:54 am UTC
by cyanyoshi
I found the pictures from this lecture to be helpful in the case of a 1-dimensional random variable: I haven't quite figured out a good way to compute this kind of thing for multivariate functions, but maybe the univariate case can be interesting.

Let's see what happens to a univariate normal distribution for starters, so z=x2 with x having a normal distribution with mean μ and variance σ. Working through the math, I get that the pdf of z is f(z)=(8πσ2z)-1/2(exp[-(sqrt(z)-μ)2/(2σ2)]+exp[-(-sqrt(z)-μ)2/(2σ2)]). Whatever this is called, it looks something like this. You see a spike at 0, and sometimes another hump depending on the μ and σ you pick.

Going to the multivariate case, you could do a change-of-variables y=P1/2x if P is positive semidefinite. This may let you integrate a Gaussian over the level sets of yTy, which is a hypersphere. I'm not sure how doable this is, since this may be some nasty integral in several dimensions. The situation could be worse if P isn't positive semidefinite because then the level sets may be unbounded and I have no idea how to parameterize these kinds of surfaces. It should be simple enough to run a bunch of simulations and draw a histogram, and I suspect the distribution will still have that spike at zero.

Re: distribution of a quadratic function of a multivariate normal

Posted: Mon Jul 10, 2017 9:16 am UTC
by >-)
So I took the easy way out and went googling. I was actually pretty skeptical there would be a solution to this, mainly because I have seen derivations for the expectation and covariance of the expression many times, but I have never seen an attempt to figure out what the distribution actually is.

So I was pretty surprised when I found this, (slide 18/19)
which tells us that the result is some sort of chi-squared or sum of chi-squared variables.