1
$\begingroup$

From Wikipedia's page on "Multivariate Normal Distribution", there's a reference to this PDF: https://upload.wikimedia.org/wikipedia/commons/a/a2/Cumulative_function_n_dimensional_Gaussians_12.2013.pdf.

First, I haven't found any other reference (book, paper) with similar content. Anyone?

Second, for the 2-D case (pages 2 -- 4), I tried verifying the given formula for the CDF as a function of the Mahalanobis distance, $r$. But results don't match with well-known implementations, such as pmvnorm in R or mvncdf in MATLAB. Here's an example in MATLAB (which is very similar in R). Given vector of means and covariance matrix.

mu = [0; 0]
Sigma = [1 0.5; 0.5 1]

A point in the x-y plane:

z = [0.2; 0.3]

Now, I calculate $r^2$:

rsq = (z - mu).'*inv(Sigma)*(z - mu)

The result is 0.0933. Plugging it into the CDF formula as a function of $r$, $F(r) = p$:

p = 1 - exp(-rsq/2)

which gives me 0.0456. When I check that against MATLAB's builtin function,

mvncdf(z,mu,Sigma)

I get 0.4369, which is clearly different from the result I get using the formula above.

What am I missing? I'd like to try the 3-D (or higher) case too. But I don't understand why the 2-D case seems to not "work".

Thank you in advance.

$\endgroup$

2 Answers 2

1
$\begingroup$

Just a guess, the domain of integration might be different for the two cases? E.g. in one case the density is integrated over the ellipsoid defined by rtilde <= r, and in the other over the Cartesian product of intervals defined by z and z0 ?

$\endgroup$
4
  • $\begingroup$ Thanks for the comment. If you read pages 2 --4 (or at least the formulas), you'll see that there's a change of variables (from Cartesian to polar) to perform the integration (that's the whole trick to get rid of the double integrals). And that formula, $F(r) = p = 1 - \exp(-r^2/2)$ should be the final formula, as I understand it. So by just plugging in the $r$ value, it should return the CDF whose upper limit of integration is the z point (lower limit is $-\infty$). Right? $\endgroup$
    – Bruno
    Commented Jan 22, 2015 at 23:32
  • $\begingroup$ Elliptical coordinates I should say. Any ideas on why the results don't match? $\endgroup$
    – Bruno
    Commented Jan 22, 2015 at 23:41
  • $\begingroup$ you are right, the lower limit for CDF integration is $-\infty$. The documentation for mvncdf mentions that the CDF is evaluated for every row of X, and you have a column vector, but I guess Matlab silently reshapes it.. sorry, I can't come up with an explanation right now. Oh and don't forget that A\b is in general cheaper than inv(A)*b, but for small cases it's fine ;) $\endgroup$
    – ocramz
    Commented Jan 22, 2015 at 23:46
  • $\begingroup$ I did it in R and got the same result. And thanks for the MATLAB tip (duh for me!). I actually e-mailed Michaël Bensimhoun about this, but haven't heard back... so I'm hoping this community will shed some light. :) $\endgroup$
    – Bruno
    Commented Jan 23, 2015 at 0:02
1
$\begingroup$

Sorry for being late. The answer is simple. The cumulative distribution function of Matlab ... is not the same as the cumulative distribution function defined in Bensimhoun. Let us take a look at the documentation of Matlab. They say:

"The multivariate normal cumulative probability at X is defined as the probability that a random vector V, distributed as multivariate normal, will fall within the semi-infinite rectangle with upper limits defined by X.for example, Pr{V(1) ≤ X(1),V(2) ≤ X(2),...,V(d) ≤ X(d)}.

y = mvncdf(xl,xu,mu,SIGMA) returns the multivariate normal cumulative probability evaluated over the rectangle with lower and upper limits defined by xl and xu, respectively."

This is clearly different from the cumulative distribution function as defined in Bensimhoun. Here, you have the probability that a random vector V, distributed as multivariate normal, will fall within the Mahanalobis distance R from the mean, that is, inside the ELLIPSOID defined by the mean and covariance with scaling factor R.

For example, in 1D, the cumulative function of Matlab coincides with the usual cumulative function $F$ of the normal distribution (see definition in p. 1 of Bensimhoun), while the "mahalanobis cumulative" function in Bensimhoun coincides with $\int_{\mu-\sigma x}^{\mu+\sigma x} \varphi(t)dt$ (see Bensimhoun, beginning of p. 2, and how the two cumulative functions are related in the 1D-case, but not in higher dimension). The n-D dimensional cases are the exact generalizations of the 1-D dimensional case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.