Why PCA Centers the Data
Principal component analysis (PCA) describes directions of variation among observations. To describe variation, it must distinguish how observations differ from one another from where the whole data cloud happens to sit on the coordinate axes. Centering makes that distinction: it moves the data centroid to the origin by subtracting each variable’s mean from its observed values.
This operation is simple, but its interpretation matters. PCA on uncentered data can be driven by the variables’ overall levels relative to the origin, rather than by their variation around the data cloud’s center. Centering does not change the differences between observations, but it changes the reference point from which those differences are measured.
The subtraction is performed column by column: all observations of variable 1 have the mean of variable 1 subtracted from them, and so on. Centering does not subtract one overall mean from the entire data table, and it does not subtract each observation’s row mean. For the standard PCA interpretation here, the input is a rectangular set of observations on numeric variables, with values available to calculate each variable’s mean.
What Centering Guarantees
Every column of centered values sums to zero. This follows directly from the definition:
Thus, the average centered value of each variable is zero. In geometric terms, the centroid of the centered observations is at the origin. Individual observations need not be at the origin, and centering does not make their variability zero.
The same idea applies to any direction through the data. If \(w\) is a direction vector and \(w^\mathsf{T}x_i\) is the projection of observation \(i\) onto that direction, the mean of these projected values is \(w^\mathsf{T}\bar{x}\). The centered projection is therefore \(w^\mathsf{T}(x_i-\bar{x})\). For a unit direction \(w\), the sample variance of the projected observations is:
This expression measures squared deviations of projected observations from their projected mean. It does not measure squared projected distance from the origin unless that mean is zero. PCA uses variation around the centroid; centering puts that reference point at zero.
Why the Centroid Is the Reference Point
A useful justification is that the centroid is the point that minimizes the total squared distance from the observations. Let \(a\) be any proposed reference point and write each observation as \(x_i=\bar{x}+(x_i-\bar{x})\). Expanding the squared distances gives:
The cross term is zero because the centered observations sum to zero. The final term is nonnegative, so the total is minimized when \(a=\bar{x}\). This explains why centering is not an arbitrary adjustment: it chooses the reference point that leaves the squared distances measuring spread around the observations’ own centroid.
The same reasoning applies after projection onto any fixed direction. Projected observations have mean \(w^\mathsf{T}\bar{x}\); their deviations from that mean are the projections of \(x_i-\bar{x}\). Hence a direction’s PCA variation criterion is based on those centered projections. The detailed construction of the covariance matrix and the procedure for finding principal directions are separate steps.
Worked Example: Centering a Small Two-Variable Data Set
A hypothetical insurer summarizes four service offices using two variables: monthly policies processed, in hundreds, and average processing hours per policy. The observations are \((2,10)\), \((4,13)\), \((6,14)\), and \((8,19)\). Find the centroid and all centered observations, then verify the column-sum property.
Method. Calculate the mean separately for each variable, subtract each mean from its column, and check that the centered values in each column sum to zero. The common mistake to avoid is subtracting one overall mean from every entry.
For policies processed, the sum is \(2+4+6+8=20\), so the mean is \(20/4=5\). For processing hours, the sum is \(10+13+14+19=56\), so the mean is \(56/4=14\). The centroid is therefore \((5,14)\).
Subtract \((5,14)\) from each observation:
The first centered column sums to \(-3-1+1+3=0\). The second sums to \(-4-1+0+5=0\). Thus the centered observations have centroid \((0,0)\). As an additional check on their spread around the centroid, their squared Euclidean distances from the origin are \(25\), \(2\), \(1\), and \(34\), for a total of \(62\).
The total of \(62\) describes squared distance from the original centroid after centering. It is not the sum of squared distances from the origin in the uncentered coordinate system. The distinction is the point of the calculation.
Worked Example: Translation Does Not Change Centered Values
A hypothetical analyst records three two-variable observations, \((1,2)\), \((3,4)\), and \((5,6)\). A revised reporting system adds 10 to every value of the first variable and subtracts 3 from every value of the second. Calculate both sets of centered observations and explain what remains unchanged.
Method. Center each data set using its own column means. The common mistake to avoid is using the original means after the values have been shifted.
For the original observations, the means are \((1+3+5)/3=3\) and \((2+4+6)/3=4\). Subtracting \((3,4)\) gives \((-2,-2)\), \((0,0)\), and \((2,2)\).
The shifted observations are \((11,-1)\), \((13,1)\), and \((15,3)\). Their means are \((11+13+15)/3=13\) and \((-1+1+3)/3=1\). Subtracting \((13,1)\) gives \((-2,-2)\), \((0,0)\), and \((2,2)\), exactly as before.
In general, if a fixed vector \(c\) is added to every observation, the new mean is \(\bar{x}+c\), and each centered observation becomes \((x_i+c)-(\bar{x}+c)=x_i-\bar{x}\). Translation changes the coordinate location of the data cloud, not its deviations from its centroid.
Variation Is Not Distance From the Origin
A direct comparison shows why centering matters. Consider three hypothetical observations with values \((1,2)\), \((3,2)\), and \((5,2)\). Their centroid is \((3,2)\), so their centered observations are \((-2,0)\), \((0,0)\), and \((2,0)\). There is variation in the first variable and none in the second.
For a unit direction \(w\), a projected value is \(w^\mathsf{T}x_i\). PCA compares the squared deviations of these projections from their mean. Along the first coordinate direction \(w=(1,0)\), the original projections are \(1,3,5\), with mean \(3\); the centered projections are \(-2,0,2\), and their squared deviations sum to \(4+0+4=8\). Along the second coordinate direction \(w=(0,1)\), all three projections are \(2\), so their centered deviations and their squared deviations sum are zero.
If instead one sums squared projections from the origin, the first direction gives \(1^2+3^2+5^2=35\), while the second gives \(2^2+2^2+2^2=12\). Those totals include the variables’ levels relative to the origin. In particular, the second variable has a nonzero total despite having no variation at all. Centering removes that misleading contribution before PCA evaluates variation.
Centering does not mean that a large mean is irrelevant in every practical analysis. It means that ordinary PCA is being used to study variation around the data centroid, rather than to prioritize variables or directions merely because their values are far from zero.
Practical Interpretation and Common Traps
For complete numeric data with \(n>1\), centering each variable provides a consistent reference point for measuring variation. It also means that translating all observations by the same constant vector leaves the centered data unchanged. The calculations depend on the observations included: if the data set changes, its means and centered values may change as well.
- Center columns, not rows. A separate mean is calculated for each variable across observations.
- Do not confuse centering with scaling. Centering subtracts a mean; it does not divide by a standard deviation or otherwise change the units.
- Do not interpret uncentered squared values as variation. Squared distance from the origin includes both the spread around the centroid and the centroid’s distance from the origin.
- Check the result. Each centered column should sum to zero, apart from small rounding differences if values were rounded during calculation.
Centering is appropriate for the standard PCA question of finding directions that describe variation around the observations’ centroid. It does not, by itself, make different variables comparable in scale, address missing data, or turn categorical labels into suitable numeric measurements. Those are separate data-preparation decisions.
Check Your Understanding
For each problem, calculate the required means and centered quantities before checking the final answer.
- A hypothetical set of three branches has measurements \((3,8)\), \((5,6)\), and \((7,10)\). Find the two means and the centered observations. (Answer: Means \((5,8)\); centered observations \((-2,0)\), \((0,-2)\), \((2,2)\); both centered columns sum to zero.)
- For the one-variable observations \(4,6,8,10\), find the mean, centered values, and sum of squared centered values. Compare that sum with the sum of the original squared values. (Answer: Mean \(7\); centered values \(-3,-1,1,3\); centered squared sum \(20\); original squared sum \(216=20+4(7^2)\).)
- A data set consists of \((20,1)\), \((22,3)\), \((26,5)\), and \((28,7)\). Find its centroid and centered observations, then find the total squared Euclidean distance of the centered observations from the origin. (Answer: Centroid \((24,4)\); centered observations \((-4,-3)\), \((-2,-1)\), \((2,1)\), \((4,3)\); total squared distance \(60\).)
- Start with observations \((2,4)\), \((4,8)\), and \((6,6)\). Add \((-5,10)\) to each observation. Find the new centroid and state the centered observations. (Answer: New centroid \((-1,16)\); centered observations remain \((-2,-2)\), \((0,2)\), and \((2,0)\).)
- For observations \((1,1)\), \((3,1)\), and \((5,1)\), calculate the centered projections onto \(w=(1,0)\) and \(w=(0,1)\), and compare their squared-deviation sums. (Answer: Centroid \((3,1)\); centered projections are \(-2,0,2\) for \(w=(1,0)\) with squared-deviation sum \(8\), and \(0,0,0\) for \(w=(0,1)\) with sum \(0\).)