Tutorials › Statistical Learning (Graduate) › Polynomial Regression Degree Selection

Sieve and Structural Risk Minimization · Tutorial 239 of 989

Polynomial Regression Degree Selection

Learn how polynomial degree controls approximation and estimation risk, and how an SRM penalty balances them to choose a degree.

Intermediate 10 min read

What You'll Learn

  • Define nested degree-\(d\) polynomial regression models and their dimension.
  • Decompose expected prediction error into approximation and estimation terms.
  • Calculate a penalized degree choice from explicit approximation errors.
  • Derive the degree and risk scales under polynomial approximation bounds.
  • Distinguish an oracle risk calculation from selection using empirical risk.
  • Identify why positive noise variance and eligible degrees matter to rate claims.

Why Polynomial Degree Is a Model-Selection Problem

A polynomial regression fit can represent increasingly complicated patterns as its degree rises. A low degree may miss important curvature; a high degree estimates more coefficients from the same data. Degree selection is therefore a concrete instance of structural risk minimization (SRM): compare nested models by balancing fit against complexity.

The central calculation has two parts. The approximation term measures what is lost by restricting the regression function to polynomials of a given degree. The estimation term measures the cost of estimating the coefficients from a finite sample. Under squared-error loss and a fixed design, the expected prediction error separates exactly into these terms. An SRM penalty then favors degrees that balance them rather than selecting the model with the smallest training error.

Nested Polynomial Models and Their Risk

Suppose the observed responses satisfy \(Y_i=f_i+\varepsilon_i\), for fixed inputs \(x_1,\ldots,x_n\), where \(f_i=f(x_i)\). Assume the errors are independent, have mean zero, and have common variance \(\sigma^2\). For degree \(d\), let \(\mathcal P_d\) be the space of vectors obtained by evaluating polynomials of degree at most \(d\) at the observed inputs. Write \(k=d+1\) for its dimension, and restrict attention to degrees for which the polynomial design matrix has full column rank. In particular, \(k\le n\) is necessary when the inputs are distinct.

Let \(P_k\) be the orthogonal projection onto \(\mathcal P_{k-1}\), using the ordinary Euclidean inner product on the \(n\) observed responses. The least-squares fitted vector is \(P_kY\). Define empirical squared prediction error relative to the regression signal by \(n^{-1}\|P_kY-f\|^2\), where \(\|v\|^2=\sum_{i=1}^n v_i^2\).

Definition: The degree-\((k-1)\) approximation error is \(A_k=n^{-1}\|(I-P_k)f\|^2\). It is the smallest empirical squared error achievable by any polynomial of degree at most \(k-1\). The expected prediction risk of the least-squares fit is \(R_k=E[n^{-1}\|P_kY-f\|^2]\).

The next identity is exact under the stated fixed-design assumptions; it is not an asymptotic approximation.

Theorem: If the errors are independent with mean zero and variance \(\sigma^2\), and the degree-\((k-1)\) design matrix has rank \(k\), then \(R_k=A_k+\sigma^2k/n\).

Proof. Since \(Y=f+\varepsilon\), \(P_kY-f=-(I-P_k)f+P_k\varepsilon\). The first vector is fixed, while \(E[P_k\varepsilon]=0\), so the expectation of their cross-product is zero. Also, \(P_k\) is a symmetric idempotent matrix of rank \(k\), and the error covariance matrix is \(\sigma^2 I\). Thus \(E[\|P_k\varepsilon\|^2]=\operatorname{tr}(P_k\sigma^2I)=\sigma^2\operatorname{tr}(P_k)=\sigma^2k\). Expanding the squared norm and dividing by \(n\) gives \(R_k=n^{-1}\|(I-P_k)f\|^2+\sigma^2k/n=A_k+\sigma^2k/n\). \(\square\)

This identity explains why dimension matters: each additional polynomial coefficient adds \(\sigma^2/n\) to expected prediction error in this setting. It also clarifies what is being selected. The best degree for expected prediction error minimizes \(A_k+\sigma^2k/n\), whereas an SRM procedure typically minimizes an empirical fit criterion plus a complexity penalty.

Worked Example: Comparing Five Candidate Degrees

Suppose \(n=100\), \(\sigma^2=4\), and the approximation errors for five eligible polynomial models, with \(k=1,\ldots,5\), are \(1,\ 0.36,\ 0.16,\ 0.09,\ 0.08\). These values decrease as the nested spaces expand. Compute each expected risk.

The estimation term is \(\sigma^2k/n=4k/100=0.04k\). Therefore the risks are \(1+0.04=1.04\) for \(k=1\); \(0.36+0.08=0.44\) for \(k=2\); \(0.16+0.12=0.28\) for \(k=3\); \(0.09+0.16=0.25\) for \(k=4\); and \(0.08+0.20=0.28\) for \(k=5\).

