Partial least squares (PLS) regression for correlated predictors
Partial least squares (PLS) regression predicts a response from many predictors that are strongly correlated with each other, or that outnumber the observations. Instead of using the predictors directly, it builds a few new variables, called components, as weighted sums of the predictors chosen to explain the response, and regresses the response on those. You choose how many components to keep by checking how well the model predicts data it has not seen.
When to use it
- Your predictors move together: zone temperatures along a barrel, readings from neighboring sensors, absorbances at nearby wavelengths in a spectrum.
- Regression analysis gives a high R² but no significant coefficients, huge variance inflation factors (VIF) and coefficients with signs that make no physical sense.
- You have more predictors than rows, which ordinary least squares cannot handle at all.
- Prediction is the goal (a soft sensor, a quick release test) more than isolating the effect of each input.
If the predictors are only mildly correlated and you want to know which ones matter, best subsets is easier to read. If you want to describe the structure of the predictors alone, with no response, use principal components.
How it works
PLS works on standardized predictors (each centered and divided by its standard deviation) and a centered response. One common algorithm, NIPALS for a single response, repeats these steps for each component:
- Compute a weight vector w proportional to Xᵀy, the covariance of each predictor with the response, scaled to length 1.
- Form the component scores t = Xw: one number per row, a weighted sum of the predictors.
- Regress y on t, and regress each predictor column on t.
- Remove what t explains from X and from y (deflation), and start again for the next component.
After A components, the model can be written back as ordinary coefficients on the standardized predictors, or in original units:
ŷ = ȳ + b₁z₁ + b₂z₂ + … + bₖzₖ, zⱼ = (xⱼ − x̄ⱼ) / sⱼThe difference from principal components regression is in step 1: principal components summarize X without looking at y, while PLS weights the predictors by how they relate to y.
With every possible component, PLS gives the same fit as least squares, collinearity problems and all. The benefit comes from stopping early. To choose A, use leave-one-out cross-validation: refit the model n times, each time leaving out one row, predict that row, and add up the squared prediction errors into PRESS. Then:
R²(pred) = 1 − PRESS / SSTPick the number of components with the highest R²(pred), or the smallest one that comes close to it.
Example
A compounding line wants to predict the melt flow index (MFI, g/10 min) of each polypropylene batch from eight extruder signals, so it can adjust before the lab result arrives. It has 20 batches with the average of each signal and the lab MFI. The first five:
| Batch | Zone 1 (°C) | Zone 2 (°C) | Zone 3 (°C) | Zone 4 (°C) | Die (°C) | Screw (rpm) | Motor (A) | Melt pressure (MPa) | MFI |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 194.0 | 203.1 | 215.0 | 218.8 | 221.6 | 81 | 47.4 | 16.0 | 10.67 |
| 2 | 194.0 | 204.1 | 215.0 | 218.4 | 224.6 | 83 | 45.0 | 15.6 | 10.56 |
| 3 | 193.3 | 205.4 | 215.6 | 219.3 | 222.2 | 67 | 38.5 | 13.5 | 11.84 |
| 4 | 197.5 | 208.3 | 218.2 | 223.3 | 227.0 | 80 | 45.5 | 14.9 | 11.41 |
| 5 | 190.7 | 202.2 | 212.2 | 215.9 | 220.1 | 78 | 44.7 | 15.5 | 9.66 |
The five temperatures correlate with each other at 0.96 to 0.99, and motor current with melt pressure at 0.95. MFI ranges from 9.66 to 13.89, with a standard deviation of 1.085 g/10 min.
Least squares on all eight predictors gives R² = 94.7%, but none of the eight predictors has a p-value below 0.2, the VIFs run from 18 to 81, and die temperature gets a negative coefficient although hotter melt flows more easily (its correlation with MFI is +0.82). R²(pred) drops to 81.9%.
PLS, with leave-one-out cross-validation:
| Components | R² (%) | R²(pred) (%) |
|---|---|---|
| 1 | 88.48 | 85.35 |
| 2 | 91.47 | 88.11 |
| 3 | 94.14 | 87.24 |
| 4 | 94.48 | 86.12 |
| 5 | 94.65 | 83.10 |
| 6 | 94.68 | 82.16 |
Two components give the best predictions. Their standardized coefficients:
| Predictor | Zone 1 | Zone 2 | Zone 3 | Zone 4 | Die | Screw | Motor | Melt pressure |
|---|---|---|---|---|---|---|---|---|
| Coefficient | 0.162 | 0.166 | 0.164 | 0.181 | 0.157 | −0.126 | −0.195 | −0.214 |
The cross-validated prediction error, √(PRESS/n), is 0.365 g/10 min for the two-component model and 0.451 g/10 min for least squares.
How to read the results
- Choose components by R²(pred), not R². R² keeps rising with each component; R²(pred) peaks at two and then falls, as later components start to fit noise.
- Read the coefficients as a pattern. All five temperatures get similar positive weights, and the three throughput signals get negative ones. The model says "hotter melt flows more, heavier load flows less", which matches the physics, instead of crediting one zone and penalizing its neighbor.
- Do not read p-values into PLS coefficients. Standard PLS output has no t-tests. To judge which predictors matter, look at the size of the standardized coefficients or at VIP (variable importance in projection) scores, and confirm with new data.
- Check the prediction error against the need. An error of about 0.37 g/10 min against a specification of, say, ±1.0 g/10 min may be good enough to steer the line, not to release product.
Common mistakes
- Keeping too many components. With all of them, PLS turns back into least squares, with the same unstable coefficients.
- Skipping standardization. Without it, a predictor in large units (rpm) outweighs one in small units (MPa) for no reason.
- Validating on the same data. Cross-validation is the minimum; a test on later batches is better, because processes drift.
- Using PLS to prove cause. It predicts well from correlated signals but cannot say which zone actually drives MFI. An experiment can.
- Ignoring outliers. One bad sensor reading can bend a component. Plot the scores and residuals.
Frequently asked questions
What is the difference between PLS and principal components regression?
Both compress correlated predictors into a few components. Principal components are chosen to explain X alone; PLS components are chosen to explain y. PLS usually needs fewer components for the same prediction.
How many components should I use?
The number that maximizes cross-validated R²(pred), or the smallest number that comes within a point or two of it. Here, two.
Can PLS handle more predictors than observations?
Yes. That is one of its main uses, for example with hundreds of wavelengths from a spectrometer and a few dozen samples.
Does PLS need normally distributed data?
No for fitting and prediction. The normal distribution matters only if you build prediction intervals, which then are approximate.