From first principles
Derive Gauss–Newton from a local model of measured residuals
Let \(r(x)\) contain the differences between model predictions and measured data, expressed in comparable units or whitened by their known uncertainties. With more measurements than unknowns, exact agreement may be impossible. Minimize \(\phi(x)=\|r(x)\|^2/2\). A first-order local model of each differentiable residual produces a linear least-squares problem for a step \(s\),
At the minimum the predicted residual is orthogonal to every column of \(J\), yielding the Gauss–Newton equations
If \(J\) has independent columns, the local model has a unique minimizer. In computation a QR or singular-value solve can be preferable to forming \(J^TJ\). Residual functions with strong curvature may make a full model step inaccurate, particularly when the best fit still has large residuals. Comparing actual and predicted decrease tests the local approximation.
Derivation and applications
Predict local Gauss–Newton convergence when the best residual is nonzero
For a nonlinear least-squares problem a stationary point can retain a mismatch with the observations. That mismatch multiplies residual curvature in the exact Hessian and can control the iteration speed. To expose the effect, take one scalar parameter \(x\), residuals \(r_i(x)\) with two continuous derivatives, and objective \(\phi=\tfrac12\sum_i r_i^2\). Differentiate twice to separate two contributions,
Gauss–Newton replaces the actual curvature by the always nonnegative sensitivity term \(H\). Assume \(x_*\) has \(g(x_*)=0\) and \(H(x_*)>0\). Differentiate the update map \(G(x)=x-g(x)/H(x)\). At the stationary point the term involving \(H'\) cancels exactly because \(g=0\), giving
The local error thus behaves as
If all residuals vanish, the linear error term disappears. A strict local minimum of the true objective need not attract the full Gauss–Newton iteration: positive total curvature \(H+S\) alone does not enforce \(|S/H|<1\). Damping changes the local factor by multiplying the modeled correction by a fraction.
Worked example
Predict oscillation near a weakly curved mismatch
Take \(r_1=x,\ r_2=1+0.2x^2\). At \(x_*=0\), \(H=1\), \(S=0.4\), giving local factor \(-0.4\). Starting at \(x=0.10\), \(g=0.14008\), \(H=1.0016\), and the full update lands at \(-0.03986\), close to the linear prediction \(-0.040\). The fitted residual of one in the second channel controls the alternating approach.
Second application
Stabilize a minimum that repels full steps
For \(r_1=x,\ r_2=1+x^2\), the origin is a strict minimum since \(\phi''(0)=3\). The full-step factor there is \(-2\), so small errors grow. A half-step changes the factor to \(1-0.5(3/1)=-0.5\), restoring local contraction. The residual value at the optimum is identical in both examples; its curvature determines the different behaviour.
More equations than unknowns
Repeated measurements generally leave a residual even at the best parameters. For \(r(x)\in\mathbb R^m\), minimise \(\Phi(x)=\|r(x)\|^2/2\). Differentiating gives
At a stationary point the residual is perpendicular to every first-order change accessible by varying the parameters. It may remain large if the model cannot reproduce the observations. Different physical units require weights or a clear rescaling before squaring coordinates; otherwise a change of units silently changes what solution is optimal.
Approximate \(r(x+s)\) by \(r+Js\) and minimise its squared norm. The least-squares condition is
In practice a QR or singular-value factorisation of \(J\) avoids squaring its condition number. The exact Hessian is \(J^TJ+\sum_i r_i\nabla^2r_i\). Thus the neglected term vanishes at a zero-residual solution, but can matter for strongly curved residuals with a poor fit. A descent direction follows with full column rank whenever the gradient is nonzero: multiplying the normal equations by \(s^T\) gives
Fit two incompatible observations
A parameter \(x\) predicts \(x\) for one sensor and \(x^2\) for another. Suppose their dimensionless observations are 1 and 2. Then \(r=(x-1,x^2-2)^T\). At \(x=1\) the residual is \((0,-1)^T\) and \(J=(1,2)^T\). The linear model chooses \(s=2/5=0.4\), moving to 1.4. The objective drops from 0.5 to \((0.4^2+0.04^2)/2=0.0808\). An exact fit is impossible because \(x=1\) would require the other observation to be one.
At the original point the exact second derivative is \(5-2=3\), so a full scalar Newton step on the objective would be \(2/3\), quite different from the Gauss–Newton step. At 1.4 the gradient is
Another Gauss–Newton step is
The iteration reverses direction as the two sensor discrepancies begin to balance. Monitoring only the second sensor would favour a different parameter.
Regularise the step model
Minimising \(\|r+Js\|^2+\lambda\|s\|^2\) gives
A positive \(\lambda\) controls overly large steps along weakly observed directions. With \(\lambda=5\) at the original point the step becomes 0.2 and the true objective at 1.2 is 0.1768. This is a smaller first improvement but may be more reliable elsewhere. Compare the actual decrease with that predicted by the local model to adjust damping. This temporary penalty on the step differs physically from assuming in advance that the final parameter itself must be small.
Changing one sensor's reliability changes the fit
Suppose the squared residual of the second sensor receives weight one quarter because its standard deviation is twice that of the first. In the worked example at \(x=1\), the scalar normal-equation numerator becomes \(0+(1/4)\,2(-1)=-0.5\); its denominator becomes
The step is now 0.25. The model has moved less far from the exactly matched first sensor because the second sensor's discrepancy now carries less statistical weight. Repeated observations with correlated errors would require a full covariance model to interpret this weighting as a statistical fit.
Derive a bounded-influence residual fit
Ordinary least squares makes a single residual's contribution to the gradient proportional to its magnitude. If rare gross errors are plausible, choose a loss that is quadratic for small discrepancies and linear for large ones. For the Huber loss with transition \(\delta>0\), use \(\rho(r)=r^2/2\) for \(|r|\le\delta\) and \(\delta |r|-\delta^2/2\) otherwise. Matching value and derivative at both transition points ensures a continuously differentiable convex objective in a location parameter. Its score is \(\psi(r)=\max(-\delta,\min(r,\delta))\).
For differentiable model residuals \(r_i(x)\) the stationarity equation becomes
Set \(w_i=\psi(r_i)/r_i\) for nonzero residuals and one at zero. The score is now a weighted residual and solving a succession of weighted least-squares problems supplies an iteratively reweighted method. The weights must be recomputed from each current fit. Treating them as externally measured inverse variances would misinterpret their statistical role. Convexity of \(\rho\) in \(r\) does not by itself guarantee convexity with respect to nonlinear parameters.
Trace the effect of a contaminated reading
Four sensors estimate the same scalar location and report 0, 1, 2 and 20 in common standardised units. Least squares fits their mean \(23/4=5.75\). Use \(\delta=1\) instead, with residuals \(x-b_i\). In the interval \([1,2]\) the first sensor contributes score \(+1\) and the last contributes \(-1\). The two central readings contribute \(x-1\) and \(x-2\). The sum is \(2x-3\), which vanishes at 1.5. Convexity makes this a global minimum. Increasing the last reading to 200 leaves its score at minus one throughout the same interval and does not change the fitted location.
At \(x=1.5\) the four weights are \(2/3,1,1,1/18.5\). A weighted-average check confirms stationarity more transparently through the signed weighted residuals: \(+1,+0.5,-0.5,-1\) sum to zero. The final gross discrepancy is still 18.5 units. A robust fit limits how much that observation can move the fitted value; it does not explain why the instrument returned such a reading. Record it for investigation rather than replacing it silently by a reconstructed value.
For a physical model with differently scaled sensors, first divide discrepancies by appropriate instrument uncertainty scales or choose distinct physically defensible transition values. A single threshold measured in raw units can suppress every reading from one instrument merely because its unit is larger. Conversely an overly large threshold reduces to ordinary least squares over the whole observed residual range. Compare fits under plausible thresholds and investigate whether the prediction of interest changes, especially when a group of related sensors shares the same fault.
A gross error in an input coordinate is a further distinction. A calibration point at an extreme input can have large leverage through its Jacobian row even after its residual score has been capped. Thus the bounded score controls sensitivity to residual amplitude, while the geometry of the design still controls how much that bounded discrepancy can rotate or translate the final fit.
Change parameters · Explore the worked calculation
Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.