Lably
Skip to content

Non-linear least squares

Approximation method in statistics

  • 12 min read
  • 4 chapters

Related on Lably

Through Least squares, Linear least squares and Maximum and minimum

Theory

Consider a set of m data points, (x1,y1),(x2,y2),…,(xm,ym), and a curve (model function) y^=f(x,β), that in addition to the variable x also depends on n parameters, β=(β1,β2,…,βn), with m≥n. It is desired to find the vector β of parameters such that the curve fits best the given data in the least squares sense, that is, the sum of squares S=∑i=1mri2 is minimized, where the residuals (in-sample prediction errors) ri are given by ri=yi−f(xi,β) for i=1,2,…,m.

The minimum value of S occurs when the gradient is zero. Since the model contains n parameters there are n gradient equations: ∂S∂βj=2∑iri∂ri∂βj=0(j=1,…,n).

In a nonlinear system, the derivatives ∂ri∂βj are functions of both the independent variable and the parameters, so in general these gradient equations do not have a closed solution. Instead, initial values must be chosen for the parameters. Then, the parameters are refined iteratively, that is, the values are obtained by successive approximation, βj≈βjk+1=βjk+Δβj.

Here, k is an iteration number and the vector of increments, Δβ is known as the shift vector. At each iteration the model is linearized by approximation to a first-order Taylor polynomial expansion about βk f(xi,β)≈f(xi,βk)+∑j∂f(xi,βk)∂βj(βj−βjk)=f(xi,βk)+∑jJijΔβj. The Jacobian matrix, J, is a function of constants, the independent variable and the parameters, so it changes from one iteration to the next. Thus, in terms of the linearized model, ∂ri∂βj=−Jij and the residuals are given by Δyi=yi−f(xi,βk), ri=yi−f(xi,β)=(yi−f(xi,βk))+(f(xi,βk)−f(xi,β))≈Δyi−∑s=1nJisΔβs.

Substituting these expressions into the gradient equations, they become −2∑i=1mJij(Δyi−∑s=1nJisΔβs)=0, which, on rearrangement, become n simultaneous linear equations, the normal equations ∑i=1m∑s=1nJijJisΔβs=∑i=1mJijΔyi(j=1,…,n).

The normal equations are written in matrix notation as (JTJ)Δβ=JTΔy.

These equations form the basis for the Gauss–Newton algorithm for a non-linear least squares problem.

Note the sign convention in the definition of the Jacobian matrix in terms of the derivatives. Formulas linear in J may appear with factor of −1 in other articles or the literature.

Extension by weights

When the observations are not equally reliable, a weighted sum of squares may be minimized, S=∑i=1mWiiri2.

Each element of the diagonal weight matrix W should, ideally, be equal to the reciprocal of the error variance of the measurement. The normal equations are then, more generally, (JTWJ)Δβ=JTWΔy.

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Statistics and probability