The smallest expected risk is \(0.25\), at \(k=4\), corresponding to degree \(d=3\). Moving from \(k=4\) to \(k=5\) reduces approximation error by only \(0.01\) but increases estimation error by \(0.04\). The degree-4 model fits the signal slightly better, but its total expected risk is larger.

SRM Penalties for Degree Selection

In practice, the approximation errors \(A_k\) are unknown, so minimizing the exact expected risk is not directly available. One instead computes an empirical loss and adds a penalty that increases with model dimension. For squared-error regression, a basic dimension-scaled form is \( \widehat R_k+\lambda k/n\), where \(\widehat R_k=n^{-1}\|Y-P_kY\|^2\) is the training mean squared error and \(\lambda>0\) is a calibration constant. The selected dimension minimizes this penalized criterion over the eligible degrees. The penalty’s role is to keep the training fit from rewarding every additional coefficient automatically.

The exact risk identity above does not by itself prove that a particular empirical penalty yields an oracle guarantee. That requires a suitable calibration and control of empirical deviations, as in the earlier material on penalized selection. Here the focus is the degree-specific approximation-estimation balance and how its scale can guide a dimension penalty.

Worked Example: Selecting a Degree From a Penalized Training Error

Consider three nested candidate models of dimensions \(k=1,2,3\), with \(n=20\). Suppose the response vector has squared projection lengths \(4,1,9\) along the three successive orthonormal polynomial directions, and squared residual length \(10\) orthogonal to all three. These quantities are consistent with nested least-squares fits: adding a direction removes its squared projection length from the residual sum of squares.

For \(k=1\), the residual sum of squares is \(1+9+10=20\), so \(\widehat R_1=20/20=1\). For \(k=2\), it is \(9+10=19\), so \(\widehat R_2=19/20=0.95\). For \(k=3\), it is \(10\), so \(\widehat R_3=10/20=0.5\).

Use the explicit SRM penalty \(2k/n\), corresponding here to \(\lambda=2\). The three penalized criteria are \(1+2(1)/20=1.10\), \(0.95+2(2)/20=1.15\), and \(0.50+2(3)/20=0.80\). Thus the selected dimension is \(k=3\), or degree \(d=2\). Although the penalty makes \(k=2\) worse than \(k=1\), the large reduction in training error upon adding the third direction more than offsets its incremental penalty. This is a calculation for the stated penalty and data; it does not assert that \(2k/n\) is universally calibrated.

Balancing Approximation and Estimation

A common smoothness model for polynomial approximation is that, over the eligible degrees relevant to the comparison, the approximation error decreases at a power rate. Write \(s>0\) for the smoothness exponent and suppose \(A_k\) is bounded above and below by positive constant multiples of \(k^{-2s}\). The exponent expresses how quickly richer polynomial spaces approximate the regression signal. For the rate argument, it is important to specify both a positive noise level and a degree range that actually contains the balancing scale.

Assumption for the rate calculation: The noise variance \(\sigma^2\) is fixed and strictly positive. Define \(k_*=(n/\sigma^2)^{1/(2s+1)}\). Eligible dimensions include an integer within a fixed multiplicative factor of \(k_*\). For dimensions \(k\) up to \(k_*\), assume \(c k^{-2s}\le A_k\le C k^{-2s}\) for constants \(0<c\le C<\infty\) that do not depend on \(n\). No approximation lower bound is needed for dimensions above \(k_*\).

The upper approximation bound at a dimension near \(k_*\) gives a candidate risk of the order \(k_*^{-2s}+\sigma^2 k_*/n\). These terms have the same scale: from \(k_*^{2s+1}=n/\sigma^2\), \(k_*^{-2s}=(\sigma^2/n)^{2s/(2s+1)}\) and \(\sigma^2 k_*/n=(\sigma^2/n)^{2s/(2s+1)}\). The resulting rate is therefore \((\sigma^2/n)^{2s/(2s+1)}\), which is of order \(n^{-2s/(2s+1)}\) when the positive variance is fixed.

Theorem: Under the rate-calculation assumption above, any minimizer \(\hat k\) of \(A_k+\sigma^2k/n\) over the eligible dimensions has \(\hat k\) of order \(k_*\), and its minimum risk is of order \((\sigma^2/n)^{2s/(2s+1)}\). The constants in these order statements may depend on \(c,C,s,\sigma^2\), and the fixed-factor availability of eligible dimensions.

Proof. Choose an eligible dimension \(k_0\) within a fixed multiplicative factor of \(k_*\). Its approximation error is bounded above by a constant times \(k_*^{-2s}\), and its estimation term is bounded above by a constant times \(\sigma^2k_*/n\). The equal-scale identities above imply that its criterion is at most \(B r_*\), where \(B\) is fixed and \(r_*=(\sigma^2/n)^{2s/(2s+1)}\). Since \(\hat k\) minimizes the criterion, its criterion is also at most \(B r_*\).

