Hexa Scholar

The multivariate normal and its ellipses

A smooth oval clay hill on a navy base, ringed by gold elliptical contour lines that are tilted diagonally.
A tilted oval hill with its contour rings.

The question

Two scores are jointly normal with equal spreads and correlation 0.6. Among people 1.5 SDs above average on the first, where does the second center?

Stage 1 asks you to mark it on the picture before the page computes it.

  1. 1 SeeMark the center of a slice, three rounds.
  2. 2 TryCompare slices, then move ρ and the slice.
  3. 3 ProveComplete the square, line by line.
  4. 4 ApplyExam scores, stock returns and a contour.
Before you start · 3 quick checks on normal areas, covariance and conditional probability, about 3 min

Two ideas before you start

2 ideas

Equal height along ellipses

Figure: three nested contour ellipses of a bivariate normal density for the chosen correlation. It needs JavaScript.

ρ

ρ = 0.5: Q = (u² − uv + v²)/0.75 long axis along v = u

With u and v the values of X and Y in SD units, the density is a constant times e−Q/2, so it has the same height all along each ellipse Q = c². Drawn for c = 0.5, 1 and 1.5, with the long axis dashed.

Exact definition

Bivariate normal. Fix means \(\mu_X, \mu_Y\), standard deviations \(\sigma_X, \sigma_Y \gt 0\) and a number \(\rho\) with \(-1 \lt \rho \lt 1\). The pair \((X, Y)\) is bivariate normal when it has the joint density

\[\begin{aligned} f(x, y) &= \frac{1}{2\pi\sigma_X\sigma_Y\sqrt{1 - \rho^2}} \\ &\quad \cdot e^{-Q/2}, \end{aligned}\]

where, with \(u = (x - \mu_X)/\sigma_X\) and \(v = (y - \mu_Y)/\sigma_Y\),

\[Q = \frac{u^2 - 2\rho uv + v^2}{1 - \rho^2}.\]

Stage 3 shows that \(X \sim N(\mu_X, \sigma_X^2)\), \(Y \sim N(\mu_Y, \sigma_Y^2)\) and that \(\rho\) is their correlation. The level sets \(Q = c^2\) are ellipses centered at \((\mu_X, \mu_Y)\). When \(\sigma_X = \sigma_Y\) and \(\rho \ne 0\), their long axis lies along \(y - \mu_Y = x - \mu_X\) for \(\rho \gt 0\) and along \(y - \mu_Y = -(x - \mu_X)\) for \(\rho \lt 0\).

In \(n\) dimensions. A random vector \(X\) in \(\mathbb{R}^n\) is multivariate normal \(N(\mu, \Sigma)\), with \(\Sigma\) symmetric and positive definite, when it has the density

\[\begin{aligned} f(x) &= (2\pi)^{-n/2}(\det\Sigma)^{-1/2} \\ &\quad \cdot e^{-(x - \mu)^T\Sigma^{-1}(x - \mu)/2}. \end{aligned}\]

For \(n = 2\), \(\Sigma\) has the entries \(\sigma_X^2\), \(\rho\sigma_X\sigma_Y\), \(\rho\sigma_X\sigma_Y\), \(\sigma_Y^2\), and \((x - \mu)^T\Sigma^{-1}(x - \mu)\) is the \(Q\) above. The lesson on covariance ellipses shows how \(\Sigma\) sets the shape of these ellipses.

Cut a slice, then rescale it

Figure: the slice of a joint density along X = 1, drawn against y, and the same slice rescaled to area 1. It needs JavaScript.

Show

X = 1: slice f(1, y), area f_X(1) = φ(1) ≈ 0.242

Fixing X = 1 cuts a slice out of the joint density, drawn here with ρ = 0 and both SDs 1. Its area is fX(1); dividing by that area gives the density of Y given X = 1, with area 1.

Exact definition

Let \((X, Y)\) have a joint density \(f\). The density of \(X\) is \(f_X(x) = \int_{-\infty}^{\infty} f(x, y)\,dy\). For every \(x\) with \(f_X(x) \gt 0\), the conditional density of \(Y\) given \(X = x\) is

\[f_{Y \mid X}(y \mid x) = \frac{f(x, y)}{f_X(x)},\]

and the conditional mean is

\[\begin{aligned} &E[Y \mid X = x] \\ &= \int_{-\infty}^{\infty} y\,f_{Y \mid X}(y \mid x)\,dy, \end{aligned}\]

when the integral converges absolutely. It is the center of the rescaled slice. The lesson on conditional expectation explains why it is the best guess of \(Y\) once \(X\) is known.

In the figure \(\rho = 0\), so \(f(x, y) = \varphi(x)\varphi(y)\) with \(\varphi(t) = e^{-t^2/2}/\sqrt{2\pi}\): the solid slice is \(\varphi(1)\varphi(y)\), and the dashed rescaled slice is \(\varphi(y)\).

Fine print: more than two variables

If \(Z\) is a vector of \(n\) independent standard normal variables, \(A\) an \(n \times n\) matrix with \(AA^T = \Sigma\) invertible and \(\mu\) a fixed vector, then \(X = \mu + AZ\) is \(N(\mu, \Sigma)\). Every linear combination \(a^TX\) with \(a \ne 0\) of a multivariate normal vector is normal, and so is every marginal. If the coordinates of a multivariate normal vector are uncorrelated, they are independent.

