Principal component analysis

Let $X_1, \ldots, X_n$ be iid copies of a random vector $X\in \R^p$.

  1. Construct $\hat Σ = \frac{1}{n} \sum_{i=1}^{n} (X_i - \overline{X_n}) (X_i - \overline{X_n})^T$.

  2. Find the first $k$ eigenvectors $\hat v_1, \ldots, \hat v_k$ of $\hat Σ$ with largest magnitude of eigenvalue.

  3. Project the samples onto these vectors $$ \begin{align*} \pmat{X_1^T \\ \vdots \\ X_n^T}\pmat{\hat v_1 & \ldots &\hat v_k}. \end{align*} $$