4
$\begingroup$

I'm working on a project right now where I have Gaussian distributions, and I want to create a graphic that represents them. I'm not sure how to generate the ellipse that represents say 1 standard deviation away from the mean.

How do I convert the covariance matrix into the major & minor axes and angle away from horizontal?

1 Answers 1

2

I'm not sure what it means for a draw from a bivariate normal distribution to be "one standard deviation" away from the mean. The contours are given by $\{x: (x - \mu) ^T \Sigma^{-1} (x - \mu) = k\}$ which is the same as $L^{-T}\{z: \|z\|^2 = k\} + \mu$ where $LL^T = \Sigma^{-1}$ is the Cholesky decomposition of the precision matrix, so just get the Cholesky decomposition and apply that affine transformation to a circle with radius $\sqrt k$ centred at the origin to get a contour. The quantity $(X - \mu)^T \Sigma^{-1} (X - \mu)$ has a $\chi^2_p$ distribution ($p = 2$ since we are dealing with bivariate normal, so it is exponential in this case), so one could take $k$ corresponding to quantiles of a $\chi^2_p$ to get contours corresponding to the quantiles of the distance from the mean with respect to the Mahalanobis metric.

  • 0
    If what you wanted was something like a contour representing one standard deviation in each direction, then it's simply $\{x:(x−μ)^T Σ^{−1} (x−μ)=1\}$ (so that each eigenvector/eigenvalue of $Σ$ gives the direction/magnitude of ellipsoid axis; if $Σ$ is diagonal, then each eigenvalue is precisely the std of the independent Gaussian in that dimension).2018-07-20