Interactive demo · Probabilistic Machine Learning · Chapter 3

The bivariate Gaussian: ellipses, marginals and conditionals

The cloud of points is a sample from \(\mathcal N(\boldsymbol\mu,\boldsymbol\Sigma)\) in the plane. Its level sets of density are the ellipses of constant Mahalanobis distance \(\Delta^2=(\mathbf y-\boldsymbol\mu)^{\mathsf T}\boldsymbol\Sigma^{-1}(\mathbf y-\boldsymbol\mu)\), with axes along the eigenvectors of \(\boldsymbol\Sigma\). Fix \(y_2\) (the horizontal gold line; click the plot or use the slider) and the density of \(y_1\) given \(y_2\) is the slice through the surface: still Gaussian, with a mean that moves linearly with \(y_2\) and a variance that no longer depends on it.

Standard deviation of y1 σ1

Standard deviation of y2 σ2

Correlation ρ

Observed value y2 (distance from the mean, in units of σ2)

Sample (points shown)

Try these

Marginals: \(p(y_1)=\mathcal N(\mu_1,\sigma_1^2)\), obtained by reading off the entries of \(\boldsymbol\Sigma\) (3.27). Conditional (3.31): \(p(y_1\mid y_2)=\mathcal N\!\big(\mu_1+\rho\tfrac{\sigma_1}{\sigma_2}(y_2-\mu_2),\ \sigma_1^2(1-\rho^2)\big)\). In the iris preset the mean and covariance are the sample ones of the 150 flowers (sepal length, sepal width), so the fitted Gaussian ignores the three species.

In the lecture notes