ArticleslgStudy

mathematics

Numerical methods for linear least squares

Numerical methods for linear least squares is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Numerical methods for linear least squares rather than just read about it. In short: Numerical methods for linear least squares entails the numerical analysis of linear least squares problems. Introduction A general approach to the least squares problem min⁡‖𝐲−X𝜷‖2 can be described as follows.

Key takeaways

  • Numerical methods for linear least squares belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Numerical methods for linear least squares to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Numerical methods for linear least squares from memory before moving on to harder problems.

Reference excerpt

Numerical methods for linear least squares entails the numerical analysis of linear least squares problems.

Introduction A general approach to the least squares problem min⁡‖𝐲−X𝜷‖2 can be described as follows. Suppose that we can find an n by m matrix S such that XS is an orthogonal projection onto the image of X. Then a solution to our minimization problem is given by

𝜷=S𝐲 simply because

X𝜷=X(S𝐲)=(XS)𝐲 is exactly a sought for orthogonal projection of 𝐲 onto an image of X (see the picture below and note that as explained in the next section the image of X is just a subspace generated by column vectors of X). A few popular ways to find such a matrix S are described below.

Inverting the matrix of the normal equations The equation (𝐗T𝐗)β=𝐗Ty is known as the normal equation. The algebraic solution of the normal equations with a full-rank matrix XTX can be written as

𝜷̂=(𝐗T𝐗)−1𝐗T𝐲=𝐗+𝐲 where X+ is the Moore–Penrose pseudoinverse of X. Although this equation is correct and can work in many applications, it is not computationally efficient to invert the normal-equations matrix (the Gramian matrix). An exception occurs in numerical smoothing and differentiation where an analytical expression is required. If the matrix XTX is well-conditioned and positive definite, implying that it has full rank, the normal equations can be solved directly by using the Cholesky decomposition RTR, where R is an upper triangular matrix, giving:

RTR𝜷̂=XT𝐲. The solution is obtained in two stages, a forward substitution step, solving for z:

RT𝐳=XT𝐲, followed by a backward substitution, solving for 𝜷̂:

R𝜷̂=𝐳. Both substitutions are facilitated by the triangular nature of R.

Orthogonal decomposition methods Orthogonal decomposition methods of solving the least squares problem are slower than the normal equations method but are more numerically stable because they avoid forming the product XTX. The residuals are written in matrix notation as

𝐫=𝐲−X𝜷̂. The matrix X is subjected to an orthogonal decomposition, e.g., the QR decomposition as follows.

X=Q(R0) , where Q is an m×m orthogonal matrix (QTQ=I) and R is an n×n upper triangular matrix with rii>0. The residual vector is left-multiplied by QT.

QT𝐫=QT𝐲−(QTQ)(R0)𝜷̂=[(QT𝐲)n−R𝜷̂(QT𝐲)m−n]=[𝐮𝐯] Because Q is orthogonal, the sum of squares of the residuals, s, may be written as:

s=‖𝐫‖2=𝐫T𝐫=𝐫TQQT𝐫=𝐮T𝐮+𝐯T𝐯 Since v doesn't depend on β, the minimum value of s is attained when the upper block, u, is zero. Therefore, the parameters are found by solving:

R𝜷̂=(QT𝐲)n. These equations are easily solved as R is upper triangular. An alternative decomposition of X is the singular value decomposition (SVD)

X=UΣVT , where U is m by m orthogonal matrix, V is n by n orthogonal matrix and Σ is an m by n matrix with all its elements outside of the main diagonal equal to 0. The pseudoinverse of Σ is easily obtained by inverting its non-zero diagonal elements and transposing. Hence,

𝐗𝐗+=UΣVTVΣ+UT=UPUT, where P is obtained from Σ by replacing its non-zero diagonal elements with ones. Since (𝐗𝐗+)∗=𝐗𝐗+ (the property of pseudoinverse), the matrix UPUT is an orthogonal projection onto the image (column-space) of X. In accordance with a general approach described in the introduction above (find XS which is an orthogonal projection),

S=𝐗+, and thus,

β=VΣ+UT𝐲 is a solution of a least squares problem. This method is the most computationally intensive, but is particularly useful if the normal equations matrix, XTX, is very ill-conditioned (i.e. if its condition number multiplied by the machine's relative round-off error is appreciably large). In that case, including the smallest singular values in the inversion merely adds numerical noise to the solution. This can be cured with the truncated SVD approach, giving a more stable and exact answer, by explicitly setting to zero all singular values below a certain threshold and so ignoring them, a process closely related to factor analysis.

Discussion The numerical methods for linear least squares are important because linear regression models are among the most important types of model, both as formal statistical models and for exploration of data-sets. The majority of statistical computer packages contain facilities for regression analysis that make use of linear least squares computations. Hence it is appropriate that considerable effort has been devoted to the task of ensuring that these computations are undertaken efficiently and with due regard to round-off error. Individual statistical analyses are seldom undertaken in isolation, but rather are part of a sequence of investigatory steps. Some of the topics involved in considering numerical methods for linear least squares relate to this point. Thus important topics can be

Computations where a number of similar, and often nested, models are considered for the same data-set. That is, where models with the same dependent variable but different sets of independent variables are to be considered, for essentially the same set of data-points. Computations for analyses that occur in a sequence, as the number of data-points increases. Special considerations for very extensive data-sets. Fitting of linear models by least squares often, but not always, arise in the context of statistical analysis. It can therefore be important that considerations of computation efficiency for such problems extend to all of the auxiliary quantities required for such analyses, and are not restricted to the formal solution of the linear least squares problem. Matrix calculations, like any other, are affected by rounding errors. An early summary of these effects, regarding the choice of computation methods for matrix inversion, was provided by Wilkinson.

See also Numerical linear algebra Numerical methods for non-linear least squares

References

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Numerical methods for linear least squares

Start with the simplest possible case. Write down what Numerical methods for linear least squares claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Numerical methods for linear least squares before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Numerical methods for linear least squares ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Numerical methods for linear least squares

In research
Numerical methods for linear least squares appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Numerical methods for linear least squares in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Numerical methods for linear least squares is common in secondary-school and first-year university syllabi. It links to neighbouring topics Least squares, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for Numerical methods for linear least squares outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Numerical methods for linear least squares” →

How to study Numerical methods for linear least squares in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Numerical methods for linear least squares means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Numerical methods for linear least squares out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Numerical methods for linear least squares in simple terms?

Numerical methods for linear least squares entails the numerical analysis of linear least squares problems. Introduction A general approach to the least squares problem min⁡‖𝐲−X𝜷‖2 can be described as follows.

Why does Numerical methods for linear least squares matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Numerical methods for linear least squares?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Numerical methods for linear least squares.

Tags

  • Least squares
  • Numerical linear algebra

Keep exploring