Tutorials › Econometrics (Graduate) › Polynomial Regressions and Functional-Form Error

Linear Projection and OLS · Tutorial 95 of 952

Polynomial Regressions and Functional-Form Error

Build polynomial regressions in the regressors, interpret their fitted shapes, and see why a lower-degree model can produce different coefficients when curvature is omitted.

Beginner 10 min read

What You'll Learn

  • Construct linear, quadratic, and cubic regressions using powers of a regressor.
  • Interpret polynomial coefficients through fitted values and derivatives.
  • Identify the turning point of a quadratic and the inflection point of a cubic.
  • Distinguish a polynomial regression from a model nonlinear in its parameters.
  • Derive how omitted quadratic curvature can change a linear projection’s slope and intercept.
  • Explain why approximation errors and projection coefficients depend on the distribution of the regressor.

Why Allow a Regression to Bend?

A straight-line regression imposes a constant fitted change in the outcome for a one-unit increase in the regressor. That restriction can be too strong: an outcome might rise quickly at first and then level off, or the fitted relationship might change direction. Polynomial regressions relax the straight-line shape by adding powers of a regressor, while remaining linear in the coefficients estimated by ordinary least squares (OLS).

A polynomial is still a particular functional form, not a guarantee that the conditional mean has been captured correctly. If the underlying relationship curves but the fitted regression is linear, the resulting approximation error can affect both fitted values and the OLS coefficients. The size and direction of that effect depend partly on which regressor values are common in the population.

Definition: A degree-\(K\) polynomial regression in a scalar regressor \(X\) uses the regressors \(1,X,X^2,\ldots,X^K\). Its fitted conditional mean has the form \(\hat m(x)=\hat\beta_0+\hat\beta_1x+\cdots+\hat\beta_Kx^K\). It is linear in the coefficients \(\hat\beta_0,\ldots,\hat\beta_K\), even though it is generally nonlinear in \(x\).

For observations \((Y_i,X_i)\), the degree-\(K\) OLS regression minimizes the sum of squared residuals over coefficients:

$$ \sum_{i=1}^{n}\left(Y_i-\beta_0-\beta_1X_i-\cdots-\beta_KX_i^K\right)^2. $$

This is an ordinary linear regression whose columns include powers of \(X\). The design matrix must have full column rank for the coefficients to be uniquely determined. In practice, the observed \(X_i\) values must provide enough distinct variation to distinguish the included powers. A polynomial can be fitted without assuming it is the true conditional mean; in that case it gives a least-squares projection onto the chosen set of powers.

Reading a Fitted Polynomial’s Shape

The coefficients of a polynomial are not, in general, constant marginal effects. The fitted change in \(Y\) for a small change in \(x\) is described by the derivative of the fitted polynomial. For a quadratic, the derivative varies linearly with \(x\); for a cubic, it is quadratic in \(x\). These derivatives describe the fitted curve, not automatically a causal effect.

Worked Example: A Quadratic Fitted Relationship

Suppose a hypothetical OLS analysis of 120 employees, with training hours \(x\) varying from 0 to 8, reports the fitted productivity equation \(\hat m(x)=42+3.6x-0.30x^2\), where productivity is measured in units per shift. Assume the observed values of training hours are sufficiently varied for the intercept, \(x\), and \(x^2\) columns to have full rank.

Constructing the regression. The regression uses \(1\), \(x\), and \(x^2\) as its three columns. For an employee with \(x=2\) hours, the fitted productivity is

$$ \hat m(2)=42+3.6(2)-0.30(2^2)=42+7.2-1.2=48.0 $$

The units of this prediction are productivity units per shift. The fitted marginal change at \(x\) hours is

$$ \frac{d\hat m(x)}{dx}=3.6-0.60x. $$

At \(x=2\), this derivative is \(3.6-0.60(2)=2.4\) productivity units per shift per additional training hour. It is a local slope of the fitted curve, not a constant coefficient applying at every training level.

