The user wants a comprehensive tutorial on Principal Component Analysis (PCA). Let me structure this to cover all the requested topics:
- Introduction to PCA
- Standardization - why and how
- Covariance vs Correlation matrix
- Eigen-decomposition and SVD approaches
- Variance explained
- Biplots
- Common pitfalls
- Numeric examples throughout
Let me create a detailed, educational response with small numeric examples to illustrate each concept.
Structure:
- What is PCA and why do we use it
- The data matrix setup
- Centering and Standardization
- Covariance vs Correlation matrix approach
- Eigen-decomposition method
- SVD method
- Principal Components interpretation
- Variance explained and scree plots
- Biplots
- Common pitfalls
- Full worked example
Let me work through a small numeric example:
Example data (3 observations, 2 variables):
X = [[1, 2],
[3, 4],
[5, 6]]
Wait, this is too simple (perfectly correlated). Let me use a better example:
X = [[2.5, 2.4],
[0.5, 0.7],
[2.2, 2.9],
[1.9, 2.2],
[3.1, 3.0],
[2.3, 2.7],
[2.0, 1.6],
[1.0, 1.1],
[1.5, 1.6],
[1.1, 0.9]]
Actually, for teaching purposes, let me use a smaller, cleaner example:
4 observations, 2 variables:
X = [[4, 2],
[2, 4],
[6, 4],
[4, 6]]
I'll calculate the mean for each variable. The first variable's mean is 4, and the second variable's mean is 4. This allows me to center the data by subtracting these means from each observation. The centered data reveals the deviation from the mean, which is crucial for understanding the data's variability and preparing for PCA.
The centered data matrix shows how each point varies from the mean, creating a symmetric distribution around zero. This step is fundamental in preparing the data for principal component analysis, as it helps identify the underlying structure and variability in the dataset.
I notice the covariance is zero, which suggests no linear relationship between the variables. This lack of correlation might indicate independent variables or a need to explore the data further.
To investigate more deeply, I'll compute a new dataset with potentially more interesting characteristics. The next dataset will help me understand how different data structures reveal underlying patterns.
Var(x1) = (2.
25 + 0.25 + 0.25 + 2.25)/3 yields approximately 1.667 variance. Var(x2) shows 2.25 variance, indicating slightly more spread in the second variable.
The covariance calculation reveals a value around 1.833, suggesting a moderate positive linear relationship between x1 and x2. This indicates the variables tend to move somewhat similarly, though not perfectly in sync.
I'll compute the covariance matrix to capture these interrelationships systematically, which will provide a comprehensive view of the data's statistical properties. Calculating variance and covariance for a new dataset. Variance for x1 is 1, variance for x2 is also 1. The covariance is 1, indicating a perfect linear relationship between the variables. The covariance matrix shows symmetric correlation, with each element being 1. This suggests a strong, direct linear dependence between the two dimensions.
Solving the characteristic equation reveals two eigenvalues: 2 and 0. For the first eigenvalue of 2, the corresponding eigenvector is [1/√2, 1/√2], representing equal contribution from both dimensions. The second eigenvalue of 0 suggests a direction of minimal variance in the dataset.
I examine a 3x2 matrix to illustrate numeric calculations. After centering the data by subtracting the mean, I compute the covariance matrix. The symmetric result of [[4, 4], [4, 4]] indicates strong correlation between components, with equal variance across both dimensions.
The eigenvalue calculation shows a characteristic equation resolving to 16, suggesting the matrix's underlying linear transformation properties. This symmetric structure implies the data points are tightly clustered around their mean, with uniform spread.
I'll now analyze a more nuanced 4x2 dataset to explore variance distribution and potential insights from its centered representation.
Calculating variance for each feature reveals interesting spread characteristics. For x1, variance is approximately 3.333, indicating moderate dispersion around the mean. x2 shows slightly higher variance at 4.667, suggesting more variability in the second feature.
The covariance matrix highlights interesting correlations between features. With a covariance of 3 between x1 and x2, there's a moderate positive linear relationship. Using exact fractions (10/3 and 14/3), we maintain precision in our variance calculations.
The next step involves eigenvalue decomposition to understand the principal components and underlying data structure. I'll construct a small dataset with balanced properties, using a 4-point matrix where the mean is centered at [3, 3]. The centered data points reveal symmetric variance across both dimensions. By carefully selecting points, I've created a covariance matrix with equal variance (10/3) and consistent covariance (8/3). This symmetry allows for clean eigenvalue calculations, demonstrating how strategic data point selection can simplify statistical analysis.
The matrix reveals a perfectly balanced distribution, with each point strategically positioned to create uniform spread. Calculating the covariance matrix shows equal variance in both x1 and x2 dimensions, and a consistent covariance that reflects the data's underlying structure.
The eigenvalue computation will involve solving the characteristic equation, which in this symmetric case promises elegant mathematical properties. The goal is to understand the principal directions and magnitudes of data variation through these eigenvalues.
Solving the characteristic equation yields two eigenvalues: λ₁ = 6 and λ₂ = 2/3. These values represent the principal axes of variation in the dataset, with λ₁ indicating the direction of maximum spread.
The corresponding eigenvectors reveal the geometric interpretation of these eigenvalues, showing how the data points are oriented in the two-dimensional space. The first eigenvector [1, 1]/√2 represents the primary axis of variation, aligned with the data's most significant directional trend.
The variance explained by each principal component highlights their relative importance. PC1 captures 90% of the total variance, while PC2 accounts for the remaining 10%, demonstrating the dominance of the first principal component in describing the data's underlying structure.
When dealing with features on different scales, standardization becomes crucial. The example shows how one variable (x1) can completely overshadow another due to its larger magnitude. By calculating standard deviations, we reveal the dramatic difference in scale: x1's standard deviation is around 182.57, compared to x2's mere 1.826, which would cause PCA to be heavily biased towards the first feature without proper normalization.
Key pitfalls in PCA include overlooking critical preprocessing steps like centering and standardization, misapplying the technique to non-linear relationships, and misinterpreting component meanings. Practitioners must be cautious about sample size, outlier sensitivity, and the assumptions underlying the method, especially when dealing with multicollinear variables or categorical data. # Principal Component Analysis: A Complete Guide
1. What is PCA?
PCA transforms correlated variables into a smaller set of uncorrelated components that capture maximum variance.
Original Variables (correlated) Principal Components (uncorrelated)
┌─────────┐ ┌─────────┐
X₁ ─┤ │ PC₁ ─┤ 70% var │ ← Most important
X₂ ─┤ Data │───── PCA Transform ────►PC₂ ─┤ 20% var │
X₃ ─┤ │ PC₃ ─┤ 10% var │ ← Least important
└─────────┘ └─────────┘
p dimensions p dimensions
(but ranked by importance)
2. The Setup: Data Matrix
Features (p variables)
┌─────────────────────┐
│ X₁ X₂ ... Xₚ │
─────┼─────────────────────┤
n │ 2 3 5 │ ← observation 1
obs │ 4 6 7 │ ← observation 2
↓ │ ... │
│ 8 9 12 │ ← observation n
└─────────────────────┘
Data matrix X is n × p
3. Centering and Standardization
Step 1: Centering (Always Required)
Subtract the mean of each variable:
x_centered = x - x̄
Example:
─────────────────────────────────────────────────────────
Original X Means Centered X_c
─────────────────────────────────────────────────────────
│ 1 2 │ │ -2 -1 │
│ 2 1 │ x̄₁ = 3 │ -1 -2 │
│ 4 5 │ x̄₂ = 3 │ 1 2 │
│ 5 4 │ │ 2 1 │
─────────────────────────────────────────────────────────
Why center? PCA finds directions of maximum variance from the origin. Without centering, PC1 would point toward the data cloud's center, not along its spread.
Step 2: Standardization (Often Required)
Divide by standard deviation to create z-scores:
z = (x - x̄) / s
When to standardize:
─────────────────────────────────────────────────────────
STANDARDIZE (use correlation) DON'T STANDARDIZE (use covariance)
─────────────────────────────────────────────────────────
• Variables on different scales • Variables on same scale
(meters vs. kilograms) (all in centimeters)
• Variables with very different • Variance differences are
variances meaningful
• When you want equal • When some variables should
contribution from all vars contribute more
─────────────────────────────────────────────────────────
Numeric Example: Why Standardization Matters
Original data (Height in cm, Weight in kg):
─────────────────────────────────────────────────────────
Person Height(cm) Weight(kg)
─────────────────────────────────────────────────────────
1 160 60
2 170 65
3 180 70
4 190 75
─────────────────────────────────────────────────────────
Variances:
Var(Height) = 166.67 (large because of units)
Var(Weight) = 41.67 (smaller number scale)
Without standardization:
PC1 ≈ [0.97, 0.24] ← Dominated by Height!
With standardization:
PC1 ≈ [0.71, 0.71] ← Equal contribution
4. Covariance vs. Correlation Matrix
Both matrices can drive PCA:
Covariance Matrix (on centered data)
1
Σ = ───────── X_c^T X_c
n - 1
Structure:
┌─────────────────────────────┐
│ Var(X₁) Cov(X₁,X₂) ... │
Σ = │ Cov(X₂,X₁) Var(X₂) ... │
│ ... ... ... │
└─────────────────────────────┘
Correlation Matrix (on standardized data)
┌─────────────────────────────┐
│ 1 r(X₁,X₂) ... │
R = │ r(X₂,X₁) 1 ... │
│ ... ... ... │
└─────────────────────────────┘
Note: Diagonal is always 1
Numeric Example
Using our centered data:
│ -2 -1 │
X_c = │ -1 -2 │
│ 1 2 │
│ 2 1 │
Covariance Matrix Calculation:
──────────────────────────────────────────────────
Var(X₁) = [(-2)² + (-1)² + 1² + 2²] / 3 = 10/3
Var(X₂) = [(-1)² + (-2)² + 2² + 1²] / 3 = 10/3
Cov(X₁,X₂) = [(-2)(-1) + (-1)(-2) + (1)(2) + (2)(1)] / 3 = 8/3
──────────────────────────────────────────────────
┌ 10/3 8/3 ┐ ┌ 3.33 2.67 ┐
Σ = │ │ ≈ │ │
└ 8/3 10/3 ┘ └ 2.67 3.33 ┘
Correlation Matrix:
──────────────────────────────────────────────────
r(X₁,X₂) = Cov(X₁,X₂) / (s₁ × s₂)
= (8/3) / (√(10/3) × √(10/3))
= (8/3) / (10/3) = 0.8
──────────────────────────────────────────────────
┌ 1.0 0.8 ┐
R = │ │
└ 0.8 1.0 ┘
5. Eigen-Decomposition Method
Find eigenvalues (λ) and eigenvectors (v) of the covariance/correlation matrix.
The Math
Σv = λv
Where:
• λ = eigenvalue (variance captured by that component)
• v = eigenvector (direction of that component, the "loadings")
Numeric Example
Find eigenvalues of Σ = ┌ 10/3 8/3 ┐
└ 8/3 10/3 ┘
Characteristic equation: det(Σ - λI) = 0
│ 10/3 - λ 8/3 │
│ │ = 0
│ 8/3 10/3 - λ │
(10/3 - λ)² - (8/3)² = 0
(10/3 - λ)² = 64/9
10/3 - λ = ± 8/3
λ₁ = 10/3 + 8/3 = 18/3 = 6
λ₂ = 10/3 - 8/3 = 2/3
─────────────────────────────────────────────────────
Finding Eigenvectors:
─────────────────────────────────────────────────────
For λ₁ = 6:
(Σ - 6I)v = 0
┌ 10/3-6 8/3 ┐ ┌ v₁ ┐ ┌ 0 ┐
│ │ │ │ = │ │
└ 8/3 10/3-6 ┘ └ v₂ ┘ └ 0 ┘
┌ -8/3 8/3 ┐ ┌ v₁ ┐ ┌ 0 ┐
│ │ │ │ = │ │
└ 8/3 -8/3 ┘ └ v₂ ┘ └ 0 ┘
-8/3 v₁ + 8/3 v₂ = 0 → v₁ = v₂
Normalized eigenvector: v₁ = [1/√2, 1/√2] = [0.707, 0.707]
─────────────────────────────────────────────────────
For λ₂ = 2/3:
┌ 8/3 8/3 ┐ ┌ v₁ ┐ ┌ 0 ┐
│ │ │ │ = │ │
└ 8/3 8/3 ┘ └ v₂ ┘ └ 0 ┘
v₁ + v₂ = 0 → v₁ = -v₂
Normalized eigenvector: v₂ = [1/√2, -1/√2] = [0.707, -0.707]
Summary of Eigen-Decomposition
Principal Component Loadings (V):
─────────────────────────────────────────────────────
PC1 PC2
─────────────────────────────────────────────────────
Variable 1 0.707 0.707
Variable 2 0.707 -0.707
─────────────────────────────────────────────────────
Eigenvalues:
─────────────────────────────────────────────────────
PC1: λ₁ = 6 (larger variance)
PC2: λ₂ = 0.667 (smaller variance)
─────────────────────────────────────────────────────
Geometric Interpretation:
X₂
↑
│ ╱ PC1 (v₁)
│ ╱ direction [0.71, 0.71]
│ ╱ max variance
────────┼╱────────→ X₁
╱│
╱ │
PC2 ╱ │
[0.71,-0.71] │
min variance │
6. SVD Method (Alternative to Eigen-Decomposition)
SVD decomposes the centered data matrix directly:
X_c = U S V^T
Where:
• U (n × n): Left singular vectors (observation scores, normalized)
• S (n × p): Diagonal matrix of singular values
• V^T (p × p): Right singular vectors (loadings) ← Same as eigenvectors of Σ!
Connection Between SVD and Eigen-Decomposition
Covariance matrix: Σ = X_c^T X_c / (n-1)
Using SVD:
X_c^T X_c = (USV^T)^T (USV^T)
= VS^T U^T U S V^T
= V S² V^T (since U^T U = I)
Therefore:
─────────────────────────────────────────────────────
• Eigenvalues of Σ: λᵢ = sᵢ² / (n-1)
• Eigenvectors of Σ: columns of V
• PC scores: X_c × V = US
─────────────────────────────────────────────────────
Why Use SVD?
┌─────────────────────┬─────────────────────────────────────┐
│ Eigen-decomposition │ SVD │
├─────────────────────┼─────────────────────────────────────┤
│ Computes Σ first │ Works directly on X_c │
│ (p × p matrix) │ (n × p matrix) │
├─────────────────────┼─────────────────────────────────────┤
│ Problem with │ Numerically stable │
│ near-singular Σ │ │
├─────────────────────┼─────────────────────────────────────┤
│ Fast when n >> p │ Fast when p >> n │
│ │ (doesn't form p×p matrix) │
└─────────────────────┴─────────────────────────────────────┘
7. Computing Principal Component Scores
Transform original data to PC space:
Scores = X_centered × V
Using our example:
─────────────────────────────────────────────────────
│ -2 -1 │ │ 0.707 0.707 │
X_c = │ -1 -2 │ V = │ │
│ 1 2 │ │ 0.707 -0.707 │
│ 2 1 │
Scores = X_c × V
│ -2(0.707) + (-1)(0.707) -2(0.707) + (-1)(-0.707) │
= │ -1(0.707) + (-2)(0.707) -1(0.707) + (-2)(-0.707) │
│ 1(0.707) + 2(0.707) 1(0.707) + 2(-0.707) │
│ 2(0.707) + 1(0.707) 2(0.707) + 1(-0.707) │
│ -2.12 -0.71 │
≈ │ -2.12 0.71 │ ← PC scores for each observation
│ 2.12 -0.71 │
│ 2.12 0.71 │
─────────────────────────────────────────────────────
8. Variance Explained
Individual and Cumulative Variance
λᵢ
% Variance (PCᵢ) = ──────
Σ λⱼ
Our example:
─────────────────────────────────────────────────────
Component Eigenvalue % Variance Cumulative %
─────────────────────────────────────────────────────
PC1 6.00 90.0% 90.0%
PC2 0.67 10.0% 100.0%
─────────────────────────────────────────────────────
Total 6.67 100.0%
Calculations:
PC1: 6 / (6 + 0.667) = 6 / 6.667 = 0.90 = 90%
PC2: 0.667 / 6.667 = 0.10 = 10%
Scree Plot
Variance
Explained
│
100%┤ ●────────────────● Cumulative
│ ╱
90%┤ ╱
│ ╱
80%┤ ╱
│╱
│
50%┤
│
│
10%┤ ●──────● Individual
│ ●
└─┴────────┴────────┴────────┴──→
PC1 PC2 PC3 PC4
↑
"Elbow" - suggests keeping 1-2 PCs
Rules for Choosing Number of Components
┌────────────────────────┬────────────────────────────────────┐
│ Rule │ Description │
├────────────────────────┼────────────────────────────────────┤
│ Kaiser Criterion │ Keep PCs with eigenvalue > 1 │
│ │ (when using correlation matrix) │
├────────────────────────┼────────────────────────────────────┤
│ Variance Threshold │ Keep PCs until cumulative │
│ │ variance ≥ 70-90% │
├────────────────────────┼────────────────────────────────────┤
│ Scree Plot Elbow │ Keep PCs before the "elbow" │
│ │ where curve flattens │
├────────────────────────┼────────────────────────────────────┤
│ Cross-validation │ Choose k that minimizes │
│ │ reconstruction error on held-out │
└────────────────────────┴────────────────────────────────────┘
9. Biplots
Biplots display both observations (scores) and variables (loadings) in one plot.
Construction
Score Plot + Loading Plot = Biplot
Observations: plotted using their PC scores
Variables: plotted as arrows using their loadings (×scaling factor)
Interpreting Biplots
PC2
↑
│
var2 ───→│←─── var3 (arrow)
↗ │ (original variable)
╱ │
╱ •c │
───────╱────●d───┼────────────→ PC1
•a ╱ │ •b
╱ │
╱ │
↙ │
var1 │
│
Key interpretations:
─────────────────────────────────────────────────────
Arrow length → Variable's contribution to PCs
(longer = more important)
Arrow direction → Correlation with PCs
(pointing right = positive PC1 loading)
Angle between → Correlation between variables
arrows 0° ≈ r = +1
90° ≈ r = 0
180° ≈ r = -1
Point position → Observation's PC scores
Point-arrow → How much that observation
relationship scores on that variable
─────────────────────────────────────────────────────
Biplot for Our Example
PC2
↑
│
0.5│ • obs2 (-2.12, 0.71)
│
│ ↗ var2 (0.71, -0.71)
─────────────────┼─────↗──────────────→ PC1
↗│↗ var1 (0.71, 0.71)
obs1 • ←──╱─│
(-2.12,-0.71) │ • obs4 (2.12, 0.71)
-0.5│
│ • obs3 (2.12, -0.71)
Note: Both variables point similar direction on PC1
→ they are positively correlated (r = 0.8)
Both loadings have magnitude 0.71 on PC1
→ equal contribution to PC1
10. Complete Worked Example with Code
import numpy as np
# Original data
X = np.array([[1, 2],
[2, 1],
[4, 5],
[5, 4]])
print("Original Data:")
print(X)
# Step 1: Center the data
X_mean = X.mean(axis=0) # [3, 3]
X_centered = X - X_mean
print("\nCentered Data:")
print(X_centered)
# Step 2: Compute covariance matrix
n = X.shape[0]
cov_matrix = (X_centered.T @ X_centered) / (n - 1)
print("\nCovariance Matrix:")
print(cov_matrix)
# Step 3: Eigen-decomposition
eigenvalues, eigenvectors = np.linalg.eig(cov_matrix)
# Sort by eigenvalue (descending)
idx = eigenvalues.argsort()[::-1]
eigenvalues = eigenvalues[idx]
eigenvectors = eigenvectors[:, idx]
print("\nEigenvalues:", eigenvalues)
print("Eigenvectors (columns):")
print(eigenvectors)
# Step 4: Compute scores
scores = X_centered @ eigenvectors
print("\nPC Scores:")
print(scores)
# Step 5: Variance explained
var_explained = eigenvalues / eigenvalues.sum()
print("\nVariance Explained:", var_explained)
print("Cumulative:", np.cumsum(var_explained))
Output:
Original Data:
[[1 2]
[2 1]
[4 5]
[5 4]]
Centered Data:
[[-2 -1]
[-1 -2]
[ 1 2]
[ 2 1]]
Covariance Matrix:
[[3.33 2.67]
[2.67 3.33]]
Eigenvalues: [6. 0.67]
Eigenvectors (columns):
[[ 0.707 0.707]
[ 0.707 -0.707]]
PC Scores:
[[-2.12 -0.71]
[-2.12 0.71]
[ 2.12 -0.71]
[ 2.12 0.71]]
Variance Explained: [0.9 0.1]
Cumulative: [0.9 1.0]
11. Common Pitfalls
Pitfall 1: Forgetting to Center
✗ WRONG: PCA on raw data
─────────────────────────────────────────────────────
Data cloud at [100, 100]:
Without centering, PC1 points TOWARD the cloud center
instead of ALONG the direction of maximum spread.
─────────────────────────────────────────────────────
✓ CORRECT: Always center (subtract mean)
Pitfall 2: Ignoring Scale Differences
✗ WRONG: Using covariance when scales differ
─────────────────────────────────────────────────────
Income ($): 30,000 - 100,000 Var ≈ 10⁹
Age (yrs): 20 - 80 Var ≈ 10²
PC1 will be ~100% income, ignoring age entirely!
─────────────────────────────────────────────────────
✓ CORRECT: Standardize (use correlation matrix)
Pitfall 3: Applying PCA to Non-Linear Relationships
●●●●●●
● ●
● ● PCA finds linear directions!
● ●
● ● For circular/curved data:
● ● → Use Kernel PCA
● ● → Use UMAP/t-SNE
● ●
●●●●●●
Pitfall 4: Over-interpreting Components
✗ WRONG: "PC1 IS the latent factor causing X1 and X2"
─────────────────────────────────────────────────────
PCA is purely mathematical rotation.
It finds correlation, not causation.
─────────────────────────────────────────────────────
✓ CORRECT: "PC1 captures shared variance in X1, X2"
Use Factor Analysis if you want latent variables.
Pitfall 5: Using PCA on Categorical Variables
✗ WRONG: PCA on [Male=1, Female=2, Other=3]
─────────────────────────────────────────────────────
PCA assumes continuous, linear relationships.
"2" is not "twice" the gender of "1"!
─────────────────────────────────────────────────────
✓ CORRECT: Use Multiple Correspondence Analysis (MCA)
or one-hot encode with caution
Pitfall 6: Outlier Sensitivity
Regular data: With outlier:
╱ ●
╱ ●●●● ╲
╱ ●●●● ╲
╱●●●● ╲ PC1 now tilted
PC1 ╲ toward outlier!
●●●●
Solution: Use robust PCA or remove outliers first
Pitfall 7: Sign Ambiguity of Eigenvectors
Both v = [0.71, 0.71] and v = [-0.71, -0.71] are valid!
Eigenvectors are defined up to a sign flip.
✓ Resolution:
• Be consistent within your analysis
• Focus on relative relationships, not absolute signs
• Convention: largest loading positive
Pitfall 8: Too Few Observations
Rule of thumb: n ≥ 5p (observations ≥ 5× variables)
With n < p:
• Covariance matrix is singular
• At most n-1 non-zero eigenvalues
• Overfitting risk
Solutions:
• Use regularized PCA
• Use SVD directly
• Collect more data
Pitfall 9: Assuming Independence = Uncorrelatedness
PCA creates UNCORRELATED components, not INDEPENDENT.
Uncorrelated: Cov(PC1, PC2) = 0 (linear relationship = 0)
Independent: All relationships = 0 (including nonlinear)
For independence: Use Independent Component Analysis (ICA)
12. Decision Flowchart
┌─────────────────────┐
│ Start with │
│ raw data X │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Center the data │
│ X_c = X - mean │
└──────────┬──────────┘
│
▼
┌───────────────────────────────┐
│ Variables on same scale? │
│ Is variance meaningful? │
└───────────────┬───────────────┘
│ │
Yes No
│ │
▼ ▼
┌────────────┐ ┌────────────────┐
│ Covariance │ │ Standardize │
│ Matrix │ │ (Correlation) │
└─────┬──────┘ └───────┬────────┘
│ │
└─────────┬─────────┘
│
▼
┌───────────────────────────────┐
│ n >> p? (many more obs than │
│ variables) │
└───────────────┬───────────────┘
│ │
Yes No
│ │
▼ ▼
┌────────────┐ ┌────────────────┐
│ Eigen │ │ SVD │
│ decomp of Σ│ │ (directly │
└─────┬──────┘ │ on X_c) │
│ └───────┬────────┘
│ │
└─────────┬─────────┘
│
▼
┌───────────────────────────────┐
│ Choose # components: │
│ • Scree plot elbow │
│ • Cumulative variance ≥ 80% │
│ • Kaiser (λ > 1 for corr.) │
└───────────────────────────────┘
13. Summary Table
| Concept | Formula/Definition | Key Point |
|---|
| Centering | X_c = X - μ | Always required |
| Standardizing | Z = (X - μ)/σ | Use when scales differ |
| Covariance matrix | Σ = X_c^T X_c / (n-1) | Uses variance in original units |
| Correlation matrix | R = Z^T Z / (n-1) | Diagonal = 1, unit-free |
| Eigenvalues (λ) | det(Σ - λI) = 0 | Variance captured by PC |
| Eigenvectors (v) | Σv = λv | Direction (loadings) of PC |
| SVD | X_c = USV^T | λᵢ = sᵢ²/(n-1) |
| PC Scores | T = X_c V | Transformed coordinates |
| Variance explained | λᵢ / Σλⱼ | Importance of each PC |
| Biplot | Scores + Loadings | Visualize both together |