Non-linear least squares is the form of least squares analysis used to fit a set of m observations with a model that is non-linear in n unknown parameters (m ≥ n). It is used in some forms of nonlinear regression. The basis of the method is to approximate the model by a linear one and to refine the parameters by successive iterations. There are many similarities to linear least squares, but also some significant differences. In economic theory, the non-linear least squares method is applied in (i) the probit regression, (ii) threshold regression, (iii) smooth regression, (iv) logistic link regression, (v) Box–Cox transformed regressors (m(x,θi)=θ1+θ2x(θ3)).
Theory Consider a set of m data points, (x1,y1),(x2,y2),…,(xm,ym), and a curve (model function) ŷ=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 (𝐉𝖳𝐉)Δ𝜷=𝐉𝖳 Δ𝐲. 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, (𝐉𝖳𝐖𝐉)Δ𝜷=𝐉𝖳𝐖 Δ𝐲.
Geometrical interpretation In linear least squares the objective function, S, is a quadratic function of the parameters. S=∑iWii(yi−∑jXijβj)2 When there is only one parameter the graph of S with respect to that parameter will be a parabola. With two or more parameters the contours of S with respect to any pair of parameters will be concentric ellipses (assuming that the normal equations matrix 𝐗𝖳𝐖𝐗 is positive definite). The minimum parameter values are to be found at the centre of the ellipses. The geometry of the general objective function can be described as paraboloid elliptical. In NLLSQ the objective function is quadratic with respect to the parameters only in a region close to its minimum value, where the truncated Taylor series is a good approximation to the model. S≈∑iWii(yi−∑jJijβj)2 The more the parameter values differ from their optimal values, the more the contours deviate from elliptical shape. A consequence of this is that initial parameter estimates should be as close as practicable to their (unknown!) optimal values. It also explains how divergence can come about as the Gauss–Newton algorithm is convergent only when the objective function is approximately quadratic in the parameters.
Computation
Initial parameter estimates Some problems of ill-conditioning and divergence can be corrected by finding initial parameter estimates that are near to the optimal values. A good way to do this is by computer simulation. Both the observed and calculated data are displayed on a screen. The parameters of the model are adjusted by hand until the agreement between observed and calculated data is reasonably good. Although this will be a subjective judgment, it is sufficient to find a good starting point for the non-linear refinement. Initial parameter estimates can be created using transformations or linearizations. Better still evolutionary algorithms such as the Stochastic Funnel Algorithm can lead to the convex basin of attraction that surrounds the optimal parameter estimates. Hybrid algorithms that use randomization and elitism, followed by Newton methods have been shown to be useful and computationally efficient.
Solution Any method among the ones described below can be applied to find a solution.
Convergence criteria The common sense criterion for convergence is that the sum of squares does not increase from one iteration to the next. However this criterion is often difficult to implement in practice, for various reasons. A useful convergence criterion is |Sk−Sk+1Sk|<0.0001. The value 0.0001 is somewhat arbitrary and may need to be changed. In particular it may need to be increased when experimental errors are large. An alternative criterion is |Δβjβj|<0.001,j=1,…,n. Again, the numerical value is somewhat arbitrary; 0.001 is equivalent to specifying that each parameter should be refined to 0.1% precision. This is reasonable when it is less than the largest relative standard deviation on the parameters.
Calculation of the Jacobian by numerical approximation
… excerpt ends here. Continue reading the full article.