Non-Linear Regression, Data Transformations and Box-Cox
Non-linear regression and data transformations handle relationships that a straight line cannot describe. A quadratic term models a curve with a peak or a trough, while transforming Y or X, often with a Box-Cox power λ, straightens a curve and stabilizes the variance. Predictions are then back-transformed into the original units.
Quick facts
- Type
- Extensions of linear regression for curvature and unequal variance
- Quadratic model
- Ŷ = b₀ + b₁X + b₂X²; optimum at X = −b₁ / (2b₂)
- Box-Cox family
- Y^λ for λ ≠ 0 and ln Y for λ = 0; Y must be positive
- Common λ values
- 2 (square), 1 (none), 0.5 (square root), 0 (log), −1 (reciprocal)
- Origin
- Box and Cox (1964)
- Reference
- IASSC™ Green Belt Body of Knowledge §4.2.1 and §4.2.5
- Exam relevance
- Green Belt (Improve phase)
At a glance
- Plot Y against X — look for a curve, a peak or a funnel
- Read the residual plots — a U shape means curvature; a funnel, unequal variance
- Add a term or transform — a squared X for curvature; a Box-Cox power of Y for variance
- Compare the models — adjusted R² and S, not R²
- Recheck the residuals — the patterns should be gone
- Back-transform predictions — report results in the original units
When do you need non-linear regression or a transformation?
A straight line is often a good first model, but many process relationships bend. Throughput rises with staff and then falls as people get in each other's way; waiting times are skewed, with a long right tail; the scatter of cost grows with order size.
Three signals tell the team the linear model is not enough:
- the scatter plot curves or has a peak or a trough;
- the residuals versus fits or versus X form a U or an inverted U;
- the residuals fan out as the fitted values grow, or the normal plot of the residuals bends.
Two kinds of fix exist. A polynomial term (usually X²) lets the model curve, and is still fitted by ordinary least squares, because the model stays linear in its coefficients. A transformation changes the scale of Y or X so that a straight line fits and the variance steadies.
Non-linear regression and transformations are the response to a pattern in the residuals, not a first choice.
How do you fit and read a quadratic model?
The quadratic model adds the square of X:
Ŷ = b₀ + b₁X + b₂X²- b₂ < 0: the curve has a maximum; b₂ > 0: it has a minimum.
- The optimum lies at
X* = −b₁ / (2b₂), and the predicted Y there is found by substituting X* into the equation.
Worked example. Kestrel Retail studies customers served per hour (Y) against staff on the checkouts (X), with data from 3 to 12 staff. The fit is Ŷ = 50 + 16X − 1.0X².
| Quantity | Calculation | Result |
|---|---|---|
| Optimum staffing | −16 / (2 × −1.0) | 8 staff |
| Predicted Y at 8 staff | 50 + 16 × 8 − 1.0 × 64 | 114 per hour |
| Predicted Y at 4 staff | 50 + 64 − 16 | 98 per hour |
| Predicted Y at 12 staff | 50 + 192 − 144 | 98 per hour |
The intercept (50 at zero staff) has no practical meaning: zero staff lies outside the data.
To decide whether the curve is worth it, compare the models on the same n = 24 observations with adjusted R² and S. In the store data, the linear model gave R² = 0.41 (adjusted 0.383) and the quadratic model R² = 0.88 (adjusted 0.869, computed as 1 − 0.12 × 23 / 21), with a much smaller S. R² alone would always prefer the bigger model.
A quadratic regression model answers a practical Improve question directly: at what setting of X does Y peak?
Which transformations straighten a relationship?
Transformations change the scale on which the model is fitted:
| Pattern | Transformation | Model fitted |
|---|---|---|
| Y grows by a constant percentage per unit of X | log of Y | ln Y = b₀ + b₁X |
| Y rises quickly, then flattens | log of X | Y = b₀ + b₁ ln X |
| Y and X follow a power law | log of both | ln Y = b₀ + b₁ ln X |
| Spread of Y grows with its level | square root or log of Y | √Y or ln Y on X |
| Y approaches a ceiling or a floor | reciprocal | 1 / Y or 1 / X |
Transforming X changes the shape of the relationship but leaves the errors alone. Transforming Y changes both the shape and the error variance, which is why it is the usual fix for a funnel in the residuals.
At Northgate Insurance, claim handling cost spread wider as claim value grew. Fitting the log of cost removed the funnel, and the slope then read as an approximate percentage change in cost per unit of claim value.
The right transformation in non-linear regression is the one that leaves random residuals and a model the process owner can still interpret.
How does the Box-Cox transformation work?
Box and Cox proposed a family of power transformations indexed by λ, and a way to choose λ from the data:
Y(λ) = (Y^λ − 1) / λfor λ ≠ 0Y(λ) = ln Yfor λ = 0
In practice, software and texts report the simpler Y^λ, which has the same shape, and round λ to a convenient value:
| λ | Transformation | Back-transformation |
|---|---|---|
| 2 | Y² | √Y′ |
| 1 | None | None |
| 0.5 | √Y | Y′² |
| 0 | ln Y | e^Y′ |
| −0.5 | 1 / √Y | 1 / Y′² |
| −1 | 1 / Y | 1 / Y′ |
The procedure searches for the λ that makes the transformed data most nearly normal with the most stable variance (the maximum-likelihood λ). If the confidence interval for λ includes 1, no transformation is needed.
Box-Cox needs strictly positive data. Zeros or negative values must first be shifted by adding a constant, or handled with another family such as the Johnson transformation.
The Box-Cox transformation is a data-driven way to choose one power for Y, used in regression and also before capability analysis of skewed data.
How do you back-transform predictions?
A model fitted on a transformed Y predicts on that scale. Results must go back to the original units before anyone uses them.
Worked example. Harbourside Council fits permit processing time on a transformed scale. Three cases:
| λ used | Model predicts | Back-transformation | Prediction in days |
|---|---|---|---|
| 0.5 (√Y) | 5.5 | 5.5² | 30.25 |
| 0 (ln Y) | 2.5 | e^2.5 | 12.18 |
| −1 (1 / Y) | 0.25 | 1 / 0.25 | 4.00 |
Values are rounded half-up to two decimals. The natural log, not the base-10 log, is the λ = 0 member of the family.
Two cautions apply:
- Intervals: back-transform the endpoints of the interval, not the half-width. The interval becomes asymmetric in the original units.
- Mean vs median: the back-transformed prediction of a log model estimates the median of Y, not its mean, when the errors are symmetric on the log scale; the mean of Y is higher, and a correction such as Duan's smearing estimate recovers it.
Back-transformation completes non-linear regression: a prediction in √days or log-days is not a result a process owner can use.
What are the common mistakes with non-linear models and transformations?
Polynomials and transformations are valuable because they keep the familiar least-squares machinery while fitting curved, skewed processes. Their common mistakes are:
- Overfitting with high-order polynomials. A fifth-order curve through eight points reaches R² = 0.99 by following the noise, and predicts new data poorly. Stay with a squared term, occasionally a cubic, unless the mechanism demands more.
- Choosing models on R², which always rises with more terms.
- Deleting the end points that "cause" a curve instead of modeling it.
- Forgetting to back-transform, or using the wrong inverse.
- Applying Box-Cox to data with zeros.
- Extrapolating a curve, which is even riskier than extrapolating a line.
Non-linear regression and transformations should leave a simpler story, not a more complicated one: random residuals and a model the team can explain.
Transforming Y vs. adding a polynomial term: what is the difference?
| Transforming Y (log, Box-Cox) | Adding a polynomial term (X²) | |
|---|---|---|
| Fixes | Curvature and unequal variance, and skewed errors | Curvature with a peak, a trough or a bend |
| Error variance | Changes: can stabilize a funnel | Unchanged |
| Interpretation | On the transformed scale; back-transform predictions | In the original units; optimum at −b₁ / (2b₂) |
| Data requirement | Y > 0 for logs and Box-Cox | None beyond the usual |
| Risk | Wrong back-transformation | Overfitting with high orders |
Add a squared term when the relationship has a real peak or bend and the variance is steady; transform Y when the spread grows with the level or the errors are skewed. The residual plots show which problem you have.
Exam focus
Non-linear regression is IASSC™ section 4.2.1 and data transformation with Box-Cox is 4.2.5, both in Green Belt scope only. Expect to find the optimum of a quadratic with −b₁ / (2b₂), choose adjusted R² to compare models, spot overfitting, and back-transform a prediction for λ = 0.5, 0 or −1. Traps include using a base-10 log for λ = 0 and applying Box-Cox to data with zeros. Practise in the Improve phase drill.
Practise this DMAIC phase →FAQ
What does λ mean in a Box-Cox transformation?
λ is the power applied to Y. λ = 1 leaves the data unchanged, λ = 0.5 takes the square root, λ = 0 takes the natural log, and λ = −1 takes the reciprocal. The Box-Cox procedure estimates the λ that makes the transformed data most nearly normal with the steadiest variance.
Can you use Box-Cox with zero or negative values?
Not directly. The Box-Cox family, including the log at λ = 0, is defined only for strictly positive values. Common fixes are adding a small constant to every value before transforming, or using a family that accepts zeros and negatives, such as the Johnson transformation.
How do you find the maximum of a quadratic regression?
For Ŷ = b₀ + b₁X + b₂X² with a negative b₂, the maximum lies at X = −b₁ / (2b₂). Substitute that X back into the equation to get the predicted Y there. Check that the optimum lies inside the range of the data; otherwise it is an extrapolation.
Is polynomial regression linear or non-linear?
Both, depending on the sense. The curve is non-linear in X, but the model is linear in its coefficients, so ordinary least squares fits it like any multiple regression with X and X² as predictors. Truly non-linear models, such as exponential decay with an unknown rate, need iterative fitting.
Why does R² not help choose between a linear and a quadratic model?
R² can only rise when a term is added, so the quadratic model always scores at least as high. Adjusted R² penalizes the extra term, and S shows the prediction error in the units of Y; together with the residual plots, they show whether the curve is worth keeping.
Sources
- Box, G. E. P., & Cox, D. R. (1964). An Analysis of Transformations. Journal of the Royal Statistical Society, Series B, 26(2), 211–243.
- Montgomery, D. C., Peck, E. A., & Vining, G. G. (2021). Introduction to Linear Regression Analysis (6th ed.). Wiley.
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.3.6: Box-Cox Normality Plot.
- IASSC™ (n.d.). Lean Six Sigma Green Belt Body of Knowledge, §4.2.1 and §4.2.5.
- Last reviewed