## PCA / FA Example 4: Davis. R-mode, quickly.

enough of the clutter. let’s get davis’ R-mode FA as quickly as possible. feel free to skip over this if you’re comfortable with it. we recall the design matrix X of centered data:
$\left(\begin{array}{ccc} -6&3&3\\ 2&1&-3\\ O&-1&1\\ 4&-3&-1\end{array}\right)$
we compute $X^T\ X$:
$X^T\ X = \left(\begin{array}{cccc} -6&2&0&4\\ 3&1&-1&-3\\ 3&-3&1&-1\end{array}\right)$ x $\left(\begin{array}{ccc} -6&3&3\\ 2&1&-3\\ O&-1&1\\ 4&-3&-1\end{array}\right)$
= $\left(\begin{array}{ccc} 56&-28&-28\\ -28&20&8\\ -28&8&20\end{array}\right)$
we get its eigenstructure; we construct a diagonal matrix of the square roots of the eigenvalues:
$\left(\begin{array}{ccc} 9.16515&0.&0.\\ 0.&3.4641&0.\\ 0.&0.&0.\end{array}\right)$
we check that U is orthogonal:
$U^T \ U = \left(\begin{array}{ccc} 0.816497&-0.408248&-0.408248\\ O&-0.707107&0.707107\\ -0.57735&-0.57735&-0.57735\end{array}\right)$ x $\left(\begin{array}{ccc} 0.816497&0&-0.57735\\ -0.408248&-0.707107&-0.57735\\ -0.408248&0.707107&-0.57735\end{array}\right)$
= $\left(\begin{array}{ccc} 1.&0&0\\ O&1.&0\\ O&0&1.\end{array}\right)$
we define (the factors) $A^R$ as the $\sqrt{\text{eigenvalue}}$-weighted eigenvector matrix:
$A^R = \left(\begin{array}{ccc} 0.816497&0&-0.57735\\ -0.408248&-0.707107&-0.57735\\ -0.408248&0.707107&-0.57735\end{array}\right)$ x $\left(\begin{array}{ccc} 9.16515&0.&0.\\ 0.&3.4641&0.\\ 0.&0.&0.\end{array}\right)$
= $\left(\begin{array}{ccc} 7.48331&0.&0.\\ -3.74166&-2.44949&0.\\ -3.74166&2.44949&0.\end{array}\right)$
and we define (the scores) $S^R = X \ A^R$, “which project the n individual objects onto the principal vectors [factors].”
$S^R = X \ A^R = \left(\begin{array}{ccc} -6&3&3\\ 2&1&-3\\ O&-1&1\\ 4&-3&-1\end{array}\right)$ x $\left(\begin{array}{ccc} 7.48331&0.&0.\\ -3.74166&-2.44949&0.\\ -3.74166&2.44949&0.\end{array}\right)$
= $\left(\begin{array}{ccc} -67.3498&0&0\\ 22.4499&-9.79796&0\\ O&4.89898&0\\ 44.8999&4.89898&0\end{array}\right)$
that was R-mode. Q-mode is similar. in fact, it’s more than similar, but we’ll get to that. the starting point is to form $XX^T$ instead of $X^T\ X$.