Tutorials › Statistical Learning (Graduate) › Regression Series Estimators and Basis Coefficients

Series and Wavelet Estimation · Tutorial 442 of 989

Regression Series Estimators and Basis Coefficients

Learn how basis functions define a finite-dimensional regression fit and how its empirical coefficients differ from population projection coefficients.

Advanced 12 min read

What You'll Learn

  • Express a finite-dimensional series fit using a vector of basis functions and a coefficient vector.
  • Derive the least-squares normal equations and identify when their solution is unique.
  • Calculate fitted functions and coefficients for a fixed design.
  • Define population projection coefficients using the distribution of the covariates.
  • Explain why random-design empirical coefficients generally differ from their population counterparts.

Finite-Dimensional Regression by Basis Expansion

A regression function can be approximated using a finite collection of known functions, even when it is not assumed to belong to a simple parametric family. The central calculation is least squares: choose the coefficients that make the resulting linear combination of basis functions fit the observed responses as closely as possible. It is important to distinguish this sample calculation from the population approximation defined using the distribution of the covariates.

Definition: Let \(\phi_1,\ldots,\phi_K\) be specified real-valued functions on a covariate domain. Write \(\phi(x)=(\phi_1(x),\ldots,\phi_K(x))^\mathsf{T}\). A finite-dimensional series function has the form \(g_\beta(x)=\phi(x)^\mathsf{T}\beta=\sum_{j=1}^K\phi_j(x)\beta_j\), where \(\beta\in\mathbb{R}^K\). The functions \(\phi_j\) are the basis functions, and \(\beta_j\) are their coefficients.

The word “series” here refers to a finite sum. The basis could consist of powers of \(x\), trigonometric functions, spline functions, or other specified functions. The choice of basis determines the set of functions available to the fit; the least-squares calculation chooses a member of that set. The coefficients depend on the particular basis representation, so it is the fitted function—not an isolated coefficient—that describes the resulting regression estimate.

Empirical Least Squares for a Fixed Design

First suppose the covariates \(x_1,\ldots,x_n\) are fixed and the observed responses are \(y_1,\ldots,y_n\). Define the \(n\)-by-\(K\) design matrix \(B\) to have row \(i\) equal to \(\phi(x_i)^\mathsf{T}\), and let \(y=(y_1,\ldots,y_n)^\mathsf{T}\). Least squares minimizes the empirical sum of squared residuals.

$$ Q_n(\beta)=\sum_{i=1}^n\{y_i-\phi(x_i)^\mathsf{T}\beta\}^2 =(y-B\beta)^\mathsf{T}(y-B\beta). $$
Definition: Any minimizer \(\hat\beta\) of \(Q_n(\beta)\) is an empirical least-squares coefficient vector. Its fitted function is \(\hat g(x)=\phi(x)^\mathsf{T}\hat\beta\), and its fitted value at design point \(x_i\) is \(\hat g(x_i)\).

When the columns of \(B\) are linearly independent, \(B^\mathsf{T}B\) is invertible and the coefficient vector is unique. The next result derives its formula rather than assuming it.

Theorem: If \(B\) has full column rank, the unique minimizer of \(Q_n\) is
$$ \hat\beta=(B^\mathsf{T}B)^{-1}B^\mathsf{T}y. $$

Proof. For any vector \(h\in\mathbb{R}^K\), expand the objective along the line \(\beta+th\):

$$ Q_n(\beta+th) =Q_n(\beta)-2t h^\mathsf{T}B^\mathsf{T}(y-B\beta) +t^2h^\mathsf{T}B^\mathsf{T}Bh. $$

At a minimizer, the coefficient of \(t\) must be zero for every direction \(h\); otherwise a sufficiently small \(t\) of the appropriate sign would reduce the objective. Thus \(B^\mathsf{T}(y-B\hat\beta)=0\), or \(B^\mathsf{T}B\hat\beta=B^\mathsf{T}y\). Full column rank makes \(B^\mathsf{T}B\) positive definite: for nonzero \(h\), \(h^\mathsf{T}B^\mathsf{T}Bh=\|Bh\|^2>0\). The normal equations therefore have the displayed unique solution. Substituting that solution into the expansion shows that for every nonzero \(h\), \(Q_n(\hat\beta+h)=Q_n(\hat\beta)+\|Bh\|^2>Q_n(\hat\beta)\). Hence it is the unique minimizer. \(\square\)

Worked Example: A Linear Basis on a Fixed Design

Take \(n=3\), design points \(x_1=0,x_2=1,x_3=2\), responses \(y=(1,2,2)^\mathsf{T}\), and basis functions \(\phi_1(x)=1\), \(\phi_2(x)=x\). The design matrix and the two quantities in the normal equations are