The curve turns where its derivative is zero: \(3.6-0.60x=0\), so \(x=6\). Since the coefficient on \(x^2\) is negative, this point is a maximum. The fitted value there is \(42+3.6(6)-0.30(36)=52.8\) units per shift. This interpretation is confined to the observed range; it does not justify extrapolating the curve beyond 0 to 8 hours.

For a cubic, the derivative can have up to two roots, so the fitted curve can change direction more than once. Its second derivative describes how the slope changes; a point where the second derivative changes sign is an inflection point.

Worked Example: Interpreting a Cubic Fit

In a hypothetical sample of 80 shops, let \(z\) be machine age measured relative to four years, so \(z=0\) means four years old. Suppose the reported fitted output per shift is \(\hat m(z)=100+8z-3z^2+0.5z^3\), with observed \(z\) values spanning \([-2,2]\). Assume the columns \(1,z,z^2,z^3\) have full rank in this sample.

The fitted values at the ends of the observed range are

$$ \hat m(-2)=100-16-12-4=68,\qquad \hat m(2)=100+16-12+4=108. $$

The fitted slope is \(8-6z+1.5z^2\). Its minimum occurs at \(z=2\), because the derivative of the slope is \(-6+3z\), which is zero there and the coefficient on \(z^2\) in the slope is positive. The minimum slope is \(8-12+6=2\), so the fitted curve is increasing throughout the observed range. Its curvature is described by the second derivative, \(-6+3z\), which is negative below \(z=2\) and positive above \(z=2\). Thus its curvature changes at the edge of the observed range, not within it. A cubic allows this change in curvature, but does not require an observed interior turning point.

Omitted Curvature Changes a Linear Projection

A linear fit to a curved conditional mean is not generally the same line one would obtain by retaining the linear part of the underlying equation. OLS chooses the line that minimizes squared approximation error over the regressor values represented in the population or sample. Consequently, the linear coefficient can absorb some of the omitted curvature.

To see this precisely, suppose the population relationship is \(Y=a+bX+cX^2+u\), where \(E[u\mid X]=0\), \(0<\operatorname{Var}(X)<\infty\), and the moments needed below exist. Fit a population linear projection with an intercept, \(Y=\gamma_0+\gamma_1X+e\). The normal equations imply that the projection slope is \(\operatorname{Cov}(X,Y)/\operatorname{Var}(X)\). Conditional mean zero gives \(\operatorname{Cov}(X,u)=0\), so direct substitution yields:

$$ \gamma_1 =\frac{\operatorname{Cov}(X,Y)}{\operatorname{Var}(X)} =b+c\frac{\operatorname{Cov}(X,X^2)}{\operatorname{Var}(X)}. $$

The intercept is \(\gamma_0=E[Y]-\gamma_1E[X]\). Unless \(c=0\) or \(\operatorname{Cov}(X,X^2)=0\), the linear projection slope differs from \(b\). The residual from the linear projection includes a systematic approximation component, even though the disturbance \(u\) has conditional mean zero. This is functional-form error: the chosen regression basis does not represent the conditional mean exactly.

Worked Example: A Linear Fit to a Quadratic Mean

Consider a hypothetical population in which \(X\) takes values 0, 1, and 2 with probability \(1/3\) each, and the outcome is exactly \(Y=1+2X+0.5X^2\). This is a simple population with no random disturbance; the quadratic equation is the conditional mean. Each value of \(X\) has positive probability, so the linear and quadratic projections are well-defined.

The moments are \(E[X]=1\), \(E[X^2]=5/3\), and \(E[X^3]=3\). Therefore,

$$ \operatorname{Var}(X)=\frac{5}{3}-1^2=\frac{2}{3},\qquad \operatorname{Cov}(X,X^2)=3-(1)\left(\frac{5}{3}\right)=\frac{4}{3}. $$

Applying the projection formula with \(b=2\) and \(c=0.5\), the slope of the best linear fit is

$$ \gamma_1=2+0.5\left(\frac{4/3}{2/3}\right)=2+1=3. $$