Normal marginals alone do not make a pair jointly normal. If \(X\) is standard normal, \(S\) is \(\pm 1\) with probability \(\tfrac{1}{2}\) each and independent of \(X\), and \(Y = SX\), then \(Y\) is standard normal too, but \(X + Y = 0\) with probability \(\tfrac{1}{2}\), which no bivariate normal pair allows.

In \(n\) dimensions, \(Q = (X - \mu)^T\Sigma^{-1}(X - \mu)\) has the chi-square distribution with \(n\) degrees of freedom, described in the lesson on chi-square, t and F. For \(n = 2\) the ellipse \(Q = c^2\) holds probability \(1 - e^{-c^2/2}\).

1 See

Mark the center of a slice

How the game works

In every round \((X, Y)\) is bivariate normal, and the dotted vertical line is the slice \(X = x_0\): the outcomes where \(X\) takes the value \(x_0\). Your guess is the center of \(Y\) on that slice, \(E[Y \mid X = x_0]\). It moves in steps of 0.05 in rounds 1 and 2 and 0.1 in round 3. Both axes use the same scale, and each runs 4.25 SDs either side of its mean, so every ellipse and every slice density fits inside the figure. Check my guess locks the guess and draws the density of \(Y\) given \(X = x_0\) along the slice; a guess within 0.15 SD of \(Y\) of the center counts as close. After the third round a table compares your guesses with the centers. Start over clears everything.

2 Try

Compare slices, then explore

Answer the two questions first; the explorer opens after both.

The explorer and its goals open after you answer both questions.

3 Prove

Every slice of a bivariate normal is normal

Theorem

Let \(-1 \lt \rho \lt 1\) and let \((U, V)\) have the joint density

\[\begin{aligned} f(u, v) &= \frac{1}{2\pi\sqrt{1 - \rho^2}} \\ &\quad \cdot \exp\left(-\frac{u^2 - 2\rho uv + v^2}{2(1 - \rho^2)}\right). \end{aligned}\]

Then \(U\) is standard normal, and for every real \(u\), given \(U = u\), \(V\) is normal with mean \(\rho u\) and variance \(1 - \rho^2\).

This is the bivariate normal of the definition in SD units: \(U = (X - \mu_X)/\sigma_X\) and \(V = (Y - \mu_Y)/\sigma_Y\). Write \(\varphi_{m,\, s^2}\) for the density of \(N(m, s^2)\),

\[\begin{aligned} \varphi_{m,\, s^2}(t) &= \frac{1}{\sqrt{2\pi s^2}} \\ &\quad \cdot e^{-(t - m)^2/(2s^2)}, \end{aligned}\]

and \(\varphi = \varphi_{0,\, 1}\). Choose the true statement in each line.

What else follows

Back in the original units. With \(X = \mu_X + \sigma_X U\) and \(Y = \mu_Y + \sigma_Y V\), the event \(X = x\) is the event \(U = (x - \mu_X)/\sigma_X\), and \(Y\) is \(V\) stretched by \(\sigma_Y\) and shifted by \(\mu_Y\). So given \(X = x\), \(Y\) is normal with

\[\begin{aligned} &E[Y \mid X = x] \\ &= \mu_Y + \rho\,\frac{\sigma_Y}{\sigma_X}(x - \mu_X), \\ &\operatorname{Var}(Y \mid X = x) \\ &= \sigma_Y^2(1 - \rho^2). \end{aligned}\]

The marginals and the correlation. Line 3 shows that \(U\) is standard normal; \(f\) is symmetric in \(u\) and \(v\), so \(V\) is too. Averaging the slice centers over \(U\) gives \(E[UV] = E[U \cdot \rho U]\), which is \(\rho E[U^2] = \rho\), so \(\rho\) is the correlation of \(U\) and \(V\), and of \(X\) and \(Y\).

Where the line of centers meets the ellipses. On a vertical line \(x = x_1\), the joint density is \(f_X(x_1)\) times the slice density, so it is highest at the slice's center. The highest contour that the vertical line reaches therefore touches it at the center, where that contour's tangent is vertical. So the line of centers passes through the leftmost and rightmost points of every contour ellipse, while the long axis passes through the ends of the ellipses.

4 Apply

Problems

Each problem has hints and a full solution. Type each answer as a decimal, such as 0.25, or a fraction, such as 1/4.

Key point For a bivariate normal pair, knowing \(X = x\) leaves \(Y\) normal with mean \(\mu_Y + \rho\,(\sigma_Y/\sigma_X)(x - \mu_X)\) and standard deviation \(\sigma_Y\sqrt{1 - \rho^2}\). Every question about \(Y\) given \(X\) is then a one-variable normal question, and the prediction of \(X\) from \(Y\) uses the other line, \(\mu_X + \rho\,(\sigma_X/\sigma_Y)(y - \mu_Y)\).
Level Intermediate Prerequisites The normal distribution and its tail areas; covariance and correlation; conditional probability (refreshed in Before you start) Time ~40 min

Related: covariance ellipses treats the shape of the contours and the probability inside them, least squares fits a line of centers to data, and conditional expectation explains why the center of a slice is the best guess.

Further reading