Analyse Statistique Multivariée Appliquée
Analyse Statistique Multivariée Appliquée
Abstract
The main goal of this course is to study multivariate statistical techniques, their conventional and
modern ideas, innovative statistical methods, and novel computational tools, as well as new applica-
tions. The topics covered include Multivariate Modeling and Inferences, Model Assessment, Principal
Components, Dimension Reduction, Classification, Cluster Analysis, if time permits, Nonparametric
Methods, Support Vector Machines, Latent Variable Models, Artificial Neural Networks and so on.
i
Notes for Applied Multivariate Statistical Analysis
Contents
§1 Review of Linear Algebra (2019/9/10) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 1
§2 Review of Linear Algebra Cont’d (2019/9/17) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 1
§3 Prediction (2019/9/19) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 3
§4 Prediction Cont’d & Multivariate Data (2019/9/24) · · · · · · · · · · · · · · · · · · · · · · · · · · 3
§5 Descriptive Statistics & Normal Distribution (2019/10/8) · · · · · · · · · · · · · · · · · · · · · · 4
§6 Multivariate Normal Distribution Cont’d & MLE (2019/10/15) · · · · · · · · · · · · · · · · · 6
§7 Maximum Likelihood Estimation Cont’d (2019/10/17) · · · · · · · · · · · · · · · · · · · · · · · · · 6
§8 Diagnostics for Normality & Matrix Distribution (2019/10/22) · · · · · · · · · · · · · · · · · 7
§9 Cochran’s Theorem & Hypothesis Testing (2019/10/29) · · · · · · · · · · · · · · · · · · · · · · · 9
§10 Hypothesis Testing Cont’d (2019/10/31) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 10
§11 Inferences about Multi-Population Means (2019/11/5) · · · · · · · · · · · · · · · · · · · · · · · · 11
§12 Multivariate Analysis of Variance (2019/11/12) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 13
§13 Linear Regression (2019/11/14) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 16
§14 Multivariate Linear Regression Cont’d (2019/11/19) · · · · · · · · · · · · · · · · · · · · · · · · · · 20
§15 Model Diagnostics and Selection (2019/11/26) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 22
§16 Model Selection Cont’d & Principal Components (2019/11/28) · · · · · · · · · · · · · · · · · 24
§17 Principal Component Analysis Cont’d (2019/12/3) · · · · · · · · · · · · · · · · · · · · · · · · · · · 26
§18 Canonical Correlation & Factor Analysis (2019/12/10) · · · · · · · · · · · · · · · · · · · · · · · · 27
§19 Factor Analysis Cont’d & Classification (2019/12/12) · · · · · · · · · · · · · · · · · · · · · · · · · 29
§20 Classification Cont’d (2019/12/17) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 30
§21 Classification Cont’d (2019/12/24) · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · 32
§22 Classification Cont’d & Final Review (2019/12/26) · · · · · · · · · · · · · · · · · · · · · · · · · · · 34
References
[JW] Richard A. Johnson, & Dean W. Wichern (2007). Applied Multivariate Statistical Analysis (6th ed.).
Pearson Prentice Hall. [Link]
[I] Alan J. Izenman (2008). Modern Multivariate Statistical Techniques: Regression, Classification, and
Manifold Learning. Springer-Verlag. [Link]
[JWHT] Gareth James, Daniela Witten, Trevor Hastie, & Robert Tibshirani (2013). An Introduction to
Statistical Learning, with Applications in R. Springer Science+Business Media. [Link]
1007/978-1-4614-7138-7
[G] Hui-Xuan Gao (2005). Applied Multivariate Statistical Analysis (in Chinese). Peking University Press.
[HS] Wolfgang K. Härdle, & Léopold Simar (2019). Applied Multivariate Statistical Analysis (5th ed.). Springer
Nature. [Link]
[K] Inge Koch (2013). Analysis of Multivariate and High-Dimensional Data. Cambridge University Press. https:
//[Link]/10.1017/CBO9781139025805
[V] Matthias Vallentin (Dec 19th , 2017). Probability and Statistics Cookbook. [Link]
[PP] Kaare B. Petersen, & Michael S. Pedersen (Nov 15th , 2012). The Matrix Cookbook. [Link]
[Link]/viewdoc/summary?doi=[Link].6244
ii
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
List of Figures
1 Difference between statistics and probability . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Insignificant interaction vs. significant interaction . . . . . . . . . . . . . . . . . . . . . . . . 15
3 Profile plot of a two-way ANOVA with an interaction effect . . . . . . . . . . . . . . . . . . 15
4 Projection in linear regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 PCA vs. OLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6 Orthogonal rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7 Oblique rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8 Maximum likelihood rule for univariate normal distributions . . . . . . . . . . . . . . . . . . 30
9 LDA decision boundary for bivariate normal distributions . . . . . . . . . . . . . . . . . . . 31
10 Fisher’s linear discriminant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
List of Tables
1 One-way MANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2 Distribution of Wilks’ Lambda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Two-way balanced MANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Confusion matrix in binary classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Get your facts first, and then you can distort them as much as you please. — Mark Twain
iii
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
The projection of x on y 6= 0n is
hx, yi
projy x = y.
hy, yi
Consider the linear model
Y = Xβ + ε,
where X = (x1 , . . . , xp ) ∈ R n×p
is called the design matrix. Usually, n is # of observations and p is # of
variables. We are often faced with trade-off between parsimony and goodness of fit.
Choosing the maximal linearly independent system of xk ’s leads to dimension reduction. Recall
that rank (X) is the maximum # of linearly independent columns/rows, i.e., the dimension of the column
space Col(X) or the row space Col(X ′ ).
Given a symmetric A ∈ Rn×n , the corresponding quadratic form is
x ∈ Rn 7→ x′ Ax ∈ R.
where λi ’s are eigenvalues and ei ’s are orthonormal eigenvectorsi) . Note that ei e′i = projei .
We say that Q ∈ Rn×n is an orthogonal matrix if Q′ Q = In . Any orthogonal matrix induces a map
preserving inner product, i.e.,
hQx, Qyi = hx, yi , ∀x, y ∈ Rn .
Write A = QΛQ′ with Q = (e1 , . . . , en ) and Λ = diag(λ1 , . . . , λn ). If y = Q′ x, then
X
n
x′ Ax = y ′ Λy = λk yk2 ,
k=1
which is closely related to ellipsoid when A is positive definite. For any analytic function f : R → R, we
can define
Xn
f (A) := f (λi )ei e′i .
i=1
One can justify this fact by a few calculations using orthonormal relations.
1
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
From the perspective of matrix completion, SVD provides the best low-rank approximation in that
X
m
σk uk vk′ = arg min tr ((X − Y )(X − Y )′ ) , ∀m ≤ rank (X) .
k=1 Y ∈Rn×p : rank(Y )≤m
ii) cf. [Link]
iii) cf. [Link]
2
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
§3 Prediction (2019/9/19)
Early statistics focused on inference. Nowadays, people are more concerned about prediction accuracy. The
AIC and BIC are frequently used for model selectioniv) . Generally, given data (X, Y ), we are longing for
where L stands for loss function such as L2 loss (risk) and 0-1 loss (cost).
• Let Ŷ = f (X) and L(ŷ, y) = |ŷ − y|2 , then
2
E[L(Ŷ , Y )|X] = E (Y − f (X))2 X = E (Y − E[Y |X])2 X + E[Y |X] − f (X) .
MSE Var Bias
Maximizing P(Y = g(x)|X = x) gives the naïve Bayesian classifier ĝ(x) — the most probable class
given x. We may treat y as a vector of dummy variables
(
continuous
numerical
discrete (counting)
Most data fall into one of two groups: (
nominal
categorical
ordinal
Given data (xi , yi )1≤i≤n , one may estimate
1 X
E[Y |X = x] ≈ yi ,
#{i : xi = x} x =x
i
where {1 ≤ i ≤ n : xi = x} is the effective sample. If we replace it with the neighborhood Nk (x), referred
to as k-nearest neighbor (kNN), the kernel estimation (or kNN classifier) will come up. The case k = 1
results in perfectv) fit, where no data reduction exists, and hereby the variance tends to explode even though
the bias may vanish. The case when k is large will see larger bias and smaller variance. Anyway, we are
desired to obtain suitable effective sample size, which could be rather difficult in real world.
3
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
density function fX ∈ C 2 , where hx is the neighborhood size (bandwidth). Trade-off between variance and
bias provides the minimizer h∗ ∝ n−1/5 and the minimum MSE(h∗ ) ∝ n−4/5 . Note that the parametric
model has MSE ∝ n−1 . Generally, one may encounter
A
MSE(hx ) = + Bhbx ,
nhdx
where d denotes the dimension and b is twice the order of differentiability of fX . The optimal results are
h∗ ∝ n−1/(d+b) and MSE(h∗ ) ∝ n−b/(d+b) . For efficiency, we should always require h → 0 and nhd → ∞ as
the sample size n tends to infinity. See also exercise 5 in homework 1 for example.
The object to be studied is data matrix, which consists of observations and variables, denoted by
′
X1
..
X = (xij )1≤i≤n
1≤j≤p = . = (X(1) , . . . , X(p) ).
Xn′
To check data quality, one may plot histogram, boxplot, pairwise scatter plots, etc. The concept of outlier
is subtle, which suggests some alert. Exploratory data analysis helps finding structures in data —
pattern, describe, visualize, PCA, cluster, etc. These are nonparametric (model-free) approaches, also
called unsupervised learning. Confirmatory data analysis is model-based, including statistical inference
and prediction. In other words, we assume
The model is wished both parsimony (as simple as possible, causing larger bias) and fidelity (adequate to
describe data, causing larger variance). It’s worth noting thatvi)
all models are wrong, but some are useful. — George E. P. Box
1X
n
X̄ = (x̄1 , . . . , x̄p )′ , x̄j = xij for 1 ≤ j ≤ p.
n i=1
1 X
n
S = (sjk )1≤j,k≤p , sjk = (xij − x̄j )(xik − x̄k ).
n − 1 i=1
1 X
n
S= (Xi − X̄)(Xi − X̄)′
n − 1 i=1
vi) see [Link] for more fun.
4
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
guarantees the unbiasedness ES = Σ. PnTo see this, one can plug EXi Xi′ = Σ + µµ′ and EX̄ X̄ ′ = n1 Σ + µµ′
′ ′
into the expectation of (n − 1)S = P i=1 Xi Xi − nX̄ X̄ , and thus the corresponding degree of freedom
n
(d.o.f.) is n − 1 since one constraint i=1 (Xi − X̄) = 0 is imposed. Also, the MLE (see Lecture §7)
1
Σ̂n = (Xi − X̄)(Xi − X̄)′
n
for Σ in Gaussian setting is biased. In matrix language, X̄ = n1 X ′ 1n and (n − 1)S = X ′ (In − n1 1n 1′n )X.
Denote the centering matrix by
H = In − n1 1n 1′n ⊥ n1 1n 1′n .
Clearly H = H ′ = H 2 is symmetric and idempotent, and thus rank (H) = tr (H) = n − 1.
Probability theory deduces the underlying structure of observed data/samples. Statistical inference
aims to learn unknown (or ad hoc) population/distribution/parameters from the observations.
The crucial part is Σ−1 , called the precision matrix, which is important in graphical models. Generally,
independence implies uncorrelatedness, but not vice versa. If random p-vector X1 and random q-vector X2
are jointly normal, then Cov(X1 , X2 ) = 0 if and only if X1 ⊥⊥ X2 . The conditional distribution is more
complicated, involving some matrix holing tricksviii) . Some frequently used properties are as follows:
i) X ∼ Np (µ, Σ) =⇒ AX + b ∼ Nq (Aµ + b, AΣA′ ) for A ∈ Rq×p and b ∈ Rq ;
ii) if a′ X ∼ N (a′ µ, a′ Σa) for any a ∈ Rp , then X ∼ Np (µ, Σ);
√
iii) X ∼ Np (µ, Σ) ⇐⇒ E exp(it′ X) = exp it′ µ − 12 t′ Σt , t ∈ Rp , where i = −1.
vii) from Herman Bennett’s 14.30 Introduction to Statistical Method in Economics. Spring 2006. [Link]
viii) cf. [Link]
5
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Note that E[X1 |X2 ] = µ1 + Σ12 Σ−1 22 (X2 − µ2 ) minimizes E|Z − X1 | among all Z = g(X2 ), i.e., the
2
conditional expectation is the population version of the best linear prediction, compared to the sample
−1
version Ŷ = Ȳ + SY X SXX (X − X̄) in linear regressionix) (see Lecture §13).
We now explore the maximum likelihood estimation (MLE) for θ ∈ Θ given a sample x1 , . . . , xn . The
likelihood function is the joint density
Y
n
Ln (θ|x1 , . . . , xn ) = f (x1 , . . . , xn |θ) = f (xi |θ).
i=1
To justify the MLE, suppose Xi ’s are i.i.d. with p.d.f. f0 = f (·|θ0 ). Shannon’s entropy inequality states
that
E log f (X) ≤ E log f0 (X)
for any p.d.f. f = f (·|θ), with equality holding if and only if f = f0 almost everywhere. Note that the
identifiablity means
θ1 6= θ2 ⇐⇒ f (·|θ1 ) 6= f (·|θ2 ).
By SLLN, n1 ℓn (θ) → Elog f (X|θ) almost surely as n → ∞, so the maximizer θ̂nMLE of ℓn (·) seems reasonable
to estimate the true parameter θ0 . Under some mild assumptions, θ̂nMLE is consistent, as desired.
closer to the mean or average on its second measurement and if it is extreme on its second measurement but closer to the
average on its first.
x) a statistic T = T (X) is said to be complete for θ ∈ Θ if, E f (T ) = 0 for all θ ∈ Θ implies f (T ) = 0 a.s., and thus T
θ
appears to be successful in reducing the data.
6
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
To derive MLEs, we can use matrix differentiationxi) as well. For symmetric positive definite A = (aij ),
Note that X̄ ∼ Np (µ, n1 Σ) is independent of nΣ̂MLE ∼ Wp (Σ, n − 1). See Lecture §9 for the Wishart
distribution. As the sample size n → ∞, the following large sample properties hold:
• X̄ →P µ, Σ̂ →P Σ;
√
• n(X̄ − µ) →d Np (0p , Σ);
and (check!)
∂
−Eθ Sn (θ) = Eθ [Sn (θ)Sn (θ)′ ] = Varθ (Sn (θ))
∂θ′
is exactly the Fisher information In (θ). Note that In (θ) = nI1 (θ). As n → ∞,
√
• n(θ̂MLE − θ) →d Np 0p , I1 (θ)−1 ;
i − 21
Φ(q(i) ) = , 1 ≤ i ≤ n.
n
Plot x(i) against q(i) , and then compare it to a line. If Xi ∼ Np (µ, Σ) are multivariate, then
Sort d2i to obtain sample quantiles d2(i) , and plot them against theoretical quantiles of χ2p .
xi) cf. [Link]
7
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
To detect outliers and clean data, one may plot histogram or dot plot for each variable, and pairwise
scatterplot for each pair. Sometimes we prefer standardized variable
xik − x̄k
zik = √ , 1 ≤ i ≤ n, 1 ≤ k ≤ p.
skk
Note that judging outliers should take both n and p into consideration. The empirical 3σ rulexii) is not
always appropriate.
Transforms are used to normalize univariate data, including
√
• y ∈ N 7→ y for counts;
• logit : y ∈ [0, 1] 7→ log 1−yy
for proportions;
• r ∈ [−1, 1] 7→ log 1−r 1+r
for correlation coefficients;
(
(xλ − 1)/λ, λ > 0
• Box-Cox transform x 7→ x = (λ)
, where λ is a tuning parameter to maximize
log(x), λ=0
P Pn
n (λ) 2
ℓ(λ) = − n2 log n1 i=1 xi − x(λ) + (λ − 1) i=1 log(xi ), or equivalently, to minimize the sample
(λ) xλi −1
variance of yi := ∏
λ( n (λ−1)/n . For multivariate data, we often choose λk for Xik separately,
j=1 xj )
pretending the components are independent.
i.i.d.
Next, multivariate data should be tackled. If X1 , . . . , Xn ∼ Np (µ, Σ), then it is said that
′
X1
..
X = . = (X(1) , . . . , X(p) ) ∼ MNn×p (1n µ′ , In , Σ)
Xn′
is a normal matrix with p.d.f.
−n/2 1 −1 ′ ′ ′
f (X) = det(2πΣ) exp − tr Σ (X − 1n µ ) (X − 1n µ ) .
2
8
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
X
n−1
nΣ̂ = (n − 1)S = X ′ HX = Y ′ ΛY = Yi Yi′ ∼ Wp (Σ, n − 1).
i=1
9
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
−2 log(Λ) →d χ2dim(Θ)−dim(Θ0 ) .
Pn
where Σ̂ = 1
n i=1 (Xi − X̄)(Xi − X̄)′ , and
−1 1
Λ−2/n = 1 + n(X̄ − µ0 )′ ((n − 1)S) (X̄ − µ0 ) = 1 + T 2.
n−1
To test H0 : θ = θ0 in other ways, denoting by θ̂ = arg maxθ∈Θ L(θ) the unconstrained MLE,
• the Wald test employs
∂ log L(θ)
where U (θ) = ∂θ is the score.
The three tests above are equivalent for large samples. An advantage of the Wald test over the other two
is that it only requires the estimation of the unrestricted model, which lowers the computational burden.
The score test only requires the estimation of the likelihood function under the null hypothesis, and thus
it is less specific than the other two tests about the precise nature of the alternative hypothesisxvi) .
xvi) a.k.a. the research hypothesis, being more important and meaningful than the null hypothesis (benchmark).
10
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
The multiple testing problem occurs when one considers a set of statistical inferences simultaneously.
i.i.d.
Let X1 , . . . , Xn ∼ Np (µ, Σ) with Σ unknown. For any single a ∈ Rp ,
√
n(a′ X̄ − a′ µ)
T (a) = √ ∼ tn−1
a′ Sa
q
′
gives a 100(1 − α)% confidence interval a′ X̄ ± tn−1 ( α2 ) a nSa for a′ µ. To obtain some c > 0 such that
n o
2
P |T (a)| ≤ c2 , ∀a ∈ Rp = 1 − α,
note that
2
n a′ (X̄ − µ)
= n(X̄ − µ)′ S −1 (X̄ − µ) = T 2
2
max |T (a)| = max
a a a′ Sa
by Cauchy-Schwarz inequality, so
\ q !
′ ′ (n−1)p a′ Sa
P a µ ∈ a X̄ ± n−p Fp,n−p (α) n ≥ 1 − α.
a∈Rp
p q
(n−1)p
In other words, replacing tn−1 ( α2 ) = F1,n−1 (α) with n−p Fp,n−p (α) yields simultaneous confidence
intervals for all possible linear functions of µ.
When a small number of statements are of interest, the Bonferroni correction can be used to adjust
confidence intervals. If P(Ck ) = 1 − αk for 1 ≤ k ≤ m, then
X
P(∩Ck ) = 1 − P(∪Ck{ ) ≥ 1 − αk ,
\m q !
′ ′ a′ Sa
P ak µ ∈ ak X̄ ± tn−1 ( 2m )
α
n ≥ 1 − α, ∀a1 , . . . , am ∈ Rp .
k=1
−1 (n − 1)p
= nD̄′ SD
H
2
TD D̄ ∼0 T 2 (p, n − 1) = Fp,n−p .
n−p
If C ∈ Rq×p has full row rank q ≤ p, then the statistic used to test the constraint
H0 : Cµ = ν0 (= 0q )
i.i.d.
on the population mean µ ∈ Rp of Xi ∼ Np (µ, Σ) is
(n − 1)q
T 2 = n(C X̄ − ν0 )′ (CSC ′ )−1 (C X̄ − ν0 ) ∼0
H
Fq,n−q ,
n−q
since CXi ∼ Nq (Cµ, CΣC ′ ). Note that T 2 does not depend on the particular choice of C, i.e., T 2 computed
with C̃ instead of C yields the same result provided that C̃ = QC for some invertible Q ∈ Rq×q .
A contrast is a linear combination of variables whose coefficients add up to zero. Attention is usually
centered on contrasts when comparing different treatments. The example at the beginning introduces
C = (Ip , −Ip ) as a contrast matrix xvii) , from which Di = CXi , D̄ = C X̄ and SD = CSX C ′ are derived.
xvii) cf. [Link]
11
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
In repeated measurements, subjects i are assumed independent, but treatments j within each subject are
dependent, which differs from that in one-way univariate ANOVA (see also Lecture §12). The responses
are
xij = µj + εij , i = 1, · · · , n; j = 1, · · · , p.
i.i.d.
Here εi = (εi1 , . . . , εip )′ ∼ Np (0p , Σ) are random errors. In order to test H0 : µ1 = µ2 = · · · = µp , one
may take
1 −1 1 −1
1 −1 1 −1
C= .. .. or . .. ∈ R(p−1)×p ,
. . .. .
1 −1 1 −1
each of which gives
(n − 1)(p − 1)
T 2 = n(C X̄)′ (CSC ′ )−1 (C X̄) ∼0
H
Fp−1,n−p+1 .
n−p+1
If we write µj = µ + αj , then (µ, α1 , . . . , αp )′ ∈ Rp+1 is not identifiable/estimable,
Pp but H0 : α1 = · · · = αp
is indeed estimable and thus can be tested. It’s often imposed that j=1 αj = 0.
i.i.d.
Next, we will compare means from two populations. Suppose X11 , . . . , X1n1 ∼ Np (µ1 , Σ1 ) and
i.i.d.
X21 , . . . , X2n2 ∼ Np (µ2 , Σ2 ) are two independent samples. The goal is to test H0 : µ1 = µ2 . As-
sume Σ1 = Σ2 . Note that the first-order information is meaningful only if the second-order information
keeps almost the same. Denote
1 X
nk
X̄k = Xki
nk i=1
and
1 X
nk
12
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
(n1 + n2 − 1)(p − 1)
(n1 + n2 )X̄ ′ C ′ (CSC ′ )−1 C X̄ ∼0
H
Fp−1,n1 +n2 −p+1 ,
n1 + n2 − p + 1
where X̄ and S are based on all n1 + n2 observations.
Xℓr = µ + τℓ + εℓr (r = 1, · · · , nℓ ; ℓ = 1, · · · , g)
(observation) (overall mean) (the ℓth treatment effect) (error)
represents the p-dimensional response under the ℓth treatment in the rth replication, where the constraint
Pg i.i.d.
ℓ=1 nℓ τℓ = 0p is specified. The errors are assumed to be εℓr ∼ Np (0p , Σ), which only influences the
distribution of the test statistic.
ANOVA is a special case of linear models (see Lecture §13), and here
X11 ε11
.. ..
. .
1n1 ⊗ Ip 1n1 ⊗ Ip µ
X1n1 ε1n1
1n2 ⊗ Ip 1n2 ⊗ Ip
.. τ1 ..
. = .. .. . + ,
. . .. .
Xg1 εg1
1ng ⊗ Ip 1ng ⊗ Ip np×(g+1)p τg (g+1)p×1
. .
.. ..
Xgng np×1 εgng np×1
Pg
where n = ℓ=1 nℓ is the total number of observations. Note that
13
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Pg
We summarizePthe variations in table 1. The within SSP can be expressed as W = ℓ=1 (nℓ − 1)Sℓ ,
(Xℓr − X̄ℓ· )(Xℓr − X̄ℓ· )′ is the sample covariance matrix for the ℓth treatment, and
nℓ
where Sℓ = nℓ1−1 r=1
Pg
thus the corresponding d.o.f. is ℓ=1 (nℓ − 1) = n − g.
The hypothesis of no treatment effects, H0 : τ1 = · · · = τg = 0p , can be tested using Wilks’ Lambda
det(W )
Λ∗ = ,
det(B + W )
n/2
det(Σ̂) 1
which is equivalent to Λ = det(Σ̂0 )
in the likelihood-ratio test, where Σ̂ = nW is the unrestricted
1 ∗
MLE and Σ̂0 = n (B + W ) is the restricted MLE. Therefore, we reject H0 if Λ < c for some c.
The s-way ANOVA model with s ∈ N may be handled in a similar manner. Suppose that there are two
factors under consideration. Proceeding by analogy, the two-way balanced MANOVA model reads
Xℓkr = µ + αℓ + βk + γℓk + εℓkr , ℓ = 1, · · · , g; k = 1, · · · , b; r = 1, · · · , n,
Pg Pb Pg Pb i.i.d.
where ℓ=1 αℓ = k=1 βk = ℓ=1 γℓk = k=1 γℓk = 0p , and εℓkr ∼ Np (0p , Σ). Note that
Xℓkr = X̄··· + (X̄ℓ·· − X̄··· ) + (X̄·k· − X̄··· ) + (X̄ℓk· − X̄ℓ·· − X̄·k· + X̄··· ) + (Xℓkr − X̄ℓk· ),
=µ̂ =α̂ℓ =β̂k =γ̂ℓk =ε̂ℓkr
where a dot is used to denote averaging over the indicated subscript. Accordingly, the partition of sums of
squares and cross products (SSP) is
∑
g
∑
b ∑
n ∑
g
(Xℓkr − X̄··· )(Xℓkr − X̄··· )′ = bn(X̄ℓ·· − X̄··· )(X̄ℓ·· − X̄··· )′
ℓ=1 k=1 r=1 ℓ=1
∑
b
+ gn(X̄·k· − X̄··· )(X̄·k· − X̄··· )′
k=1
∑
g
∑
b
+ n(X̄ℓk· − X̄ℓ·· − X̄·k· + X̄··· )(X̄ℓk· − X̄ℓ·· − X̄·k· + X̄··· )′
ℓ=1 k=1
∑
g
∑
b ∑
n
+ (Xℓkr − X̄ℓk· )(Xℓkr − X̄ℓk· )′ .
ℓ=1 k=1 r=1
14
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Ordinarily, the test for interaction γℓk is conducted before the tests for main effects αℓ , βk . If interaction
effects exist, the factor effects will not have a clear interpretation. An interaction effect means that the
Figure 2: Insignificant interaction (upper half) vs. significant interaction (lower half)
effect of one factor depends on the other factor, and it’s indicated by the lines in our profile plot not running
parallel. Figure 3 shows 4(medicine) × 2(gender) = 8 observed mean BDI scores. In this case, the effect
for medicine interacts with gender, i.e., medicine affects females differently from males. Roughly speaking,
the red line (Female) descends quite steeply from “None” to “Pharmaceutical” whereas the blue line (Male)
is much more horizontal. Depending on gender, the main effect of medicine obscures –rather than clarifies–
how medicine really affects the BDI scores, and thus should be ignored even if it’s statistically significant.
xviii) from [Link]
15
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
det(SSPres )
Λ∗ =
det(SSPint + SSPres )
with h i
log Λ∗ −−→ χ2(g−1)(b−1)p .
p+1−(g−1)(b−1) d
− gb(n − 1) − 2 H0
det(SSPres )
Λ∗1 =
det(SSPfac1 + SSPres )
with h i
log Λ∗1 −−→ χ2(g−1)p .
p+1−(g−1) d
− gb(n − 1) − 2 H0
det(SSPres )
Λ∗2 =
det(SSPfac2 + SSPres )
with h i
log Λ∗2 −−→ χ2(b−1)p .
p+1−(b−1) d
− gb(n − 1) − 2 H0
yi = β ′ xi + ε i , i = 1, · · · , n,
where the response yi is one-dimensional and β ∈ Rp consists of unknown parameters β1 , . . . , βp . When the
explanatory variables xi1 , . . . , xip are more than one (i.e., p > 1), the model is called multiple regression,
compared to simple linear regression yi = a + bzi + εi . These n equations are often stacked together and
written in matrix notation as
y = Xβ + ε,
where
y1 x′1 x11 x12 ... x1p β1 ε1
y2 x′2 x21 x22 ... x2p β2 ε2
y = . , X= . = . .. .. , β = . , ε = . .
.. .. .. . . .. ..
yn x′n xn1 xn2 ... xnp βp εn
Besides, the errors are assumed to satisfy that Eεi = 0, Var(εi ) = σ for some unknown σ 2 > 0, and
2
Eε = 0n & Var(ε) = σ 2 In .
Note that the generalized inverse (X ′ X)− of X ′ X ∈ Rp×p may not be well-defined. Nevertheless, the
(ordinary) least squares estimator of β refers unambiguously to
β̂OLS = (X ′ X)+ X ′ y = X + y,
xix) cf. [Link]
16
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
taking advantage of the unique Moore–Penrose inversexx) . Denote rank (X) = r ≤ p, then X = X∗ C for
some X∗ ∈ Rn×r and C ∈ Rr×p . Let β∗ = Cβ ∈ Col(C) = Rr . It follows that
Xβ = X∗ Cβ = X∗ β∗ .
E[c′ β̂] = l′ PX Ey = l′ PX Xβ = l′ Xβ = c′ β.
E[l′ y] = c′ β, ∀β ∈ Rp .
In summary, Aβ with A ∈ Rq×p is estimable iff Col(A′ ) ⊂ Col(X ′ ), i.e., A = A∗ X for some A∗ ∈ Rq×n .
Particularly, β is estimable if and only if X has full column rank.
Sometimes denoted by H as well, the projection matrix PX = X(X ′ X)− X ′ is also named hat matrix
as it “puts a hat on y”, mapping the vector of response values to the vector of fitted values
ŷ = X β̂ = Hy.
17
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
We may view the design matrix from the SVD (see Lecture §2)
X
r
X = U D V′ = dj uj vj′
(n×p) (n×n)(n×p)(p×p)
j=1
diag(d1 , . . . , dr , 0, · · · , 0)
= (u1 , . . . , un ) (v1 , . . . , vp )′ .
0(n−p)×p
X
r
X ′X = d2j vj vj′ .
j=1
X
r
XX ′ = d2j uj u′j .
j=1
X
r
PX = X(X ′ X)− X ′ = uj u′j = Ur Ur′ ,
j=1
and thus
X
r X
n
PX y = hy, uj i uj , & (In − PX )y = (U U ′ − Ur Ur′ )y = hy, uj i uj .
j=1 j=r+1
The above results are extendable to infinite-dimensional separable Hilbert spaces, e.g., Fourier expansions.
In multivariate regression,
′
Yi = β Zi + Ui , i = 1, · · · , n,
(p×1) (r×p) (r×1) (p×1)
i.i.d.
where Ui ∼ (0p , Σ) for some unknown Σ = (σjk ) ∈ Rp×p . Denote
′ ′
Y1 Z1 U1′
.. ..
Y = . = (Y(1) , . . . , Y(p) ), Z = . , β = β(1) , . . ., β(p) , U = ... = (U(1) , . . . , U(p) ).
...
Yn′ Zn′ (r×1) (r×1)
Un′
18
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Henceforth,
Y = Z β + U ,
(n×p) (n×r)(r×p) (n×p)
where Var(U(j) ) = σjj In and Cov(U(j) , U(k) ) = σjk In . The method of least squares yields β̂(j) = (Z ′ Z)− Z ′ Y(j) ,
so
β̂ = β̂(1) , . . . , β̂(p) = (Z ′ Z)− Z ′ Y
minimizes the total variation
X
p
β 7→ tr ((Y − Zβ)′ (Y − Zβ)) = (Y(j) − Zβ(j) )′ (Y(j) − Zβ(j) )
j=1
For instance, Ŷ = n1 1n 1′n Y = Ȳ 1n if Z = 1n , and all formulae above may come into play.
Assume that the design matrix Z ∈ Rn×r has full column rank, in which case β = (β(1) , . . . , β(p) ) ∈ Rr×p
is estimable. We now investigate properties of β̂ = (Z ′ Z)−1 Z ′ Y , the least squares estimator. First,
Eβ̂ = (Z ′ Z)−1 Z ′ EY = (Z ′ Z)−1 Z ′ Zβ = β,
which demonstrates that β̂ is unbiased for β, and thus EÛ = 0n×p . Second,
Cov(β̂(j) , β̂(k) ) = (Z ′ Z)−1 Z ′ Cov(U(j) , U(k) )Z(Z ′ Z)−1 = σjk (Z ′ Z)−1
for 1 ≤ j, k ≤ p. Third,
Cov(β̂(j) , Û(k) ) = (Z ′ Z)−1 Z ′ Cov(U(j) , U(k) )(In − Z(Z ′ Z)−1 Z ′ ) = σjk (Z ′ Z)−1 (Z ′ − Z ′ ) = 0r×n .
When it comes to error terms, note that
′ ′ ′
E[Û(j) Û(k) ] = E[U(j) (In − PZ )U(k) ] = tr (In − PZ )E[U(k) U(j) ] = σkj tr (In − PZ ) = (n − rank (Z))σjk .
1
Thus, n−rank(Z) E[Û ′ Û ] = Σ, and Σ̂ = n−rank(Z)
1
Û ′ Û is called the within-sample MSExxi) of the predictor.
Prediction of a new observation is more uncertain than estimating the expected value. See also exercise 7
in homework 1. Consider
Y0 = β ′ z0 + U0
(new response) (expected value) (new error)
at z0 ∈ R . Suppose that Z ∈ R
r n×r
has full column rank, then z0′ β̂ is an unbiased predictor of z0′ β. The
forecast error is
Y0 − β̂ ′ z0 = (β − β̂)′ z0 + U0 ,
whose covariance matrix consists of
Cov(z0′ (β(j) − β̂(j) ), z0′ (β(k) − β̂(k) )) + Cov(U0,j , U0,k ) = σjk [1 + z0′ (Z ′ Z)−1 z0 ], 1 ≤ j, k ≤ p.
In short, Var(Y0 − β̂ ′ z0 ) = [1 + z0′ (Z ′ Z)−1 z0 ]Σ, where z0′ (Z ′ Z)−1 z0 ≥ 0.
xxi) the definition of the mean squared error differs according to whether one is describing a predictor or an estimator (see
19
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Y = Z β + U ,
(n×p) (n×r)(r×p) (n×p)
has full column rank so that β is estimable (see Lecture §13); otherwise, we may pick out some maximal
linearly independent columns of Z, resulting in dimensionality reduction of covariates. Denote by
β̂ = (Z ′ Z)−1 Z ′ Y = β + (Z ′ Z)−1 Z ′ U
the least squares estimator (LSE) of β. Note that the rows of the error term U are uncorrelated zero-mean
random vectors, whose covariance matrices are identically Σ ∈ Rp×p , an unknown nuisance parameter.
The Gauss–Markov theorem claims that β̂ is the best linear unbiased estimator (BLUE) of β, in
the sense that for any c′ β (c ∈ Rr ), of the estimators l′ Y (l ∈ Rn ) that are unbiased, c′ β̂ has minimum
covariance matrix in Loewner order.
Proof. Since c′ β = E[l′ Y ] = l′ Zβ for all β, we have c = Z ′ l. To show that vec(c′ β̂) = vec(l′ PZ Y ) =
(Ip ⊗ (l′ PZ )) vec(Y ) has smaller covariance matrix than vec(l′ Y ) = (Ip ⊗ l′ ) vec(Y ), direct calculations yield
Var(vec(c′ β̂)) = (Ip ⊗ (l′ PZ ))(Σ ⊗ In )(Ip ⊗ (l′ PZ ))′ = (l′ PZ l)Σ
where Û = Y − Ŷ = (In − PZ )Y has Ûi = Yi − β̂ ′ Zi as its rows. To see this, notice that the SSP of
is
X
n X
n X
n
(Yi − β ′ Zi )(Yi − β ′ Zi )′ = Ûi Ûi′ + (β̂ − β)′ Zi Zi′ (β̂ − β) = Û ′ Û + (β̂ − β)′ Z ′ Z(β̂ − β),
i=1 i=1 i=1
Combined with exercise 2 in homework 2, the decomposition of SSP makes the expressions of β̂ MLE and
Σ̂MLE clear. Since Σ̂MLE is biased, the unbiased Σ̂MoM = n−r
1
Û ′ Û (method of moments estimator) prevails
in linear regression. Note that
nΣ̂MLE = Y ′ (In − Z(Z ′ Z)−1 Z ′ )Y = (Y − Zβ)′ (In − PZ )(Y − Zβ) = U ′ (In − PZ )U ∼ Wp (Σ, n − r),
not depending on β.
β1
After estimation, let’s get down to inferences, say, the likelihood-ratio test (LRT). Write β = and
β2
Z = (Z1 , Z2 ) such that β1 ∈ Rq×p , β2 ∈ R(r−q)×p , Z1 ∈ Rn×q , and Z2 ∈ Rn×(r−q) for some q < r. Then,
Y = Z1 β1 + Z2 β2 + U.
20
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
H
and nΣ̂MLE
0 ∼0 Wp (Σ, n − q).
Recall that
M mp
T 2 = d′ ( )−1 d ∼ T 2 (p, m) = Fp,m−p+1
m m−p+1
when d ∼ Np (0p , Σ) ⊥⊥ M ∼ Wp (Σ, m). For any z0 ∈ Rr , we have
21
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
y = X β + ε .
(n×1) (n×p)(p×1) (n×1)
The diagonal elements of H are called the leverages (i.e., influential points). Note that
X
n
hii = tr (H) = rank (H) = rank (X) ,
i=1
and X
hii (1 − hii ) = h2ij ≥ 0 =⇒ hii ∈ [0, 1].
j̸=i
If hii % 1, then X
ŷi = hii yi + hij yj
j̸=i
reflects more contribution from yi . However, for prediction, we hope that yj (j 6= i) contribute to ŷi as
much as possible, while yi contributes to ŷi as even as possible.
It is imperative to examine the adequacy of the model before making decisions. Since
22
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
y = Xp βp + ε, p = 1, · · · , m
where Xp ∈ Rn×p form a nested sequence X1 ⊂ X2 ⊂ · · · ⊂ Xm , e.g., splines with more and more knots,
or Fourier expansions of higher and higher order. The method of least squares yields β̂p = (X′p Xp )−1 X′p y,
and thereby
µ̂p = Xp β̂p = Xp (X′p Xp )−1 X′p y = Pp y.
Clearly, the bias
bp = µ − Eµ̂p = (In − Pp )µ
decreases in p. Particularly, if µ = Xp∗ βp∗ for some p∗ , i.e., the true model belongs to the candidate class,
then bp = 0n for all p ≥ p∗ . Besides, the mean squared error of µ̂p ,
2 2 2 2 2
dp := E kµ̂p − µk = E kPp ε − (In − Pp )µk = E kPp εk + k(In − Pp )µk = pσ 2 + kbp k ,
2
decomposes into its variance pσ 2 and its squared bias kbp k . Generally, the optimal p can be estimated by
where the estimate dˆp of dp should be specified. Since the sum of squared errors for the candidate model
with p covariates,
2 2
SSEp = ky − Xp β̂p k2 = k(In − Pp )(µ + ε)k = kbp + (In − Pp )εk ,
satisfies that
2 2 2
ESSEp = E k(In − Pp )εk + kbp k = (n − p)σ 2 + kbp k ,
we can define
dˆp = SSEp − (n − 2p)σ̂ 2 ,
where σ̂ 2 is unbiased so that Edˆp = dp . A similar criterion is Akaike’s final prediction error (FPE).
Imagine a vector of new data y∗ = µ + ε∗ . The expectation of the sum of squared prediction errors is
For underfit models, the MSEp can be dramatically larger than σ 2 . Thus, a large p̂ will be encouraged.
2) If we choose σ̂ 2 = MSEm typically, using the largest model, then
23
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
where L̂n is the maximum value of the likelihood function of the model with p covariates. In the case
of (Gaussian) linear regression, ignoring the constant terms allows us to conveniently take
When fitting models, it is possible to increase the likelihood by adding parameters, but doing so may result
in overfitting. Both BIC and AIC attempt to resolve this problem by introducing a penalty term for the
number of parameters in the model; the penalty term is larger in BIC than in AIC.
kµ − µ̂p̂M k P dp̂M P
−
→ 1, and −
→ 1.
inf1≤p≤m kµ − µ̂p k inf1≤p≤m dp
• If µ = Xp∗ βp∗ for some p∗ , i.e., the true model belongs to the candidate class, then
A widely used method for assessing the performance of prediction models is cross-validation (CV).
In K-fold cross-validation, the original sample (xi , yi )1≤i≤n is randomly partitioned into K equal-sized
subsamples. Let κ : {1, · · · , n} → {1, · · · , K} be an indexing function that indicates the partition to
which observations are allocated by the randomization, respectively. Denote by fˆ−k (·) the fitted function,
computed with the k th part of the data removed. Then the estimate of prediction error is
1 X 1
K X h i2 1 Xh
n i2
CV = yi − fˆ−k (xi ) = yi − fˆ−κ(i) (xi ) .
K n/K n i=1
k=1 κ(i)=k
In practice, one typically performs K-fold CV using K = 5 or K = 10, which is computationally efficient.
The case K = n is known as leave-one-out cross-validation, where
1 Xh i2
n
LOOCV = yi − fˆ(−i) (xi ) .
n i=1
Consider the linear regression model with p regressors, where f (x) = x′ β and y −f (x) = ε ∼ (0, σ 2 ). Clearly
we have fˆ(x) = x′ β̂ and fˆ(−i) (x) = x′ β̂(−i) by the method of least squares. Forecasting a new response y ∗
2
at x∗ gives prediction error PE = y ∗ − fˆ(x∗ ) . Then it holds that ELOOCV = EPE + O(p/n2 ).
24
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Generally, LOOCV can be easily calculated for ridge-type regression, where the hat matrix takes the
form
H = X(X ′ X + λJ)−1 X = (hij )1≤i,j≤n .
The goal is
" #2
1 X yi − fˆ(xi )
n
LOOCV = ,
n i=1 1 − hii
so it suffices to show that
yi − fˆ(xi )
yi − fˆ(−i) (xi ) = .
1 − hii
′
Proof. Let ỹ = (ỹj )1≤j≤n = y1 , . . . , yi−1 , fˆ(−i) (xi ), yi+1 , . . . , yn . Then the minimizer fˆ(−i) (·) of the
P 2 Pn
2
leave-one-out penalized sum of squares [yj − f (xj )] + λJ (f ) also minimizes [ỹj − f (xj )] + λJ (f ).
j̸=i j=1
P n Pn
It follows that fˆ(−i) (xj ) = H ỹ. Just combine fˆ(−i) (xi ) = hij ỹj with fˆ(xi ) = hij yj .
1≤j≤n j=1 j=1
It’s immediate that LOOCV is not stable if some hii % 1. To alleviate the tendency to undersmooth,
a feasible approximation is generalized cross-validation, given as
" #2
1X
n
yi − fˆ(xi )
GCV = .
n i=1 1 − tr (H) /n
turns out to be the first eigenvector of Var(X) = Σ. Sequentially, the j th principal component of X
is Yj = ℓ′j X, where ℓj = arg maxℓ∈Rp ℓ′ Σℓ s.t. kℓk = 1 and ℓ′ ℓk = 0 for 1 ≤ k < j. Using the eigen-
decomposition
X
p
Σ = (e1 , . . . , ep ) diag(λ1 , . . . , λp ) (e1 , . . . , ep )′ = λj ej e′j ,
j=1
25
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Generally, for a (non-centered) random element X taking values in some separable Hilbert space with
EX = µ, we have the so called Karhunen-Loève expansionxxiv)
∞
X
X =µ+ hX − µ, ej i ej .
j=1
which reflects the model fidelity. However, p1 characterizes the model complexity. We again have a trade-off
between two goals, as we already encountered with MSEs. The optimal p∗1 is usually chosen with reference
to a plot of cumulative FVE against p1 — there are no universal rules, only rules of thumb. In view of this,
the distribution of λ’s is essential, whose properties have been intensively studied in random matrix theory.
As a result, one often see that p∗1 ∼ nα with a small α ∈ (0, 1).
PCA can also be done using the correlation matrix instead of the covariance matrix. Note that the
correlation matrix is exactly the covariance matrix of the scaled/standardized variables. Results of scaled
and unscaled PCA can differ a lot, since scaling makes variables equally important. Often (but not always),
scaling (i.e., using the correlation matrix) is preferred.
Anyway, PCA is a technique for dimensionality reduction that pursues a simplified structure of the
initial data, and belongs to unsupervised learning. Sometimes the PCs are used in supervised learning, e.g.,
regression/classification, where the explanation and selection will become much more clear.
The interpretation can be difficult. When all measurements are positively correlated, the first PC is
often some kind of average of the measurements (e.g., market general index). Then the other PCs give
important information about the remaining pattern (e.g., industrial sector index).
xxiv) cf. [Link]
26
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
The geometrical interpretation of PCs based on data is the minimization of perpendicular distances, as
shown in Figure 5, not to be confused with vertical distances in OLS, where responses and predictors are
If
2 X
p
2
d2 (xi , Πq ) = xi − projΠq xi = hxi , fj i ,
j=q+1
then
X
n
span (e1 , . . . , eq ) = arg min d2 (xi , Πq ).
Πq ⊂Rp :dim(Πq )=q i=1
Pn
Proof. Denote by S = 1
n−1 i=1 xi x′i the sample covariance matrix. Direct calculations suggest that
X
n X
p
d (xi , Πq ) = (n − 1) tr S
2
Π⊥
= (n − 1) fj′ Sfj
q
i=1 j=q+1
attains its minimum if and only if fq+1 , . . . , fp are the last p − q eigenvectors of S.
27
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Factor analysis is widely used in social sciences for qualitative modeling, where observable/manifest
variables X = (X1 , . . . , Xp )′ are explained in terms of a potentially smaller number of underlying latent
variables F = (F1 , . . . , Fm )′ that are often impossible to measure directly. Such unobservable variables of
interest are called common factors, because they influence the observed variables broadly. In psychology,
intelligence is a prime example, which researchers examine indirectly by measuring variables that are
believed to be its indicators, e.g., test scores in literature, language and mathematics. The essential purpose
of factor analysis is to exhibit the relationship between the latent and the observed variables.
Let µ = EX. The classic orthogonal factor model is
X
m
X −µ= L F + ε , or Xi − µi = ℓij Fj + εi , 1≤i≤p
(p×1) (p×m)(m×1) (p×1)
j=1
where ℓij is called the loading of the ith variable on the j th factor, meaning the weight that the j th factor
carries in determining the ith variable; and εi is the error (sometimes called the specific factor) associated
only with the ith variable. Note that the loading matrix L = (ℓij ) does not vary across observations. Also,
the common and specific factors are assumed to satisfy that
• EF = 0m , Var(F ) = Im to ensure that the factors are uncorrelated;
• Eε = 0p , Var(ε) = Ψ = diag(ψ1 , . . . , ψp ) so that Cov(Xi , Xi′ |F ) = 0 for i 6= i′ ; and
• Cov(F, ε) = 0m×p .
Note that the assumptions still hold if we set F ← Q′ F and L ← LQ for an orthogonal matrix Q ∈ Rm×m ,
and thereby the model is identifiable only up to a factor rotation. From the assumptions, it follows the
covariance structure Var(X) = LL′ + Ψ, or
X
m X
m
Var(Xi ) = ℓ2ij + ψi , & Cov(Xi , X ) =
i′ ℓij ℓi′ j , ∀i 6= i′ .
j=1 j=1
Pm
Here h2i = j=1 ℓ2ij is called the ith communality and ψi is often called the specific/unique variance.
It can also be seen that
Cov(X, F ) = Cov(LF, F ) + Cov(ε, F ) = L.
There is a strong connection between PCA and factor analysis (FA), but the two are not identical. Both
methods are mostly used in exploratory data analysis for dimension reduction. However, PCA aims at
explaining no covariances but the total variance, whereas FA is more concerned about accounting for the
covariances or correlations. For comparison, write the PCA as
Whether the model has a solution or not is determined by the degree of freedom s = 21 p(p + 1) − (pm + p).
• If s < 0, then the model is meaningless: the number of factors m is “too large” relative to the number
of original parameters p and there are infinitely many solutions.
28
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
• If s = 0, then the solution is unique, but not necessarily proper — the specific variances Ψ are required
to be non-negative.
• In practice we usually have s > 0: an exact solution may not exist and approximate solutions are
used. This case is the most interesting for data/dimension reduction with interpretation.
There are two popular methods of estimation, the principal component (and the related principal factor)
method and the maximum likelihood method.
Principal component method leads to an iterative solution as follows:
1. Calculate eigenpairs (λi , ei ) of the sample covariance matrix S;
√ √
2. Initialize L̂ = ( λ1 e1 , . . . , λm em ) and Ψ̂ = diag S − L̂L̂′ ;
29
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
a rotation of two factors. Note that oblique rotations allow for correlated factors. The loadings can be
interpreted easily if a “simple clusters structure” is achieved — each variable is highly loaded on a single
factor and little on others. Given the estimated factor loadings L̂ = (ℓ̂ij ), Kaiser proposed an analytical
measure of simple structure known as the varimax criterion. The idea of the varimax rotation method is to
find the rotation that maximizes the variances of the squared loadings within each column since each factor
should have a few large and many negligible loadings. More precisely, the varimax criterion of L = (ℓij ) is
defined to be !2
Xm Xp Xp
VC(L) = 1 ℓe4ij −
1
ℓeij
2 ,
j=1
p i=1
p i=1
Pm
where ℓeij = ℓij /ĥi using the square root of the estimated ith communality ĥ2i = j=1 ℓ̂2ij . The varimax
optimal rotation is chosen so that VC(L̂Q) is maximized among orthogonal matrices Q ∈ Rm×m .
The aim of discriminant analysis is to classify objects into groups that are known a priori. Assume
that data come from g distinct classes/populations D1 , . . . , Dg . Given an observed random vector x, which
population should have generated x? Denote by fj (x) the densities of each population Dj , respectively.
The maximum likelihood principle is implemented by allocating x to DJ so that
J = arg max fj (x).
j∈{1,··· ,g}
Consider g = 2 univariate normal populations D1 = N (µ1 , σ12 ) and D2 = N (µ2 , σ22 ). Then
1 (x − µ1 )2 1 (x − µ2 )2
f1 (x) > f2 (x) ⇐⇒ exp − > exp −
σ1 2σ12 σ2 2σ 2
2 2 2
1 1 µ1 µ2 µ1 µ2 σ2
⇐⇒ − x 2
− 2 − x + − < 2 log ,
σ12 σ22 σ12 σ22 σ12 σ22 σ1
which simplifies to
µ1 + µ2
(µ1 − µ2 ) x − >0
2
provided that σ1 = σ2 .
In multivariate setting, suppose Dj = Np (µj , Σ). Note that the covariance matrices are equal for all
classes. Then
f1 (x) > f2 (x) ⇐⇒ (x − µ1 )′ Σ−1 (x − µ1 ) < (x − µ2 )′ Σ−1 (x − µ2 )
⇐⇒ log ff21 (x)
(x)
= (µ1 − µ2 )′ Σ−1 x − 12 (µ1 + µ2 ) > 0.
p
Note that kx − µkΣ = (x − µ)′ Σ−1 (x − µ) is called the Mahalanobis distance. The classification rule
based on linear combinations belongs to the family of linear discriminant analysis (LDA) methods.
30
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
This classification rule belongs to the family of quadratic discriminant analysis (QDA) methods.
Denote the classifier by G, i.e.,
G = j ⇐⇒ X ∼ Dj .
In Bayesian view, past experience gives rise to prior probabilities
before data is collected. Then, Bayes’ theorem allows us to update our previous beliefs with new information.
Maximization of the posterior probability
πj fj (x)
p(Dj |x) = P(G = j|x) = Pg ∝ πj fj (x)
k=1 πk fk (x)
Note that
f1 (x) π2
π1 f1 (x) > π2 f2 (x) ⇐⇒ log > log .
f2 (x) π1
The Bayes rule of discrimination will coincide with the maximum likelihood principle if, πj ∝ 1 correspond
to the uniform distribution, i.e., the prior is non-informative.
To apply these methods, one gathers a training sample, for which the correct classes are known (labeled).
Then it suffices to estimate parameters as follows:
• µj ← x̄j , sample mean of observations that belong to class j.
• Σ ← Spooled , sample covariance matrix of pooled observations, applicable to LDA.
• Σj ← Sj , sample covariance matrix of observations that belong to class j, applicable to QDA.
• πj ← nj /n, proportion of observations in the data that belong to class j.
We may encounter a misclassification error when the observation is assigned to a certain group. Denote
by Aj ⊂ Rp the classification region (a.k.a. the action space in statistical decision theory) such that we
allocate x ∈ Aj to Dj . Let c(k|j) ∈ R+ be the cost when an observation actually from Dj falls into Ak and
is mistakenly assigned to Dk . The probability of putting X ∼ Dj into Dk can be calculated as
Z
p(k|j) = P(X ∈ Ak |Dj ) = fj (x) dx.
Ak
31
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Suppose there are only two populations. The expected cost of misclassification is then
The rule minimizing the ECM among all partitions A1 t A2 = Rp is given by (check!)
f1 (x) c(1|2)π2
x ∈ A1 ⇐⇒ c(2|1)π1 f1 (x) > c(1|2)π2 f2 (x) ⇐⇒ log > log .
f2 (x) c(2|1)π1
This is exactly the Bayes discrimination rule as long as the misclassification costs are equal. Thus, the
Bayes rule is optimal in that it minimizes the total probability of misclassification
Note that if two or more classification rules are available, it is important to evaluate the performance of each
rule. The smallest possible TPM is called the optimum error rate (OER). Let us derive an expression
for the OER when π1 = π2 = 12 and Dj = Np (µj , Σ). LDA yields
A1 = x ∈ Rp : a′ x > 12 a′ (µ1 + µ2 ) , & A2 = x ∈ Rp : a′ x ≤ 12 a′ (µ1 + µ2 ) ,
where a = Σ−1 (µ1 − µ2 ). After tedious calculations, one can see that
Estimated
class 1 class 2
class 1 n11 n12 n1
True
class 2 n21 n22 n2
X
g X Xg X
njk nj 1X
g
[ =
TPM p̂(k|j)π̂j = =1− njj .
j=1 k̸=j j=1
nj n n j=1
k̸=j
32
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
By the way, data are often partitioned into three parts if there exist tuning parameters. The tuning
sample is used to numerically assess and determine parameters first. The training and testing sample are
then used to compare the proposed method with others.
Fisher’s discriminant analysis is a distance-based method, which is extensively applied due to its
geometrical interpretation. The idea is to find a linear rule (in other words, base the classification rule on
a projection, say, x ∈ Rp 7→ a′ x ∈ R) that separates the classes best. Denote the observations by xij ∈ Rp ,
i = 1, · · · , nj ; j = 1, · · · , g. Let yij = a′ xij for some a ∈ Rp . In the case when g = 2, the objective is
!
|ȳ·1 − ȳ·2 | 1 Xn1 Xn2
max q 2
, where sy = (yi1 − ȳ·1 ) +
2
(yi2 − ȳ·2 ) .
2
a∈Rp
s2 n1 + n2 − 2 i=1 i=1
y
Note that Fisher’s approach does not assume that the populations are normal. It does, however, implicitly
assume that the population covariance matrices are equal. Write
!
1 Xn1 Xn2
′ ′
Sx = (xi1 − x̄·1 )(xi1 − x̄·1 ) + (xi2 − x̄·2 )(xi2 − x̄·2 ) .
n1 + n2 − 2 i=1 i=1
Then q
|ȳ·1 − ȳ·2 | |a′ (x̄·1 − x̄·2 )|
q = √ ′ ≤ (x̄·1 − x̄·2 )′ Sx−1 (x̄·1 − x̄·2 ) = kx̄·1 − x̄·2 kSx
s2y a Sx a
by Cauchy-Schwarz inequality, with equality holding if and only if a ∝ â = Sx−1 (x̄·1 − x̄·2 ), which has
Generally, we seek a ∈ Rp to maximize the ratio of the between-group variance to the within-group variance,
for g classes with equal covariance matrices. Let (see Lecture §12, table 1)
X
g X
g X
nj
B= nj (x̄·j − x̄·· )(x̄·j − x̄·· )′ , & W = (xij − x̄·j )(xij − x̄·j )′ .
j=1 j=1 i=1
X
g X
g X
nj
nj (ȳ·j − ȳ·· )2 = a′ Ba, & (yij − ȳ·j )2 = a′ W a.
j=1 j=1 i=1
33
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
We can utilize more linear discriminants in order to summarize the distinction between the classes in higher
dimension. Let
âk = arg max a′ Ba s.t. a′ Spooled a = 1; a′ Spooled âℓ = 0, ∀ℓ < k.
a∈Rp
−1
It turns out that âk is the k th eigenvector of Spooled B for 1 ≤ k ≤ p. The number of âk ’s corresponding to
nonzero eigenvalues is
s = rank W −1 B ≤ min(p, g − 1),
Pg
since B is spanned by those x̄·j − x̄·· such that j=1 nj (x̄·j − x̄·· ) = 0p . Also, for any k > s,
Allocate x ∈ Rp to class
X
r
|â′k (x − x̄·j )| .
2
Jr = arg min
j∈{1,··· ,g} k=1
Note that !
X
p X
p
|â′k (x ′
âk â′k
2 2
− x̄·j )| = (x − x̄·j ) (x − x̄·j ) = kx − x̄·j kSpooled .
k=1 k=1
−1
= Spooled
Pp
If r < s discriminants are used for classification, there is a loss of squared distance of k=r+1 |â′k (x − x̄·j )| ,
2
Ps ′ 2 ′
where k=r+1 |âk (x − x̄·j )| is the part useful for classification. Note that âk (x̄·j ′ − x̄·j ) = 0 for k > s, and
Pp
therefore k=s+1 |â′k (x − x̄·j )| is constant — does not depend on j.
2
or equivalently, ( )
1X ′
r
2
arg max − |âk (x − x̄·j )| + log(πj ) .
j∈{1,··· ,g} 2
k=1
Assume that there are only two classes, indexed by an indicator Y that takes the value from {0, 1}. In
logistic regression, one directly models
34
© RandomSeminar
Notes for Applied Multivariate Statistical Analysis
Then
exp(α + x′ β)
p(x) = .
1 + exp(α + x′ β)
It follows that the log-likelihood function is
! n h
Y
n X i
ℓn (α, β) = log [p(xi )]yi [1 − p(xi )]1−yi = (α + x′i β)yi − log 1 + exp(α + x′i β) .
i=1 i=1
35
© RandomSeminar