For any eligible \(k\le k_*\), the lower approximation bound gives \(A_k\ge c k^{-2s}\). If \(k\le a k_*\), then \(A_k\ge c a^{-2s}k_*^{-2s}=c a^{-2s}r_*\). Choose \(a>0\) small enough that \(c a^{-2s}>B\). Such a \(k\) cannot minimize, because its criterion would exceed \(B r_*\). For any \(k\ge b k_*\), the estimation term alone is at least \(\sigma^2 b k_*/n=b r_*\). Choose \(b>B\); again, such a \(k\) cannot minimize. Consequently every minimizer lies between fixed positive multiples of \(k_*\). The upper bound \(B r_*\) and the lower bound from either the approximation term at smaller dimensions or the estimation term at larger dimensions establish the stated minimum-risk order. \(\square\)

Worked Example: A Smoothness-Dependent Degree Scale

Suppose the approximation error is exactly \(A_k=4/k^2\), the noise variance is \(\sigma^2=1\), and \(n=1000\). Here \(s=1\), so the rate scale is \(k_*=n^{1/3}=10\). The constant \(4\) shifts the finite-sample optimum, so compute the criterion directly: \(Q(k)=4/k^2+k/1000\).

At \(k=19\), \(Q(19)=4/361+0.019\approx0.0300803\). At \(k=20\), \(Q(20)=4/400+0.020=0.0300000\). At \(k=21\), \(Q(21)=4/441+0.021\approx0.0300703\).

To check that \(k=20\) is the discrete minimum, calculate \(Q(k+1)-Q(k)=0.001-4(2k+1)/(k^2(k+1)^2)\). The fraction \(4(2k+1)/(k^2(k+1)^2)\) decreases with \(k\): its numerator grows linearly while its denominator grows quartically. At \(k=19\), the difference is approximately \(-0.0000803\); at \(k=20\), it is approximately \(0.0000703\). Thus the criterion decreases through \(k=20\) and increases afterward, so \(k=20\), degree \(19\), is the discrete minimizer. Its risk is \(0.03\), consistent with the rate \(n^{-2/3}=0.01\) up to a constant factor.

Why the Positive-Variance Condition Matters

The rate conclusion depends on \(\sigma^2>0\), not merely on the algebraic appearance of a dimension term. If \(\sigma^2=0\), the expected risk criterion reduces to \(A_k\). Under the example sequence \(A_k=k^{-2s}\) and eligible dimensions \(1\le k\le n\), its minimum occurs at \(k=n\), not at order \(n^{1/(2s+1)}\). Its risk is \(n^{-2s}\), not \(n^{-2s/(2s+1)}\). Thus the positive-noise balancing argument cannot be applied at zero variance.

The eligible-degree condition matters as well. A balancing scale is only operational if the candidate collection contains dimensions near it, and the approximation bounds used in the comparison must hold over the relevant range. In fixed-design regression, one must also preserve full column rank; a degree with more coefficients than observations cannot be treated as an ordinary uniquely identified least-squares model.

Common Mistake

  • Claiming the balancing degree without checking the noise level. The incorrect reasoning is that \(A_k\asymp k^{-2s}\) always balances with a dimension term and therefore the optimum must be \(n^{1/(2s+1)}\). That conclusion silently assumes a strictly positive variance multiplying \(k/n\). If \(\sigma^2=0\), there is no estimation term to balance against approximation error. Require fixed \(\sigma^2>0\), and verify that eligible degrees include the comparison scale.
  • Calling the training-error minimizer the expected-risk minimizer. Training error is nonincreasing along nested least-squares models, while expected prediction risk includes an estimation cost. Penalization is introduced precisely to address that distinction.
  • Reading the rate as an exact finite-sample degree. The scale \(k_*\) is an order statement. Constants in the approximation bounds, the noise variance, integer rounding, and the available degree range affect the actual minimizing degree.
Key takeaway: For nested polynomial regression with fixed positive noise variance, expected prediction risk is approximation error plus \(\sigma^2k/n\). When approximation decreases as \(k^{-2s}\) and the eligible models contain the balancing scale, the risk-minimizing dimension is of order \(n^{1/(2s+1)}\), and the corresponding risk is of order \(n^{-2s/(2s+1)}\).

Check Your Understanding

Use the definitions and assumptions above to answer the following questions.

  1. For a degree-\(d\) polynomial model, what is its dimension \(k\), and what does the term \(\sigma^2k/n\) represent?
  2. Why does the exact expected-risk decomposition have no cross term between approximation error and projected noise?
  3. If \(A_k\asymp k^{-2s}\) and \(\sigma^2>0\) is fixed, what are the balancing dimension and risk scales?
  4. What fails in the balancing argument when \(\sigma^2=0\)?
  5. Why does the exact risk decomposition alone not establish that every empirical SRM penalty has an oracle guarantee?
Clinical Biostats