Why Use Orthogonal Polynomial Terms?
A curved relationship between a response and a numerical predictor can be represented by adding powers of that predictor to a regression model. For example, a quadratic model uses a constant, a linear term, and a squared term. But these columns of the design matrix can be strongly correlated. When they are, it can be difficult to distinguish how the terms contribute to the fitted curve, and coefficient estimates can be sensitive to the data.
Orthogonal polynomials provide a different set of columns spanning the same polynomial model. Their values are constructed to have zero cross-products in the observed data. This changes the coefficient coordinates, not the set of curves the model can fit. For interpretation or prediction, it is therefore essential to know how to move between the orthogonal basis and ordinary powers of the original predictor.
Here, “orthogonal” refers to the observed design: the vectors of term values across the \(n\) observations. It does not mean that the predictor itself has been transformed into a random variable independent of its square. Unless stated otherwise, the construction below is for ordinary least squares with equal weight on each observation. Weighted least squares instead requires orthogonality under the corresponding weighted inner product.
Raw Powers and a Quadratic Orthogonal Basis
For a quadratic curve, the raw-power model is \(y_i=\beta_0+\beta_1x_i+\beta_2x_i^2+\varepsilon_i\). If the predictor values are unevenly distributed, the columns for \(x\) and \(x^2\) may be highly correlated. One way to create an orthogonal quadratic column is to regress the column of squared values on the constant and linear columns, then use the residuals as the quadratic column. By construction, those residuals have zero inner product with both columns.
The next example carries out this construction. Its small design also makes the dependence between the raw powers directly visible.
Worked Example: Orthogonalizing a Raw Quadratic Term
Suppose four observations have predictor values \(x=0,1,2,3\). Construct a quadratic term orthogonal to the intercept and linear predictor, and compare the raw-power correlation with the resulting basis.
Step 1: Center the linear column. The mean predictor value is \(\bar{x}=(0+1+2+3)/4=1.5\), so define \(u=x-1.5\). Across the observations, \(u=(-1.5,-0.5,0.5,1.5)\), and \(\sum u_i=0\).
Step 2: Regress \(x^2\) on the constant and \(x\). The mean of \(x^2\) is \((0+1+4+9)/4=3.5\). The centered cross-product of \(x\) and \(x^2\) is \(0\cdot0+1\cdot1+2\cdot4+3\cdot9-(6)(14)/4=36-21=15\). The centered sum of squares of \(x\) is \(0^2+1^2+2^2+3^2-6^2/4=14-9=5\). Thus the fitted slope for regressing \(x^2\) on \(x\) with an intercept is \(15/5=3\), and the intercept is \(3.5-3(1.5)=-1\).
Step 3: Form the residual column. Define \(q=x^2-( -1+3x)=x^2-3x+1\). At the four observed predictor values, \(q=(1,-1,-1,1)\). Its inner product with the constant is \(1-1-1+1=0\). Its inner product with \(x\) is \(0(1)+1(-1)+2(-1)+3(1)=0\). Therefore it is also orthogonal to \(u=x-1.5\).
Step 4: Compare the raw powers. The centered cross-product of \(x\) and \(x^2\) is 15. Their centered sums of squares are 5 and \(49\), respectively; the latter is \(0^2+1^2+4^2+9^2-14^2/4=98-49=49\). Their sample correlation is therefore \(15/\sqrt{5\cdot49}=15/\sqrt{245}\), approximately \(0.9583\). The raw powers are strongly correlated, whereas the columns \(1,u,q\) have zero pairwise cross-products.
The orthogonal basis is thus the constant, the centered linear term, and the residualized quadratic term. The centering and residualization are determined by these observed predictor values; they are not universal constants for all data sets.
Why Orthogonality Reduces Coefficient Dependence
Consider a linear model written using \(p\) orthogonal design columns, collected in the matrix \(Z\): \(y=Z\gamma+\varepsilon\). Suppose the columns include the intercept, each has positive sum of squares, and the errors have mean zero and common variance \(\sigma^2\), with zero covariance between distinct errors. Ordinary least squares estimates \(\gamma\) by \((Z^\mathsf{T}Z)^{-1}Z^\mathsf{T}y\). Orthogonality makes the cross-products in \(Z^\mathsf{T}Z\) zero, so this calculation separates into one projection per column.
The result follows directly from the least-squares equations. Because each distinct pair of columns has zero inner product, the \(j\)th diagonal entry of \(Z^\mathsf{T}Z\) is \(z_j^\mathsf{T}z_j\), and every off-diagonal entry is zero. Its inverse is diagonal with entries \(1/(z_j^\mathsf{T}z_j)\). Multiplying that inverse by \(Z^\mathsf{T}y\) gives the projection formula above. The usual covariance formula for least squares is \(\sigma^2(Z^\mathsf{T}Z)^{-1}\), which is diagonal here. This is why orthogonal columns remove covariance between the coefficient estimates under the stated error assumptions.
Orthogonality does not guarantee small standard errors: a column with a small sum of squares can still have an imprecise coefficient. Nor does it remove dependence from the raw-power coefficient estimates after conversion back to raw powers. It simplifies coefficient estimation and covariance in the orthogonal coordinates.
Worked Example: Fitting and Recovering a Quadratic Curve
Use the predictor values \(x=0,1,2,3\) and their orthogonal basis \(1,u,q\), where \(u=x-1.5\) and \(q=x^2-3x+1\). Suppose the observed responses are \(y=(10,6,8,16)\). Fit the quadratic model, then predict at \(x=2.5\) using both representations.
Step 1: Estimate the intercept. The constant column is all ones, so its coefficient is the response mean: \(\hat{\gamma}_0=(10+6+8+16)/4=40/4=10\).
Step 2: Estimate the coefficient of \(u\). The cross-product is \(\sum u_i y_i=(-1.5)(10)+(-0.5)(6)+(0.5)(8)+(1.5)(16)=-15-3+4+24=10\). The sum of squares of \(u\) is \(2.25+0.25+0.25+2.25=5\). Therefore \(\hat{\gamma}_1=10/5=2\).
Step 3: Estimate the coefficient of \(q\). The cross-product is \(\sum q_i y_i=(1)(10)+(-1)(6)+(-1)(8)+(1)(16)=10-6-8+16=12\). The sum of squares of \(q\) is \(1+1+1+1=4\). Therefore \(\hat{\gamma}_2=12/4=3\).
The fitted curve in orthogonal coordinates is \(\hat{y}=10+2u+3q\). To recover its raw-power form, substitute \(u=x-1.5\) and \(q=x^2-3x+1\):
At \(x=2.5\), the orthogonal-basis values are \(u=2.5-1.5=1\) and \(q=(2.5)^2-3(2.5)+1=6.25-7.5+1=-0.25\). The prediction is \(10+2(1)+3(-0.25)=11.25\). In the raw form it is \(3(6.25)-7(2.5)+10=18.75-17.5+10=11.25\). The two calculations agree, checking the conversion and prediction.
Computing Fitted Values and Transforming Coefficients
For any observation, a fitted value can be calculated directly from the orthogonal-basis model by evaluating each basis function at that observation’s predictor value. To obtain raw-power coefficients, expand each basis polynomial and collect like powers. These are two coordinate descriptions of the same fitted polynomial when the bases span the same polynomial space.
Write down the centering and residualization rules, or the explicit polynomial basis functions supplied with the model. A coefficient alone is not interpretable without knowing which function it multiplies.
For orthogonal columns, project the response onto each column by dividing its cross-product with the response by its sum of squares.
Use the same centering and polynomial construction for new predictor values as was used to create the fitted model.
Substitute each basis polynomial and collect coefficients of \(1,x,x^2,\ldots\). Verify by evaluating both expressions at a predictor value.
Worked Example: A Noisy Quadratic Fit and Its Prediction
For \(x=0,1,2,3\), use \(u=x-1.5\) and \(q=x^2-3x+1\). The responses are \(y=(3,0,4,9)\). Fit the quadratic model in the orthogonal basis and predict at \(x=4\). The value \(x=4\) is outside the observed range, so the calculation is an extrapolation.
Step 1: Find the coefficients. The response mean is \((3+0+4+9)/4=4\), giving the intercept estimate \(\hat{\gamma}_0=4\). For the linear column, \(\sum u_i y_i=(-1.5)(3)+(-0.5)(0)+(0.5)(4)+(1.5)(9)=-4.5+0+2+13.5=11\), and \(\sum u_i^2=5\). Thus \(\hat{\gamma}_1=11/5=2.2\). For the quadratic column, \(\sum q_i y_i=(1)(3)+(-1)(0)+(-1)(4)+(1)(9)=8\), and \(\sum q_i^2=4\). Thus \(\hat{\gamma}_2=8/4=2\).
The fitted model is \(\hat{y}=4+2.2u+2q\). At \(x=4\), \(u=4-1.5=2.5\) and \(q=16-12+1=5\), so \(\hat{y}=4+2.2(2.5)+2(5)=4+5.5+10=19.5\).
Check by conversion. Substitution gives \(4+2.2(x-1.5)+2(x^2-3x+1)=2x^2-3.8x+2.7\). At \(x=4\), this is \(2(16)-3.8(4)+2.7=32-15.2+2.7=19.5\), matching the basis calculation. The prediction is a point on the fitted curve, not a guarantee that extrapolation is reliable.
Interpretation and Common Traps
An orthogonal polynomial coefficient describes the contribution of one constructed basis column while the other orthogonal columns are present. It is generally not the slope or curvature in the raw predictor scale. For example, in \(\hat{y}=\hat{\gamma}_0+\hat{\gamma}_1u+\hat{\gamma}_2q\), the coefficient \(\hat{\gamma}_1\) multiplies \(u\), not \(x\) alone; the raw linear coefficient also receives a contribution from the quadratic basis after expansion. The raw quadratic coefficient depends on the chosen scaling of the highest-degree basis term.
Orthogonalizing the columns leaves the model’s fitted values unchanged when the transformation is invertible and the original and transformed columns span the same space. It does not make a misspecified curve correct, establish a causal relationship, or eliminate uncertainty in predictions. The basis is also tied to its construction. If the predictor values change, an orthogonal basis built for the new data may have different coefficients and different polynomial expressions.
- Trap: assuming zero correlation means the predictor and its square are unrelated. The zero cross-products concern constructed columns on the observed design, not a general probabilistic independence claim.
- Trap: interpreting an orthogonal coefficient as a raw-power coefficient. Expand the basis to recover the coefficient of \(x\) or \(x^2\); do not simply relabel \(\hat{\gamma}_1\) as the linear slope.
- Trap: rebuilding the basis inconsistently for prediction. Use the exact basis definition from fitting. Applying a different centering or residualization changes the calculation.
- Trap: thinking orthogonality changes the fitted curve. With the same polynomial span and a full-rank change of basis, fitted values are unchanged; what changes are the coefficient coordinates and their covariance structure.
Check Your Understanding
For each problem, use ordinary least squares and show the basis calculations before checking the stated answer.
- For predictor values \(x=0,1,2,3\), center \(x\) at its sample mean and residualize \(x^2\) on the intercept and \(x\). Give the resulting quadratic term, its four values, and its inner products with the constant and \(x\) columns. (Answer: \(u=x-1.5\), \(q=x^2-3x+1\), \(q=(1,-1,-1,1)\), \(\sum q_i=0\), and \(\sum x_iq_i=0\).)
- On those same predictor values, fit the basis \(1,u,q\) to responses \(y=(5,4,8,7)\). State all three fitted coefficients and the raw-power fitted equation. (Answer: \((\hat{\gamma}_0,\hat{\gamma}_1,\hat{\gamma}_2)=(6,1,0)\), and \(\hat{y}=x+4.5\).)
- For \(x=0,1,2,3\), calculate the correlation between the centered raw columns \(x\) and \(x^2\), using centered sums of squares \(5\) and \(49\), and centered cross-product \(15\). (Answer: \(15/\sqrt{245}\approx0.9583\).)
- For \(x=0,1,2,3\), use \(u=x-1.5\), \(q=x^2-3x+1\), and responses \(y=(3,0,4,9)\). Find the three orthogonal-basis coefficients and predict at \(x=4\); verify by writing the raw-power equation. (Answer: coefficients \((4,2.2,2)\), prediction \(19.5\), raw equation \(\hat{y}=2x^2-3.8x+2.7\).)