4. PCA monitoring statistics
Once a PCA model has been built from historical normal-operation data, process monitoring reduces to two complementary statistics computed at every new sample: Hotelling's T², which measures variation inside the retained principal component subspace, and the Squared Prediction Error (SPE, also called Q statistic), which measures variation outside that subspace. Together they partition the measurement space into a modeled region and a residual region, and a fault is flagged when either statistic exceeds its control limit.
Definition of the two statistics
Let x ∈ ℝm be a mean-centered and scaled measurement vector, P ∈ ℝm×a the loading matrix of the first a principal components, and Λ = diag(λ₁, …, λa) the corresponding eigenvalues. The score vector is t = PTx, and the reconstruction is x̂ = Pt. The two statistics are:
T² = tᵀ Λ⁻¹ t = xᵀ P Λ⁻¹ Pᵀ x
SPE = ‖x − x̂‖² = ‖(I − P Pᵀ) x‖²
T² is a Mahalanobis-type distance in the score space: it weights each score by the inverse of its variance, so a deviation along a low-variance component counts more heavily than the same deviation along a high-variance one. SPE is the squared Euclidean norm of the residual, i.e. the part of x that the PCA model cannot reconstruct. A fault that changes correlations among variables typically inflates SPE; a fault that shifts the process along an existing correlation direction typically inflates T².
Distributions and control limits
Under the assumption that x follows a multivariate normal distribution and the model is correct, T² follows a scaled F-distribution:
T² ~ [a(n² − 1)] / [n(n − a)] · F(a, n − a)
where n is the number of samples used to build the model and a the number of retained components. The (1 − α) control limit is therefore
T²_lim = [a(n² − 1)] / [n(n − a)] · F_{1−α}(a, n − a)
For SPE, the exact distribution is a weighted sum of chi-squares, but the standard practice is the Box approximation, which matches the first two moments to a scaled chi-square:
SPE_lim = g · χ²_{1−α}(h)
g = v / (2·m̄), h = 2·m̄² / v
Here m̄ and v are the sample mean and variance of the SPE values computed on the training data. This approximation is robust and is what most industrial implementations (e.g. the pca monitoring utilities in MATLAB, or Python's scikit-learn plus custom code) use in practice.
Interpreting detection results
At each new sample, compute T² and SPE and compare them with their limits. Four combinations are possible, and each carries a distinct diagnostic meaning:
| T² | SPE | Interpretation |
|---|---|---|
| Normal | Normal | Process is consistent with the model — no action. |
| High | Normal | Deviation lies inside the principal subspace; a shift along a dominant correlation direction. Often a setpoint or grade change. |
| Normal | High | Deviation lies in the residual subspace; the correlation structure among variables has broken. Typical of sensor faults or unmodeled disturbances. |
| High | High | Both subspaces affected — a severe fault or a combination of faults. |
Beyond the binary flag, contribution plots are the standard tool for locating the fault. For SPE, the contribution of variable j at time k is the squared residual element: c_j = (x_j − x̂_j)². For T², the contribution is c_j = x_j · [P Λ⁻¹ Pᵀ x]_j. Variables with the largest contributions are the prime suspects. In practice, a contribution plot that shows one variable dominating the SPE is almost always a sensor or actuator problem, whereas a group of correlated variables contributing together points to a process upset.
Worked example
Consider a simulated 6-variable process (temperatures, pressures, and a flow) with 500 normal samples. After autoscaling, PCA retains a = 3 components explaining 87% of variance. The training SPE has mean m̄ = 0.42 and variance v = 0.09, giving g = 0.107 and h = 3.92; with α = 0.01, χ²₀.₉₉(3.92) ≈ 13.3, so SPE_lim ≈ 1.42. The T² limit with n = 500, a = 3, α = 0.01 is approximately 11.3.
At sample 612, a step change is injected into variable 4 (a temperature sensor bias of +2σ). The computed statistics are T² = 4.1 (below limit) and SPE = 3.8 (above limit). The SPE contribution plot shows variable 4 contributing 3.1 of the 3.8 total. The diagnosis is a sensor fault on variable 4, not a process fault — the correlation structure was broken but the dominant variation direction was not excited.
Practical considerations
Three issues dominate real deployments. First, autocorrelation: industrial data are rarely i.i.d., so the analytical limits understate the false-alarm rate. Dynamic PCA (augmenting each sample with lagged values) or empirical limits from a validation set mitigate this. Second, non-normality: skewed variables inflate SPE; a Box–Cox transform before PCA often restores acceptable behavior. Third, model maintenance: after a genuine process change (new feedstock, retuned controller), the old limits become invalid and the model must be rebuilt or adapted. A practical rule is to recompute limits whenever the false-alarm rate on a known normal window exceeds 2–3%.
In summary, T² and SPE are not redundant — they monitor orthogonal subspaces and their joint pattern is the first diagnostic clue. The control limits follow from the F and Box χ² distributions under normality, and contribution plots convert a detection flag into an actionable fault location. Mastering this pair is the foundation for every subsequent multivariate monitoring method in this course.