Principal Component Analysis (PCA) - Solved Example
Given Dataset:
| Observation | Feature 1 | Feature 2 |
|-------------|-----------|-----------|
|1 | 2.5 | 2.4 |
|2 | 0.5 | 0.7 |
|3 | 2.2 | 2.9 |
Step 1: Create the Data Matrix
X = [[2.5, 2.4], [0.5, 0.7], [2.2, 2.9]]
Step 2: Standardize the Data (Centering)
Means: Feature 1 = 1.733, Feature 2 = 2.0
X_centered = [[0.767, 0.4], [-1.233, -1.3], [0.467, 0.9]]
Step 3: Covariance Matrix
C = [[1, 0.937], [0.937, 1]]
Step 4: Eigenvalues and Eigenvectors (Given)
Eigenvalues: 1.937 and 0.063
Eigenvectors: [0.707, 0.707] and [-0.707, 0.707]
Step 5: Select Principal Component
Chosen PC1 = [0.707, 0.707]
Step 6: Project Data
Z = X_centered * PC1
Z1 = 0.825
Z2 = -1.791
Z3 = 0.966
Final PCA-transformed 1D Data:
Z = [0.825, -1.791, 0.966]