$$ B=\begin{pmatrix}1&0\\1&1\\1&2\end{pmatrix},\qquad B^\mathsf{T}B=\begin{pmatrix}3&3\\3&5\end{pmatrix},\qquad B^\mathsf{T}y=\begin{pmatrix}5\\6\end{pmatrix}. $$

The determinant of \(B^\mathsf{T}B\) is \(3(5)-3(3)=6\), so it is invertible. Its inverse and the coefficient estimate are

$$ (B^\mathsf{T}B)^{-1} =\frac{1}{6}\begin{pmatrix}5&-3\\-3&3\end{pmatrix}, \qquad \hat\beta =\frac{1}{6}\begin{pmatrix}5&-3\\-3&3\end{pmatrix} \begin{pmatrix}5\\6\end{pmatrix} =\begin{pmatrix}7/6\\1/2\end{pmatrix}. $$

Thus \(\hat g(x)=7/6+x/2\). At the three design points, the fitted values are \(7/6,5/3,13/6\), and the residuals are \(-1/6,1/3,-1/6\). Their sum is zero, and their design-point-weighted sum is \(0( -1/6)+1(1/3)+2(-1/6)=0\), as required by the two normal equations.

If \(B\) is rank deficient, the inverse formula is not available and the coefficient vector need not be unique. In that case, different coefficient vectors can represent the same fitted values on the observed design. Full column rank is therefore a condition for unique empirical coefficients, not a requirement that one can omit when using the displayed inverse formula.

Population Projection Coefficients

For random covariates, there is also a population target: the best approximation to the regression function using the chosen basis, where “best” is measured on average over the covariate distribution. Let \(X\) be a random covariate and let \(m(x)=E[Y\mid X=x]\) be a version of the regression function. Assume \(E[m(X)^2]<\infty\) and \(E[\phi_j(X)^2]<\infty\) for every \(j\). Define the population criterion

$$ Q(\beta)=E\!\left[\{m(X)-\phi(X)^\mathsf{T}\beta\}^2\right]. $$
Definition: A minimizer \(\beta^*\) of \(Q(\beta)\) is a population projection coefficient vector for \(m\) onto the chosen finite-dimensional basis. The associated population fitted function is \(g^*(x)=\phi(x)^\mathsf{T}\beta^*\). Define \(G=E[\phi(X)\phi(X)^\mathsf{T}]\) and \(q=E[\phi(X)m(X)]\). If \(G\) is positive definite, then \(\beta^*\) is unique and satisfies \(G\beta^*=q\).

Positive definiteness of \(G\) means that no nonzero linear combination of the basis functions is zero with probability one under the distribution of \(X\). The population coefficient equations follow from minimization of the expected squared approximation error.

Result: Under the stated moment conditions, if \(G\) is positive definite, then
$$ \beta^*=G^{-1}q = \{E[\phi(X)\phi(X)^\mathsf{T}]\}^{-1}E[\phi(X)m(X)]. $$

Derivation. For any \(h\in\mathbb{R}^K\), expansion gives

$$ Q(\beta+h)=Q(\beta)-2h^\mathsf{T}\{q-G\beta\}+h^\mathsf{T}Gh. $$

The expectations exist by the assumed second moments and the Cauchy–Schwarz inequality. At a minimizer, the linear term must vanish in every direction, so \(G\beta^*=q\). Since \(G\) is positive definite, the solution is unique. Conversely, for this solution the expansion reduces to \(Q(\beta^*+h)=Q(\beta^*)+h^\mathsf{T}Gh\), which is strictly larger for every nonzero \(h\). This proves both minimization and uniqueness. \(\square\)

If \(E[Y^2]<\infty\), the same coefficient vector also minimizes \(E[\{Y-\phi(X)^\mathsf{T}\beta\}^2]\). Indeed, its directional equations use \(E[\phi(X)Y]\), and the defining property of conditional expectation gives \(E[\phi(X)Y]=E[\phi(X)m(X)]\). The empirical and population equations look similar, but they use different quantities: the former uses sums over the observed sample, while the latter uses expectations under the distribution of \(X\).

Worked Example: Population Linear Approximation to a Quadratic Function

Let \(X\) be uniform on \([0,1]\), let \(m(x)=x^2\), and use the basis \(\phi(x)=(1,x)^\mathsf{T}\). The entries of \(G\) and \(q\) are ordinary integrals:

