Principal Components Analysis
Study guides: Exam SRM, Exam PA, Exam MAS-I, Exam MAS-II, Exam ACIA-CAPSTONE, FIE-M1
Principal Components Analysis (PCA) is an unsupervised method that finds a low-dimensional representation of n observations of p variables X_1, \ldots, X_p, keeping as much of their variance as possible. It projects the observations onto a few linear combinations of the variables, called principal components. PCA uses only the variables and no response. With each variable centred by subtracting its sample mean, the score of observation i on the first principal component is
z_{i1} = \phi_{11} x_{i1} + \phi_{21} x_{i2} + \cdots + \phi_{p1} x_{ip}
x_{ij}is the centred value of variableX_jfor observationi.\phi_{11}, \ldots, \phi_{p1}are the loadings of the first principal component, chosen to make the sample variance of the scoresz_{11}, \ldots, z_{n1}as large as possible, subject to\phi_{11}^2 + \phi_{21}^2 + \cdots + \phi_{p1}^2 = 1.
Without the constraint on the sum of squared loadings, the variance could be made as large as desired. The loading vector is determined only up to its sign, because changing the sign of every loading gives the same direction. The first principal component is the direction in the space of the variables along which the observations vary the most, which is also the line closest to the observations.
Three observations of two variables are
(2, 9),(6, 5)and(7, 10). The first principal component has\phi_ = 0.6and\phi_ > 0. What is the score of the first observation?
- The loadings satisfy
\phi_{11}^2 + \phi_{21}^2 = 1, so\phi_{21} = \sqrt{1 - 0.36} = 0.8.- The means of the variables are 5 and 8, so the first observation centred is
(-3, 1).- Its score is
0.6(-3) + 0.8(1) = -1.0.
Later principal components
The second principal component is the linear combination of the variables with the largest variance among those uncorrelated with the first, which makes its direction perpendicular to the first. Each later component has the largest remaining variance among the combinations uncorrelated with all the earlier ones. The principal components are linear combinations of the variables, so they are straight lines, not curves, and PCA captures only linear relationships among the variables. On a scatter plot of two variables, the first principal component lies along the direction in which the cloud of points is most elongated, and the second is perpendicular to it.
Proportion of variance explained
The total variance of the centred data is the sum of the variances of the p variables. The proportion of variance explained by the mth principal component is
\text{PVE}_m = \frac{\sum_{i=1}^{n} z_{im}^2}{\sum_{j=1}^{p}\sum_{i=1}^{n} x_{ij}^2}
z_{im}is the score of observationion themth principal component.
The variance of the mth component is the mth largest eigenvalue of the covariance matrix of the variables, or of their correlation matrix when the variables are standardized. The proportion of variance explained by a component is therefore its eigenvalue divided by the sum of all the eigenvalues, and the sum of the eigenvalues is the total variance. The components are ordered by the variance they explain, so the proportions never increase from one component to the next. Their cumulative sum reaches 1 at the last component, and a scree plot of the proportions helps decide how many components to keep.
Two standardized variables have correlation 0.6, and the eigenvalues of their correlation matrix are 1.6 and 0.4. What proportion of the variance does the first principal component explain?
- Each standardized variable has variance 1, so the total variance is 2, which is also
1.6 + 0.4.- The proportion of variance explained by the first component is
1.6/2 = 0.80.
Scaling the variables
The principal components depend on the scale of the variables. If the variables are only centred, the variables with the largest variances dominate the first principal components. Scaling each variable to standard deviation 1 removes that dominance, and it changes the loadings, so two programs with different default scaling can give different loadings. The variables are standardized unless they are all measured in the same units.
PCA is used to plot the observations in two or three dimensions and to derive a few features for a regression, as in principal components regression. A loading is the coefficient of a variable in a component, and a loading near 0 means that the variable contributes little to that component. It does not mean that the variable is unimportant, because the components are derived features rather than the predictors themselves.
Practice questions
- CAS Exam 8 Fall 2013, Question 4
- CAS Exam MAS-I Fall 2018, Question 38
- CAS Exam MAS-I Spring 2018, Question 26
- CAS Exam MAS-I Fall 2019, Question 28
- CAS Exam MAS-II Fall 2018, Question 41
- CAS Exam MAS-II Fall 2019, Question 39
- CAS Exam MAS-II Fall 2019, Question 40
- CAS Exam MAS-II Fall 2019, Question 41
- CAS Exam MAS-II Spring 2019, Question 40
- CAS Exam MAS-II Spring 2019, Question 41
- Exam PA Practice Question 17
- SOA Exam SRM Sample Question 5
- SOA Exam SRM Sample Question 6
- SOA Exam SRM Sample Question 30
- SOA Exam SRM Sample Question 35
- SOA Exam SRM Sample Question 37
- SOA Exam SRM Sample Question 43
- SOA Exam SRM Sample Question 76