Orthogonality and Least Squares/Applications to Linear Models

Lesson 6.5645 words

Applications to Linear Models

Curve fitting is a least-squares problem in statistical notation. The least-squares line, polynomial fits, and multiple regression all reduce to X beta = y with a design matrix X built from the data, solved by the same normal equations.

╌╌╌╌

Fitting a formula to data is the most common use of least squares. A relationship is posited, the data rarely fall exactly on any such line, and the parameters are chosen to make the fit as good as possible. Written in matrix form the problem is least squares with statistical notation: , where is the design matrix, the parameter vector, and the observation vector.

The least-squares line

Given data points , the line assigns to each a predicted value . The gap between the observed and the predicted value is the residual.

A least-squares line minimizes the total squared vertical residual; each residual is the gap between the observed data point and the point directly above or below it on the line.

If the points were exactly on the line, the parameters would satisfy equations , i.e. with

The squared distance is the sum of squared residuals, so the least-squares solves the normal equations .

A common preprocessing step subtracts the mean from every , forming . In this mean-deviation form the two columns of become orthogonal, is diagonal, and the normal equations decouple into two independent one-line solves.

The general linear model

Statisticians write the fit with an explicit residual vector, so

Any equation of this form is a linear model, and the least-squares fit minimizes . The word linear refers to the parameters , not the shape of the fitted curve. A model is linear as long as it has the form

for known functions . Changing the changes the columns of but leaves the normal equations unchanged.

Polynomial fits

If the data curve rather than run straight, fit a polynomial. For a parabola , each point contributes an equation , and the design matrix gains a squared column:

A cubic adds a fourth column of cubes. The columns are the sampled basis functions ; the model stays linear in because those functions are known once the are fixed.

The design matrix for a polynomial fit: each row samples the basis functions 1, x, x-squared at one data point, so column k holds the k-th power of every observation.

Multiple regression

With two predictors and and a response , a plane fits data . Each observation gives , and the model is with

The least-squares solution is the least-squares plane. Cross terms and higher powers keep the model linear: an equation like (a trend surface) is still linear in , with columns given by the sampled functions . Whatever the predictors, the fit obeys the same normal equations, and whenever is invertible,

A least-squares plane fits scattered points in space: the vertical residuals from each data point to the plane are minimized in the sum-of-squares sense.

Splitting the sum of squares

The projection geometry gives a bookkeeping identity used throughout regression. The residual vector is orthogonal to , and lies in it, so the Pythagorean theorem splits the total variation of :

The total sum of squares (SS(T)) divides into the part explained by the fit (SS(R), the regression sum of squares) and the part left over (SS(E), the error sum of squares). This is the orthogonal decomposition of into and its complement, read as squared lengths, and it underlies the analysis of variance.

The Pythagorean split of the observation vector: y decomposes into the fitted part in Col X and the residual orthogonal to it, so the total sum of squares equals the regression plus error sums of squares.

The design-matrix pattern

The examples differ only in how the columns of are formed. A line samples ; a parabola samples ; a plane samples . Once is built, the parameter vector solves the same normal equations, and linear algebra handles all of them at once.

ModelFitted formColumns of
Least-squares line
Parabola
Cubic
Multiple regression
Trend surface

Building a design matrix and solving the normal equations covers straight-line regression, polynomial curve fitting, and multiple regression with one procedure. Replacing the dot product by an abstract inner product extends the same least-squares idea to approximating functions, not just data points.1

Footnotes

  1. Lay, §6.6 — Applications to Linear Models: the least-squares line and regression coefficients, the general linear model , polynomial curve fitting, and multiple regression with the design matrix and normal equations .

╌╌ END ╌╌