Polynomial least squares
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical inference.
In regression, polynomial least squares are estimates of a polynomial mean obtained by minimising squared residuals. Polynomial least squares estimates the coefficients of a polynomial mean by minimising the sum of squared residuals. The mean is a curve in the predictor and a straight line in the coefficients. The fit is therefore ordinary linear least squares on the powers of the predictor, not a nonlinear search.[1][2]
Polynomial least squares
| Fact | Value |
|---|---|
| Topic | Statistical inference |
| Listed on | Statistical inference |
| Worked example | 1 |
Motivating example
Wage plotted against age rises and then flattens. A straight line in age cannot follow that bend. A polynomial in age can: each extra power is another column, and least squares estimates the columns together. A degree-4 polynomial is the curve James, Witten, Hastie, and Tibshirani fit to the Wage data, and it is still linear in its five coefficients. The bend is in age. The estimation is the linear one.[1]
Definition
For a single predictor and a chosen degree , the mean is
The coefficients minimise
The powers are known once is known, so the normal equations are linear in . A function is statistically linear when the unknown coefficients sit outside known functions of the predictors. A quadratic in meets that test. A mean such as does not, because sits inside the function.[1][2][3]
Properties
The fitted polynomial is a linear combination of the estimated coefficients. Under an additive error model with fixed and uncorrelated errors of variance , the variance of at a chosen is times a quadratic form in the powers of . That variance is a pointwise scale. A band drawn at each from the pointwise standard error does not, by that construction, cover the whole curve at once.[1]
Adding a power cannot raise the residual sum of squares on the data used to fit the curve. The degree- polynomial includes the degree- polynomial as the case , so the minimiser is at least as close, in squared error, as the lower degree. The drop is the price of one more free coefficient. It is evidence of curvature only together with the plot.[1]
On four points the algebra is small enough to see. For , , , and , the power sums are , , , , , , , and . The normal equations have the unique solution , , . The fitted values are , , , and . The residuals are , , , and , and the residual sum of squares is . The straight line on the same points has intercept and slope , and its residual sum of squares is . The quadratic spends one extra coefficient and removes from that sum.[2]
Statistical use
Choose a small degree, fit the powers by ordinary least squares, and plot on the range of that was observed. James and coauthors warn against a degree above 3 or 4: for large the polynomial can take strange shapes, especially near the boundary of the observed . Compare the residual sum of squares with that of the straight line on the same points. A smaller sum is expected once extra coefficients are free. It becomes a reason to keep the bend when the plot shows the bend inside the range, not only at the two ends.[1]
The coefficients themselves are a poor summary of a high-degree fit. The fitted value at one age depends on all of them at once. Report at ages inside the sample, not a list of powers as if each were a separate slope.[1]
Worked example
The four-point quadratic above has coefficients , , and , and residual sum of squares . The straight line on the same points has residual sum of squares . The fitted curve falls slightly from to , because the linear coefficient is negative, and then rises, because the square coefficient is positive. Both statements are readings of one fitted function. Neither coefficient is the change in per unit .[1][2]
Your turn. Fit to , , and . Give the three coefficients and the residual sum of squares.
The three points lie on , so the coefficients are , , and . Every residual is , and the residual sum of squares is .
Common misconceptions
Polynomial least squares is not nonlinear regression. The mean is nonlinear as a function of and linear as a function of . The test is whether the coefficients can be moved outside known functions of the data. If they can, the fit is the linear one, extra columns and all. Dodge’s nonlinear example, a mean in which two coefficients sit inside exponentials, fails that test and is solved iteratively. A quadratic does not.[2][3]
A large degree is not a closer look at the same curve. It is a more flexible function, and near the ends of the age range the extra flexibility is where a polynomial is least trustworthy. The pointwise band at twice the standard error is not a statement that the whole curve lies inside the band with the same coverage. Each has its own interval.[1]
Connections
The one-predictor case of ordinary least squares is the degree-1 polynomial. Multiple linear regression is the same algebra with columns that need not be powers of a single . Nonlinear regression begins when a coefficient moves inside the function and the normal equations stop being linear. A degree so high that the curve follows the sample is the overfitting problem for this particular linear model.[1][3]
Check yourself
Try these questions before opening an answer.
Curved in x, linear in the coefficients
The mean β0 + β1 x + β2 x^2 bends in x. Why is the least-squares fit still the linear one?
Each coefficient multiplies a column that is known once x is known. The normal equations stay linear in the coefficients. A coefficient sitting inside the function, as in an exponential rate, is the nonlinear case.
An extra free coefficient
A quadratic is fitted to the same points as a straight line and the residual sum of squares falls. Why is that drop expected even before anyone looks at the plot?
The straight line is the quadratic with the square coefficient set to zero. The minimiser over a larger set of coefficients cannot have a larger residual sum of squares. The drop becomes evidence of curvature only together with the plot.
The edge of the range
Why is a high-degree polynomial least trustworthy near the ends of the observed range of x?
The extra powers can swing sharply there even when the curve is calm in the middle, and a polynomial has no horizontal asymptote to level off.
History
Least squares, as a way to combine inconsistent observations, was published by Legendre in 1805, and Gauss and Adrain were working with the same squared-error criterion in the same period. The extension from a straight line to a polynomial keeps that criterion and adds powers as further predictors. The modern warning about high degree is the same warning as for any flexible linear model: the fit can follow the sample near the edge of the observed range.[2][1]
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b c d e f g h i j k a. (pp. 266–267, §7.1) b. (p. 267, §7.1) c. (p. 266, §7.1) d. (pp. 267–268, §7.1) e. (pp. 266–267, §7.1) f. (pp. 266–268, §7.1) g. (p. 266, §7.1) h. (p. 266, §7.1) i. (pp. 266–268, §7.1) j. (pp. 266–267, §7.1) k. (p. 266, §7.1) James, G., Witten, D., Hastie, T. & Tibshirani, R. (2013). An Introduction to Statistical Learning: with Applications in R (1st ed.). Springer, New York. https://doi.org/10.1007/978-1-4614-7138-7
- ^ a b c d e f a. (§4.1.4.1) b. (§4.1.4.1) c. (§4.1.4.1) d. (§4.1.4.1) e. (§4.1.4.1) f. (§4.1.4.1) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §4.1.4.1: Linear Least Squares Regression. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm
- ^ a b c a. (p. 373) b. (p. 373) c. (p. 304) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
Cite this page
StatWiki (2026). "Polynomial least squares." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/polynomial-least-squares.html
@misc{statwiki_polynomial_least_squares,
author = {{StatWiki}},
title = {{Polynomial least squares}},
year = {2026},
url = {https://www.statwiki.io/articles/polynomial-least-squares.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}