plotting-uncertainty-ellipses

This Jupyter notebook demonstrates how to properly plot uncertainty (confidence) ellipses for 2D normally distributed data.

MIT License

Stars
6
Committers
1

How to Properly Plot Uncertainty Ellipses for 2D Normally Distributed Data

This notebook demonstrates how to properly plot ellipses that represent desired levels of uncertainty as given by the covariance matrix of normally distributed data in 2D. The reason for this note is that I have seen others naively extend 1D covariance bounds to 2D, which is not technically correct. The example is written in Python and uses Matplotlib.

Main Files

Sample Output

Here is an example 95 % confidence ellipse for 1000 sample points.

References

You can find a similar but partial treatment of this problem on the Matplotlib page called "Plot a confidence ellipse of a two-dimensional dataset". Vincent Spruyt also has a really nice and complete description on his page called "How to draw a covariance error ellipse?". We also employ the book Johnson and Wichern (2007) Applied Multivariate Statistical Anlaysis (6th ed.), Chapter 4, Result 4.7 on page 163.

Cite this Work

You may wish to cite this work in your publications.

Joshua A. Marshall, How to Properly Plot Uncertainty Ellipses for 2D Normally Distributed Data, 2020, URL: https://github.com/botprof/plotting-uncertainty-ellipses.

You might also use the BibTeX entry below.

@misc{Marshall2020,
  author = {Marshall, Joshua A.},
  title = {How to Properly Plot Uncertainty Ellipses for 2D Normally Distributed Data},
  year = {2020},
  howpublished = {\url{https://github.com/botprof/plotting-uncertainty-ellipses}}
}

License

Source code examples in this notebook are subject to an MIT License.