Problems solved in full
-
Six points with 99.49% of the variance on PC1 and 0.51% on PC2 8 steps
Six points: (2, 1), (3, 2), (4, 2.2), (5, 3.2), (6, 3.9), (7, 5). The panel reports 99.49% of the variance on PC1 and 0.51% on PC2, which reads like a cloud that is essentially a line. Work out how far off that line the points actually sit.
-
Centre first, because everything below is about spread and nothing about position. The x-values run 2 to 7 in unit steps, so their mean sits at the middle of the range and the centred x-column is symmetric: Β±0.5, Β±1.5, Β±2.5. Only y needs arithmetic.
-
The covariance divides the summed products by n β 1 = 5, not by 6. One degree of freedom has already been spent estimating the mean that was just subtracted, and with only six points that correction is worth 20%.
-
Two numbers are enough to get both eigenvalues, and neither of them requires a direction. The trace is the total variance; the determinant measures how far the matrix is from singular. Against a trace of 5.581667, a determinant of 0.156933 is a matrix that is very nearly rank 1.
-
Solve the characteristic quadratic. Ξ»1 comes out about 200 times Ξ»2 β the shape of this cloud compressed into one comparison.
-
The explained-variance rows are that ratio and nothing else. So 99.49% is a statement about Ξ»1 and Ξ»2, and it inherits what they are: variances, which carry the units of the data squared. Hold that thought.
-
The direction is the eigenvector, and for a 2Γ2 covariance matrix with a non-zero off-diagonal you can write it down without solving anything: (Ξ»1 β Syy, Sxy) already points along PC1. Scale it to unit length and it is the printed vector.
-
Turn that a quarter turn to get v2, then project the first centred point onto it. The result, 0.031179, is the second number in the scores table. So that entire column β which the panel prints without ever saying what it is β is the signed distance of each point from the PC1 line, and the worst of the six is β0.236855.
-
Now the question the percentages were hiding. Ξ»2 is a variance, so it is a squared distance, and the typical miss is its square root. Compare that with the square root of Ξ»1, which is the spread along the line.
Answer
The points sit about 7.13% of the cloud's length off the PC1 line, not 0.51%. Both figures describe the same six points; one is a ratio of squares and the other a ratio of lengths, and the square root between them is worth a factor of 14 here. That gap is the trap in every rule of the form "keep 99% of the variance": to hold the perpendicular miss under 1% of the spread you need PC2 below 0.01% of the variance, a hundred times stricter than the rule sounds. In data units the miss is βΞ»2 = 0.168104, and it is not hiding β it is drawn on the chart as the grey segment from each green point to its blue projection, and the segments are plainly not of zero length.
-
-
PC1 of slope 0.769 and a least squares fit of 0.763 6 steps
PC1 is printed as (0.792687, 0.609629), a direction of slope 0.769. Fitting y to x by least squares, from the very same covariance entries, gives 2.67/3.5 = 0.763. Two lines through one cloud of six points. Show which is the steeper β and that it is always that one.
-
Least squares on y minimises the vertical gaps, and the minimiser is Sxy/Sxx. Note what is in the denominator: the spread of x alone. The fit takes x as given and asks only what y does in response.
-
PC1's slope is read straight off the printed unit vector, since a direction (a, b) has slope b/a. It sits about 6 thousandths above the regression slope β small, and not zero.
-
To compare the two properly, write PC1's slope the way the eigenvector defines it rather than as a ratio of decimals. The numerator is the same Sxy in both, so the whole difference lives in the denominator: Sxx for the regression, Ξ»1 β Syy for PC1.
-
Expand Ξ»1. Whether PCA has the smaller denominator has now become a question about a single square root.
-
And that square root is smaller than the trace exactly when the determinant is positive, which holds for any cloud that is not a perfect straight line. PC1's denominator is therefore always the smaller one, so PC1 is always the steeper of the two. Nothing about these six points was used.
-
Swap the roles and regress x on y instead. That is a third line, and rewriting its slope for the same y-against-x picture puts it at 0.779650. PC1 does not move under the swap β the covariance matrix is symmetric in x and y β so the argument of the previous step now runs the other way, and PC1 is the shallower of this pair.
Answer
Three lines through one cloud: 0.762857 < 0.769067 < 0.779650, with PC1 strictly in the middle. The two regressions disagree by 2.2% on a cloud the panel calls 99.49% one-dimensional, and they disagree because they answer different questions β predict y from x, or predict x from y. PC1 answers neither. It minimises perpendicular distance, so relabelling the axes rotates the picture and leaves the line exactly where it was, and its residuals are the second score column rather than a vertical gap. The three collapse into one only when det C = 0, which is to say when the points really are collinear and there is no longer anything to disagree about. Between those extremes, PCA is the line to use when both coordinates carry measurement error, and the wrong line when you genuinely want a prediction: the regression slope is shallower on purpose, because pulling toward flat is what makes the squared prediction error smallest.
-
Learning path
Matrices that move things
References (2)
- Insight block 3 β the perpendicular line of closest fit, thirty years before the name: K. Pearson, "On lines and planes of closest fit to systems of points in space." Philosophical Magazine 2(11), 559β572, 1901.
- Where "principal component" was coined: H. Hotelling, "Analysis of a complex of statistical variables into principal components." Journal of Educational Psychology 24(6), 417β441, 1933.