The mean of \(Y\) is \(1+2(1)+0.5(5/3)=23/6\). Thus the linear projection intercept is \(\gamma_0=23/6-3(1)=5/6\), and the fitted line is \(\hat Y=5/6+3X\). At \(X=0,1,2\), the true outcomes are \(1,3.5,7\), while the fitted values are \(5/6,23/6,41/6\). The residuals are \(1/6,-1/3,1/6\); their sum and their \(X\)-weighted sum are both zero, as required by the intercept and slope normal equations.

A quadratic regression with columns \(1,X,X^2\) recovers the exact equation in this example. The linear regression instead chooses a slope of 3, not 2, because its slope balances the squared errors across the population’s values of \(X\). In another population distribution, the projection slope could differ: the ratio involving \(\operatorname{Cov}(X,X^2)\) and \(\operatorname{Var}(X)\) depends on that distribution.

Polynomial Degree, Approximation, and Interpretation

Adding powers expands the set of curves available to the regression. A linear model can fit a straight line, a quadratic can represent one bend, and a cubic can represent changing curvature. If the higher-degree regression contains all the lower-degree regressors and its design matrix has full rank, its least-squares objective cannot be worse in the sample: it can always reproduce the lower-degree fit by setting the added coefficients to zero. This fact alone does not establish that the higher-degree curve better represents the population relationship.

For an approximate polynomial, the population projection minimizes average squared error over the distribution of \(X\). Values of \(X\) that occur more often therefore have more influence on the fitted coefficients. Even when the same underlying function is being approximated, changing the distribution of \(X\) can change the projection coefficients. This is why coefficients from different samples or populations need not have a simple structural interpretation when the polynomial is only an approximation.

The coefficient on \(x\) in a quadratic or cubic is the fitted slope at \(x=0\), not a universal marginal effect. For a quadratic, \(\hat\beta_1+2\hat\beta_2x\) is the fitted slope at \(x\); for a cubic, it is \(\hat\beta_1+2\hat\beta_2x+3\hat\beta_3x^2\). If zero is outside the relevant range or has no useful meaning, focus on fitted values and slopes at relevant observed values instead.

Key takeaway: Polynomial regressions are linear in their estimated coefficients but allow the fitted relationship to curve with the regressor. If curvature is omitted, OLS still produces a well-defined projection, but its coefficients and residual pattern reflect the best fit under the chosen regressor distribution and model form.

Common Mistakes

  • Reading a polynomial coefficient as a constant slope. The coefficient on \(x\) is not the slope everywhere once powers of \(x\) are included. Differentiate the fitted polynomial to obtain its slope at a specified \(x\).
  • Assuming a linear fit recovers the linear term of a curved relationship. The projection example shows that omitted curvature can change the slope as well as the intercept. The fitted coefficient is determined by the projection, not by selecting one term from the underlying equation.
  • Calling a polynomial regression nonlinear in its parameters. Powers such as \(x^2\) and \(x^3\) are transformed regressors; the unknown coefficients still enter linearly and can be estimated by OLS.
  • Extrapolating a fitted polynomial without caution. A polynomial’s behavior outside the observed range may be very different from its behavior where data were observed. Shape interpretations should be tied to that range.

Check Your Understanding

Use the definitions and projection argument in this tutorial to answer the following questions.

  1. For \(\hat m(x)=10+4x-0.5x^2\), what is the fitted slope at \(x=3\), and where is the quadratic’s turning point?
  2. Why is a regression using \(1,x,x^2,x^3\) linear in its coefficients even though its fitted relationship can curve?
  3. In the omitted-curvature example, which feature of the distribution of \(X\) determines whether the quadratic term changes the linear projection slope?
  4. What is the difference between a disturbance with conditional mean zero and the systematic approximation error from fitting a linear projection to a quadratic conditional mean?
  5. Why should the shape of a fitted cubic be interpreted cautiously outside the observed range of its regressor?
Clinical Biostats