1
$\begingroup$

I have a two-dimensional normal distribution (with correlations). I do not have data points, but only the 2D mean and the covariance matrix. I want to draw the 68, 95 and 99% confidence intervals which in 2D do not correspond to the 1, 2, and 3 standard deviations error ellipses (which I can plot by calculating the eigenvalues and eigenvectors of trhe covariance matrix).

How can I do it? That is, having the CL value (or interchangeably the alpha value) how can I scale the ellipses axis to match the desired CL?

All I can find online refers back to the Hotelling's T distribution, but as far as I can tell it uses information on the sample sizes, which I have not. chatGPT gives me a scale using the chi2 Percent point function as

width, height = 2 * np.sqrt(scipy.stats.chi2.ppf(0.68, 2)* eigenvalues)

Is this correct?

Thanks a lot for the help.

$\endgroup$
5
  • $\begingroup$ Welcome to CV, Alberto. Confidence does not apply: that's for making estimates from data. Are you implying the mean and covariance have been estimated? If so, how and from how much data? If not, then your question is puzzling. Please explain what you really need and what you mean by "confidence intervals" not corresponding to "error ellipses." $\endgroup$
    – whuber
    Commented Apr 14 at 15:17
  • $\begingroup$ Hi. I have a very complex fit, which estimate from data several parameters, with uncertainties and correlations. Each parameter estimation you can assume it is gaussian with mean equal to the fit results and standard deviation equal to the fit uncertainty for that parameters. I want to represent two of them in a 2D plane and draw a contour corresponding to 68% CL. The amount of data is not relevant (~500 million) as their statistical power is coded in the uncertainty on the parameter. $\endgroup$
    – tpd
    Commented Apr 14 at 19:50
  • $\begingroup$ Error ellipses correspond to 1, 2, 3, etc standard deviations in both direction. But these does not correspond to 68%, 95%, 99.7% confidence level. $\endgroup$
    – tpd
    Commented Apr 14 at 21:19
  • $\begingroup$ That's correct. But the amount of data is a crucial aspect of any calculation of confidence. Your comment contradicts the information in your question, so please edit the question to state the relevant information you have. $\endgroup$
    – whuber
    Commented Apr 15 at 3:10
  • $\begingroup$ BTW, this question is answered on another SE site at mathematica.stackexchange.com/questions/21396. $\endgroup$
    – whuber
    Commented Apr 16 at 14:07

1 Answer 1

2
$\begingroup$

It appears you want ellipses centered at the expected value of the distribution, each being a level set of the density function, for which the probabilities that the random point is within the ellipse are as specified.

"Confidence interval" is the wrong term for that. Confidence intervals, or in this case what are usually called confidence regions, are about estimates based on a sample that consists of a number of (usually) independent observations.

Suppose the mean of the random point $X$ is a point $\mu$ in the plane, and the variance is a $2\times2$ matrix $M$ (often called a "covariance matrix" because each of its entries is a covariance).

You have $X\sim\operatorname N_2(\mu, M).$ Consequently $Z = M^{-1/2}(X-\mu) \sim\operatorname N_2(\mathbf 0, I_2),$ where $I_2$ is the $2\times2$ identity matrix, where $M^{-1/2}$ is the inverse of the positive-definite symmetric square root of $M.$ That there even is a positive-definite symmetric square root of $M$ is far from obvious unless you know about the spectral decomposition of symmetric matrices, i.e. diagonalization.

So you want the value of $c$ for which $\Pr((X-\mu)^T M^{-1}(X-\mu) < c) = 0.68.$

That is the same as the value of $c$ for which $\Pr(Z^T Z< c) = 0.68.$

Now $Z^TZ = Z_1^2+Z_2^2,$ where $Z_1,Z_2\sim\text{i.i.d.} \operatorname N_1(0,1).$ And so $Z_1^2 + Z_2^2 \sim \chi^2_2.$

The $\chi^2_2$ distribution is actually the exponential distribution with expected value $2.$ So you need the value of $c$ for which $e^{-c/2} = 0.68.$ That is $c = -2\log_e0.68.$

Therefore $(\mathbf x-\mu)^T M^{-1}(\mathbf x-\mu) = -2\log_e(0.68)$ is the equation of the ellipse you're looking for.

$\endgroup$
2
  • $\begingroup$ What puzzles me about the question is that this seems specifically to be what the OP says they don't want. $\endgroup$
    – whuber
    Commented Apr 16 at 13:51
  • $\begingroup$ @whuber : I don't understand your comment. Where is there anything about what the OP does not want? $\endgroup$ Commented Apr 17 at 1:35

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.