But we constrain this such that the diagonal has values of 1 (the correlation of a variable with itself is 1), and lets call it R. \[
\begin{equation*}
\mathbf{R} =
\begin{bmatrix}
1.00, 0.72, 0.63, 0.54, 0.45, 0.36 \\
0.72, 1.00, 0.56, 0.48, 0.40, 0.32 \\
0.63, 0.56, 1.00, 0.42, 0.35, 0.28 \\
0.54, 0.48, 0.42, 1.00, 0.30, 0.24 \\
0.45, 0.40, 0.35, 0.30, 1.00, 0.20 \\
0.36, 0.32, 0.28, 0.24, 0.20, 1.00 \\
\end{bmatrix}
\end{equation*}
\]
PCA is about trying to determine a vector f which generates the correlation matrix R. a bit like unscrambling eggs!
in PCA, we express \(\mathbf{R = CC'}\), where \(\mathbf{C}\) are our principal components.
If \(n\) is number of variables in \(R\), then \(i^{th}\) component \(C_i\) is the linear sum of each variable multiplied by some weighting: \[
C_i = \sum_{j=1}^{n}w_{ij}x_{j}
\]
How do we find \(C\)?
This is where “eigen decomposition” comes in.
For the \(n \times n\) correlation matrix \(\mathbf{R}\), there is an eigenvector\(x_i\) that solves the equation \[
\mathbf{x_i R} = \lambda_i \mathbf{x_i}
\] Where the vector multiplied by the correlation matrix is equal to some eigenvalue\(\lambda_i\) multiplied by that vector.
We can write this without subscript \(i\) as: \[
\begin{align}
& \mathbf{R X} = \mathbf{X \lambda} \\
& \text{where:} \\
& \mathbf{R} = \text{correlation matrix} \\
& \mathbf{X} = \text{matrix of eigenvectors} \\
& \mathbf{\lambda} = \text{vector of eigenvalues}
\end{align}
\] the vectors which make up \(\mathbf{X}\) must be orthogonal (\(\mathbf{XX' = I}\)), which means that \(\mathbf{R = X \lambda X'}\)
We can actually do this in R manually. Creating a correlation matrix
# lets create a correlation matrix, as the produce of ff'f <-seq(.9,.4,-.1)R <- f %*%t(f)#give rownames and colnamesrownames(R)<-colnames(R)<-paste0("V",seq(1:6))#constrain diagonals to equal 1diag(R)<-1R
Principal Components Analysis
Call: principal(r = R, nfactors = 1, rotate = "none", covar = FALSE)
Standardized loadings (pattern matrix) based upon correlation matrix
PC1 h2 u2 com
V1 0.88 0.78 0.22 1
V2 0.83 0.69 0.31 1
V3 0.77 0.59 0.41 1
V4 0.69 0.48 0.52 1
V5 0.60 0.37 0.63 1
V6 0.50 0.25 0.75 1
PC1
SS loadings 3.16
Proportion Var 0.53
Mean item complexity = 1
Test of the hypothesis that 1 component is sufficient.
The root mean square of the residuals (RMSR) is 0.09
Fit based upon off diagonal values = 0.95
Look familiar? It looks like the first component we computed manually. The first column of \(\mathbf{C}\):
Notice the values on the diagonals of \(\mathbf{c_1}\mathbf{c_1}'\).
diag(C[,1] %*%t(C[,1]))
[1] 0.780 0.693 0.592 0.481 0.365 0.252
These aren’t 1, like they are in \(R\). But they are proportional: this is the amount of variance in each observed variable that is explained by this first component. Sound familiar?