Multivariate normal distribution
The bridge between modules 2, 3, and 4. Module 2 introduces it as the joint distribution of a random vector ; module 3 uses it for the sampling distribution of in OLS; module 4 uses it as the class-conditional density in LDA and QDA. Same density, three roles. The exam-bait facts: contour ellipsoids tell you the covariance structure (CE1 1g); marginals are normal; zero covariance ⇒ independence under joint normality (only here).
Definition (prof’s framing)
“Today we’re going to talk about random vectors. We’re going to talk about the covariance matrix, correlation matrix, what those are, and also the normal distribution, in particular the multivariate case. And this is setting us up to talk about regression.” - L04-statlearn-3
“Do you guys know the relationship between the normal distribution and regression? … If you minimize the normal distribution, if you assume your data is normally distributed and you have it the mean parameterized by some model, then that’s equivalent to linear regression. So this multivariate case is a way of understanding how we do regression in multiple variables.” - L04-statlearn-3
For with mean vector and covariance matrix :
Reduces to the univariate normal when , “you have to go really, really far out, but you can see how it reduces down.” (L04-statlearn-3)
Returns in other modules
- L04-statlearn-3: first introduction. Cork-trees-as-running-example. Univariate Gaussian generalized to dimensions: becomes a vector, becomes , becomes in the exponent, in the normalizer becomes . Ran out of time mid-contour-matching.
- L05-linreg-1: finishes the contour-matching exercise from L04. Then makes the mindset shift from joint distribution to conditional , “we will look at how things co-vary, but in the sense of how Y varies as a function of X.” This is the bridge to regression. Under Gaussian errors, , a multivariate normal in parameter space.
- L09-classif-3: used as the class-conditional density in LDA and QDA. for LDA (shared ); uses for QDA. The whole module-4 generative-classifier story is multivariate normals. Naive Bayes = multivariate normal with diagonal (predictors conditionally independent given class).
Notation & setup
- : a -dimensional column vector.
- : the mean vector.
- : the covariance matrix: , with variances on the diagonal and covariances off.
- : determinant of . is bad ( singular), division by zero in the density, “yuck” (L04-statlearn-3).
- : the precision matrix. Plays the role of in the univariate case.
Notation: means has the multivariate normal distribution with mean and covariance .
Formula(s) to know cold
The density
Mapping the pieces from the univariate Gaussian:
| Univariate | Multivariate |
|---|---|
| (vector) | |
| (Mahalanobis distance) | |
| in normalizer | $ |
Useful properties (listed by the prof)
From L04-statlearn-3:
- Contours are ellipsoids. Level sets are ellipsoids centered at , oriented and stretched by .
- Linear combinations are normal. for any matrix and vector . (See contrasts.)
- Marginals are normal. Any subset of the components is multivariate normal in its own right.
- Conditionals are normal. is multivariate normal, this is what enables linear regression to be exact under joint normality.
- Zero covariance ⇒ independence, under joint normality only. This is special to Gaussians; in general, does not imply .
Use in OLS sampling
Under Gaussian errors :
the sampling distribution of the OLS estimator is a -variate normal. (sampling-distribution-of-beta for the full derivation; covered in module 3.)
Use in LDA/QDA discriminants
LDA assumes , pooled , class-specific means. Apply Bayes, take logs, drop -independent terms:
linear in , because the term is the same for every and drops out of the . (L09-classif-3)
QDA assumes class-specific → the quadratic term doesn’t cancel:
quadratic in , hence “Quadratic Discriminant Analysis.” (L09-classif-3, the prof flagged “where does the quadratic come from in QDA?” as a typical exam question.)
Insights & mental models
Reading contour plots (CE1 1g, the explicit exam-bait)
Two-dimensional MVN contours are ellipses. Reading them:
| Σ pattern | Contour appearance |
|---|---|
| , | Circle centered at , equal variances, no correlation |
| , | Axis-aligned ellipse stretched along the larger-variance axis |
| Ellipse tilted upward-right (positive diagonal) | |
| Ellipse tilted upward-left (negative diagonal) | |
| , | Tilted ellipse with the long axis closer to whichever variance is larger |
L05-linreg-1 worked through these explicitly:
- “Circular ellipse, no diagonal pull → correlation 0, equal variances.”
- “Diagonal pull going up → positive correlation.”
- “Diagonal pull going down → negative correlation.”
- “Stretched only along one axis → unequal variances, no correlation.”
Why MVN is load-bearing for the whole course
“Today we will discuss Y given X. So not the joint distribution of them, but Y given X. So we’re trying to essentially make a model of it… we will look at how things co-vary, but in the sense of how Y varies as a function of X.” - L05-linreg-1
MVN gives a joint model of . The conditional extracted from a joint MVN is linear in with constant variance, that’s exactly the linear regression model. So all the OLS sampling theory (CIs, t-tests, F-tests, prediction intervals) is exactly correct when joint normality holds and only approximately correct otherwise.
Why MVN is load-bearing for classification
LDA / QDA / Naive Bayes are all generative classifiers: model instead of . The choice of as multivariate normal is the modeling assumption for module 4’s generative half. Three flavors:
- LDA: , pooled covariance.
- QDA: , class-specific covariance.
- Naive Bayes: , predictors conditionally independent given class.
The “where does the quadratic come from” question is direct algebra on the MVN density.
Mahalanobis distance
The exponent of the MVN density is , where
is the Mahalanobis distance (squared), Euclidean distance after rotating and rescaling by . It’s the natural distance under joint normality. (Not on the syllabus by name, but the exponent of the density is exactly this.)
Conditional MVN, why linear regression works
If is jointly MVN with the appropriate block structure, then
linear in with constant variance. This is the linear regression model, derived from joint normality. The prof gestured at this in L04-statlearn-3 without writing it out, “the multivariate case is a way of understanding how we do regression in multiple variables.”
Singular Σ
“If the determinant is zero, then that’s typically bad, because you divide by zero and yuck. And I think that’s the point they’re trying to make.” - L04-statlearn-3
means the data lies on a lower-dimensional subspace; the density isn’t well-defined on the full -dim space. This is the same pathology as collinearity in OLS ( singular), extreme correlation between predictors. Fix: drop a variable, regularize, or use PCA.
Exam signals
“Today we will discuss Y given X. So not the joint distribution of them, but Y given X.” - L05-linreg-1 (the conditional → regression bridge)
“If you minimize the normal distribution, if you assume your data is normally distributed and you have it the mean parameterized by some model, then that’s equivalent to linear regression. So this multivariate case is a way of understanding how we do regression in multiple variables.” - L04-statlearn-3
“That’s another good exam question, where does the quadratic come from in QDA? Or show that, yeah… it’s an interesting point that simply by making the sigma -dependent, we introduced a new term, and that term is quadratic.” - L09-classif-3
CE1 problem 1g (matching contour plot to covariance matrix) is the direct exam-style application, the prof has explicitly drilled it into a compulsory exercise.
Pitfalls
- Zero covariance ⇒ independence is special to MVN. In general, does NOT mean , only under joint normality. Don’t carry this over to other distributions.
- Joint normality of marginals ≠ joint normality. Two normal marginals can have a non-Gaussian joint (counter-example: dependent normals concocted to be marginally Gaussian but jointly not). The MVN assumption is on the joint, not just on each component.
- breaks the density: handle singular cases via dimensionality reduction or regularization.
- Don’t read “the variance is on the diagonal” as a special property: it’s the definition of . Off-diagonal entries are covariances; rescaling to ‘s gives the correlation matrix.
- Standardization doesn’t make data multivariate normal: z-scoring sets means to 0 and variances to 1, but doesn’t change the joint shape. Skewed data stays skewed after standardization.
- Spectral / eigen-decomposition of Σ is OUT of scope. L04-statlearn-3 verbatim: “we don’t talk about spectral decomposition”, deferred to Linear Statistical Models. You can use the contour-stretching intuition without the full eigen-machinery.
- Pooled covariance is just a convex combination of class-specific covariances: . Don’t confuse it with the unconditional sample covariance.
- The MVN assumption is a modeling assumption, not a fact about your data, flagged for LDA/QDA in L09-classif-3: “Maybe it’s not a good idea to pretend that the X’s are well modeled by a Gaussian, that’s a good way to break a model.”
- Contour shapes are about , not : the mean vector just shifts the center of the ellipsoid; the shape and orientation are pure .
Scope vs ISLP
- In scope: the density formula, what each piece means, contour-matching, the role in LDA/QDA discriminants (with the where-does-the-quadratic-come-from derivation), zero-covariance ⇒ independence under normality, the basic properties (linear combos / marginals / conditionals stay normal).
- Look up in ISLP: §4.4.2 (LDA for , with the MVN density); §4.4.3 (QDA, where becomes ); §4.4.4 (Naive Bayes, where becomes diagonal).
- Skip in ISLP (book-only, prof excluded): spectral decomposition / eigenanalysis of - L04-statlearn-3: “we don’t talk about spectral decomposition”, deferred to Linear Statistical Models. The eigenvalue-as-PC-variance fact comes back in PCA (principal-component-analysis) but the full spectral theory of doesn’t.
Exercise instances
- Exercise2.4: simulate from a multivariate normal with
mvrnormunder four different covariance settings (uncorrelated equal var, uncorrelated unequal var, positive correlation, negative correlation). The hands-on version of the contour-matching exercise. - CE1 problem 1g: match a contour plot to a given covariance matrix. Single-choice question, explicit exam-style. → axis-aligned ellipse with the long axis along (variance 4 vs 1) and slight upward tilt (positive correlation 0.1).
How it might appear on the exam
- Contour-matching question (CE1 1g style): given a , pick the right contour plot. Or vice versa. Read the variances off the diagonal (which axis is longer?), read the correlation off the off-diagonal (tilted up or down? how much?).
- “Where does the quadratic come from in QDA?”: algebra on the MVN density: when is the same for all classes, the term cancels in ; when differs by class, the term survives → quadratic in .
- Derive the LDA discriminant from scratch: start from , take logs, drop -independent terms, end with . Same template applies to QDA but you keep the quadratic term.
- T/F: “Zero covariance implies independence”: depends on the assumption. Under joint normality, TRUE. In general, FALSE.
- T/F: “If and are each marginally normal, then is multivariate normal”: FALSE. Counter-examples exist.
- “Why is the MVN assumption sometimes a bad idea?”: flagged in L09-classif-3: real predictors aren’t always Gaussian; LDA/QDA suffer if the MVN class-conditional model is far off.
- Connection to OLS sampling: under Gaussian errors, is multivariate normal. From this you derive the sampling distribution (and CIs and t-tests).
Related
- random-vector-and-covariance: the build-up: , , expectation rules. Module 2 prerequisite.
- contrasts: linear combinations ; under MVN, is also MVN.
- linear-regression: the conditional of MVN gives the linear regression model exactly.
- gaussian-error-assumptions: the MVN of the error vector ; the assumption that makes OLS = MLE.
- least-squares-and-mle: OLS minimization is MLE under Gaussian errors. Direct consequence of the MVN density’s exponent.
- sampling-distribution-of-beta: under Gaussian errors, .
- linear-discriminant-analysis: uses MVN class-conditionals with pooled ; discriminants linear in .
- quadratic-discriminant-analysis: uses MVN class-conditionals with class-specific ; discriminants quadratic in .
- naive-bayes: uses MVN class-conditionals with diagonal ; predictors conditionally independent given class.
- discriminant-score-and-decision-boundary: derived from the MVN-based discriminants.
- principal-component-analysis: eigenvectors of give the directions of maximal variance under joint normality.