Download presentation
Presentation is loading. Please wait.
Published byRosalind McCormick Modified over 9 years ago
1
Robust PCA in Stata Vincenzo Verardi (vverardi@fundp.ac.be) FUNDP (Namur) and ULB (Brussels), Belgium FNRS Associate Researcher
2
PCA, transforms a set of correlated variables into a smaller set of uncorrelated variables (principal components). For p random variables X 1,…,X p. the goal of PCA is to construct a new set of p axes in the directions of greatest variability. Introduction Robust Covariance Matrix Robust PCA Application Conclusion
3
X1X1 X2X2 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
4
X1X1 X2X2 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
5
X1X1 X2X2 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
6
X1X1 X2X2 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
7
Hence, for the first principal component, the goal is to find a linear transformation Y= 1 X 1 + 2 X 2 +..+ p X p (= T X) such that tha variance of Y (=Var( T X) = T ) is maximal The direction of is given by the eigenvector correponding to the largest eigenvalue of matrix Σ Introduction Robust Covariance Matrix Robust PCA Application Conclusion
8
The second vector (orthogonal to the first), is the one that has the second highest variance. This corresponds to the eigenvector associated to the second largest eigenvalue And so on … Introduction Robust Covariance Matrix Robust PCA Application Conclusion
9
The new variables (PCs) have a variance equal to their corresponding eigenvalue Var(Y i )= i for all i=1…p The relative variance explained by each PC is given by i / i Introduction Robust Covariance Matrix Robust PCA Application Conclusion
10
How many PC should be considered? Sufficient number of PCs to have a cumulative variance explained that is at least 60-70% of the total Kaiser criterion: keep PCs with eigenvalues >1 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
11
PCA is based on the classical covariance matrix which is sensitive to outliers … Illustration: Introduction Robust Covariance Matrix Robust PCA Application Conclusion
12
PCA is based on the classical covariance matrix which is sensitive to outliers … Illustration:. set obs 1000. drawnorm x1-x3, corr(C). matrix list C c1 c2 c3 r1 1 r2.7 1 r3.6.5 1 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
13
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
14
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
15
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
16
This drawback can be easily solved by basing the PCA on a robust estimation of the covariance (correlation) matrix. A well suited method for this is MCD that considers all subsets containing h% of the observations (generally 50%) and estimates Σ and µ on the data of the subset associated with the smallest covariance matrix determinant. Intuition … Introduction Robust Covariance Matrix Robust PCA Application Conclusion
17
The generalized variance proposed by Wilks (1932), is a one-dimensional measure of multidimensional scatter. It is defined as. In the 2x2 case it is easy to see the underlying idea: Raw bivariate spread Spread due to covariations Introduction Robust Covariance Matrix Robust PCA Application Conclusion
18
Remember, MCD considers all subsets containing 50% of the observations … However, if N=200, the number of subsets to consider would be: Solution: use subsampling algorithms … Introduction Robust Covariance Matrix Robust PCA Application Conclusion
19
The implemented algorithm: Rousseeuw and Van Driessen (1999) 1.P-subset 2.Concentration (sorting distances) 3.Estimation of robust Σ MCD 4.Estimation of robust PCA Introduction Robust Covariance Matrix Robust PCA Application Conclusion
20
Consider a number of subsets containing (p+1) points (where p is the number of variables) sufficiently large to be sure that at least one of the subsets does not contain outliers. Calculate the covariance matrix on each subset and keep the one with the smallest determinant Do some fine tuning to get closer to the global solution Introduction Robust Covariance Matrix Robust PCA Application Conclusion
21
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Contamination: % Introduction Robust Covariance Matrix Robust PCA Application Conclusion
22
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Will be the probability that one random point in the dataset is not an outlier Introduction Robust Covariance Matrix Robust PCA Application Conclusion
23
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Will be the probability that none of the p random points in a p-subset is an outlier Introduction Robust Covariance Matrix Robust PCA Application Conclusion
24
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Will be the probability that at least one of the p random points in a p-subset is an outlier Introduction Robust Covariance Matrix Robust PCA Application Conclusion
25
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Will be the probability that there is at least one outlier in each of the N p- subsets considered (i.e. that all p- subsets are corrupt) Introduction Robust Covariance Matrix Robust PCA Application Conclusion
26
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Will be the probability that there is at least one clean p-subset among the N considered Introduction Robust Covariance Matrix Robust PCA Application Conclusion
27
The minimal number of subsets we need to have a probability (Pr) of having at least one clean if % of outliers corrupt the dataset can be easily derived: Rearranging we have: Introduction Robust Covariance Matrix Robust PCA Application Conclusion
28
The preliminary p-subset step allowed to estimate a preliminary Σ* and μ* Calculate Mahalanobis distances using Σ* and μ* for all individuals Mahalanobis distances, are defined as. MD are distributed as for Gaussian data. Introduction Robust Covariance Matrix Robust PCA Application Conclusion
29
The preliminary p-subset step allowed to estimate a preliminary Σ* and μ* Calculate Mahalanobis distances using Σ* and μ* for all individuals Sort individuals according to Mahalanobis distances and re-estimate Σ* and μ* using the first 50% observations Repeat the previous step till convergence Introduction Robust Covariance Matrix Robust PCA Application Conclusion
30
In Stata, Hadi’s method is available to estimate a robust Covariance matrix Unfortunately it is not very robust The reason for this is simple, it relies on a non-robust preliminary estimation of the covariance matrix Introduction Robust Covariance Matrix Robust PCA Application Conclusion
31
1.Compute a variant of MD 2.Sort individuals according to. Use the subset with the first p+1 points to re-estimate μ and Σ. 3.Compute MD and sort the data. 4.Check if the first point out of the subset is an outlier. If not, add this point to the subset and repeat steps 3 and 4. Otherwise stop. Introduction Robust Covariance Matrix Robust PCA Application Conclusion
32
clear set obs 1000 local b=sqrt(invchi2(5,0.95)) drawnorm x1-x5 e replace x1=invnorm(uniform())+5 in 1/100 mcd x*, outlier gen RD=Robust_distance hadimvo x*, gen(a b) p(0.5) scatter RD b, xline(`b') yline(`b') Introduction Robust Covariance Matrix Robust PCA Application Conclusion
33
Hadi Fast-MCD Introduction Robust Covariance Matrix Robust PCA Application Conclusion
34
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
35
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
36
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
37
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
38
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
39
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
40
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
41
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
42
QUESTION: Can a single indicator accurately sum up research excellence? GOAL: Determine the underlying factors measured by the variables used in the Shanghai ranking Principal component analysis Introduction Robust Covariance Matrix Robust PCA Application Conclusion
43
Alumni: Alumni recipients of the Nobel prize or the Fields Medal; Award: Current faculty Nobel laureates and Fields Medal winners; HiCi : Highly cited researchers N&S: Articles published in Nature and Science; PUB: Articles in the Science Citation Index-expanded, and the Social Science Citation Index; Introduction Robust Covariance Matrix Robust PCA Application Conclusion
44
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
45
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
46
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
47
The first component accounts for 68% of the inertia and is given by: Φ 1 =0.42Al.+0.44Aw.+0.48HiCi+0.50NS+0.38PUB VariableCorr. (Φ 1,X i ) Alumni0.78 Awards0.81 HiCi0.89 N&S0.92 PUB0.70 Total score0.99 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
48
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
49
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
50
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
51
Introduction Robust Covariance Matrix Robust PCA Application Conclusion
52
Two underlying factors are uncovered: Φ 1 explains 38% of inertia and Φ 2 explains 28% of inertia VariableCorr. (Φ 1,∙)Corr. (Φ 2,∙) Alumni-0.050.78 Awards-0.010.83 HiCi0.740.88 N&S0.630.95 PUB0.720.63 Total score0.990.47 Introduction Robust Covariance Matrix Robust PCA Application Conclusion
53
Classical PCA could be heavily distorted by the presence of outliers. A robustified version of PCA could be obtained either by relying on a robust covariance matrix or by removing multivariate outliers identified through a robust identification method. Introduction Robust Covariance Matrix Robust PCA Application Conclusion
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.