$$ G=\begin{pmatrix} E[1]&E[X]\\E[X]&E[X^2] \end{pmatrix} =\begin{pmatrix}1&1/2\\1/2&1/3\end{pmatrix}, \qquad q=\begin{pmatrix}E[X^2]\\E[X^3]\end{pmatrix} =\begin{pmatrix}1/3\\1/4\end{pmatrix}. $$

The determinant of \(G\) is \(1/3-1/4=1/12>0\), and

$$ G^{-1}=\begin{pmatrix}4&-6\\-6&12\end{pmatrix}, \qquad \beta^*=G^{-1}q =\begin{pmatrix}4/3-6/4\\-6/3+12/4\end{pmatrix} =\begin{pmatrix}-1/6\\1\end{pmatrix}. $$

The population fitted function is therefore \(g^*(x)=-1/6+x\). It is the best linear approximation under the uniform distribution on \([0,1]\); it is not the original regression function \(x^2\). The coefficients describe the approximation within the chosen basis.

Random-Design Empirical Coefficients

With random design, the observed covariates \(X_1,\ldots,X_n\) generate a random design matrix \(B\), whose \(i\)th row is \(\phi(X_i)^\mathsf{T}\). Conditional on the observed covariates, the empirical least-squares calculation is exactly the fixed-design calculation. When the realized matrix has full column rank,

$$ \hat\beta=(B^\mathsf{T}B)^{-1}B^\mathsf{T}Y =\left\{\frac{1}{n}\sum_{i=1}^n\phi(X_i)\phi(X_i)^\mathsf{T}\right\}^{-1} \left\{\frac{1}{n}\sum_{i=1}^n\phi(X_i)Y_i\right\}. $$

This random vector is the empirical coefficient estimate. Its matrix and vector are sample averages, not population expectations. Even when the population coefficient vector is well-defined, a finite sample generally produces different coefficients. Sample rank also matters: a population matrix \(G\) can be positive definite while a particular realized sample matrix is singular.

Worked Example: A Random Sample Need Not Equal the Population Coefficients

Suppose \(X_i\) are independent and uniform on \(\{0,1,2\}\), and use the linear basis \((1,x)^\mathsf{T}\). Let \(m(x)=1+x/2\). Define errors that are zero when \(X_i=0\) or \(2\), and are equally likely to be \(1/2\) or \(-1/2\) when \(X_i=1\). Then \(E[\varepsilon_i\mid X_i]=0\), so the population regression function is \(m\), and its population basis coefficients are \((1,1/2)^\mathsf{T}\).

One possible observed sample has covariates \((0,1,2)\) and errors \((0,1/2,0)\). It has responses \(Y=(1,2,2)^\mathsf{T}\). This realization has positive probability: the specified covariate order has probability \(1/27\), and the positive error at \(X=1\) has probability \(1/2\). The empirical normal equations are

$$ \begin{pmatrix}3&3\\3&5\end{pmatrix}\hat\beta =\begin{pmatrix}5\\6\end{pmatrix}, \qquad \hat\beta=\begin{pmatrix}7/6\\1/2\end{pmatrix}. $$

Thus the realized empirical fitted function is \(7/6+x/2\), whereas the population fitted function is \(1+x/2\). The slope happens to agree, but the intercept differs by \(1/6\). This is a direct example of the distinction between sample averages in the empirical equations and expectations in the population equations.

Why the Distinction Matters

A basis expansion specifies the shape of the candidate functions, while the coefficient calculation specifies how the data or population distribution selects among them. Keeping those roles separate helps interpret results correctly: a coefficient is tied to a particular basis, and an empirical estimate is tied to a particular sample. In random-design analysis, the population coefficients describe the target approximation, whereas the empirical coefficients are the quantities calculated from observed data.

Common mistake: Replacing the sample averages in the empirical normal equations with population expectations and then treating the resulting coefficients as the least-squares fit to the observed data. Those are not the same calculation. The correction is to identify the target first: use \(B^\mathsf{T}B\) and \(B^\mathsf{T}Y\) for the realized sample, and \(E[\phi(X)\phi(X)^\mathsf{T}]\) and \(E[\phi(X)m(X)]\) for the population approximation. Equality may occur in a particular sample or special model, but it is not guaranteed by the definitions.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. For a fixed design, what rank condition makes the least-squares coefficient vector unique?
  2. Write the empirical normal equations using the design matrix \(B\) and response vector \(y\).
  3. In the population definition, what does positive definiteness of \(G\) rule out?
  4. Why can empirical coefficients differ from population projection coefficients even when the regression function is exactly in the span of the basis?
  5. For the uniform-\([0,1]\) example, which distribution determines the meaning of “best” linear approximation?
Clinical Biostats