Probability & Statistics Codexery

Non-linear least squares

Iterative method for fitting nonlinear models to data.

Non-linear least squares is a technique within least squares analysis for fitting a set of m observations to a model that depends nonlinearly on n unknown parameters, provided m is at least n. It appears in certain types of nonlinear regression. The core idea involves approximating the nonlinear model with a linear one and then improving the parameter estimates through repeated iterations. While it shares many features with linear least squares, there are important differences. In economics, this method is used in probit regression, threshold regression, smooth regression, logistic link regression, and with Box–Cox transformed regressors.

The goal is to find a parameter vector that minimizes the sum of squared residuals—the differences between observed data points and the model's predictions. Because the model is nonlinear, the derivatives in the gradient equations depend on both the independent variable and the parameters, so these equations generally cannot be solved directly. Instead, initial guesses for the parameters are chosen, and the parameters are refined step by step. At each iteration, the model is approximated using a first-order Taylor series expansion around the current parameter values.

This linearization leads to a set of normal equations, which are expressed in matrix form using the Jacobian matrix. These equations form the basis of the Gauss–Newton algorithm for solving nonlinear least squares problems. Note that the sign convention in defining the Jacobian can vary across sources.

When observations have different reliability, a weighted sum of squares can be minimized. Ideally, each weight in the diagonal weight matrix should be the reciprocal of the measurement's error variance. The normal equations are then adjusted accordingly.

Geometrically, in linear least squares, the objective function is a quadratic function of the parameters. With one parameter, its graph is a parabola; with two or more, the contours are concentric ellipses, and the minimum lies at their center. In nonlinear least squares, the objective function is only quadratic near the minimum, where the truncated Taylor series is a good approximation. Farther from the optimum, the contours become non-elliptical. This makes it important to start with parameter estimates as close as possible to the true optimal values, and it explains why the Gauss–Newton algorithm can diverge if the objective function is not approximately quadratic.

Good initial parameter estimates can be found through computer simulation, where observed and calculated data are displayed and parameters are manually adjusted until the fit looks reasonable. Transformations or linearizations can also help. More advanced methods, like the Stochastic Funnel Algorithm, can locate the convex basin of attraction around the optimal estimates. Hybrid algorithms that combine randomization and elitism with Newton methods have proven useful and computationally efficient.

Various solution methods can be applied. A common convergence criterion is that the sum of squares should not increase from one iteration to the next, though this can be tricky to implement. A practical alternative is to check that the relative change in the sum of squares falls below a threshold, such as 0.0001, which may need adjustment for large experimental errors. Another criterion is that the relative change in each parameter should be less than a set value, like 0.001, corresponding to 0.1% precision, provided this is smaller than the largest relative standard deviation on the parameters.

When analytical derivatives for the Jacobian are difficult or impossible to obtain, numerical approximation is used. This involves calculating the model's value at slightly perturbed parameter values. The increment size must be chosen carefully to avoid approximation error from being too large or round-off error from being too small.

field
Statistical regression analysis
known_for
Fitting nonlinear models by iterative linear approximation
applications
Probit regression, threshold regression, smooth regression, logistic link regression, Box–Cox transformed regressors

Lore & Background

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.

Reader's Guide

Non-linear least squares is a fundamental technique in statistical modeling when the relationship between variables is not linear. Its significance lies in its ability to handle complex models where parameters enter nonlinearly, such as in economic applications like probit and threshold regression. The method works by iteratively linearizing the model using a first-order Taylor expansion and solving for parameter updates, a process that continues until convergence. This approach allows analysts to fit models that would otherwise have no closed-form solution, making it indispensable for empirical research in economics and other fields. The technique's legacy is its extension of least squares principles to a much broader class of problems, enabling more realistic and flexible data analysis.

Did You Know?

The Iterative Engine — How Nonlinear Least Squares Works

The fundamental goal of least squares is to find the parameter values that make a model's predictions align as closely as possible with observed data, measured by the aggregate squared gap between actual and predicted values. When the model's dependence on its unknown parameters is purely linear, a direct algebraic formula delivers the answer in one step. Nonlinear least squares, however, confronts models where parameters enter in more complex ways—exponentials, ratios, products—and no single closed-form expression exists. Instead, the solver engages in a cycle of iterative refinement: at each step it locally approximates the curved problem with a straight-line surrogate, solves that simpler linear sub-problem, and then re-evaluates the approximation around the improved estimate. This means the heavy lifting at every iteration mirrors the linear case, even though the overall trajectory is nonlinear. Polynomial regression sits at the boundary, describing how variance in a predicted quantity decomposes into the fitted curve and its deviations. Under certain distributional assumptions—normal, Poisson, binomial, exponential—the standardized least-squares solution coincides exactly with the maximum-likelihood estimate, and the procedure can also be re-derived as a method-of-moments estimator.

A Century of Convergence — The Historical Buildup

The least-squares principle did not emerge from a single eureka moment but from a slow accumulation of ideas across the eighteenth century. Newton, in unpublished work from 1671 and again in 1700, first noted that pooling multiple observations reduces error rather than amplifying it; Roger Cotes gave the idea its earliest formal statement in 1722. The method of averages—combining repeated measurements taken under identical conditions—was practiced by Newton during his equinox studies, by Tobias Mayer in his lunar libration work of 1750, and by Laplace in his 1788 analysis of Jupiter and Saturn. Extending the idea to observations gathered under differing conditions, Boscovich applied a least-absolute-deviation approach to the shape of the Earth in 1757, a problem Laplace revisited in 1789 and 1799. Laplace also attempted to ground the criterion in probability, modeling errors with what we now call the Laplace distribution, though his resulting estimator was the posterior median rather than the arithmetic mean. It was not until Legendre's 1805 publication that the method received its first clear, concise algebraic exposition, and within a decade it had become standard practice in French, Italian, and Prussian astronomy and geodesy.

The Ceres Rescue — Least Squares Proves Its Worth

On the first day of 1801, Italian astronomer Giuseppe Piazzi spotted a new object in the sky and tracked it for roughly forty days before solar glare swallowed it from view. The astronomical community urgently needed to know where the body—later named Ceres—would reappear, but doing so without resorting to Kepler's notoriously intricate nonlinear equations of planetary motion seemed nearly impossible. The solution that ultimately succeeded belonged to a twenty-four-year-old Carl Friedrich Gauss, who applied his least-squares machinery to Piazzi's sparse positional data. His prediction was the only one that allowed Hungarian astronomer Franz Xaver von Zach to relocate the lost asteroid. This practical triumph gave the method an undeniable credibility that pure theory could not. Gauss had published his orbital-calculation work in 1809, claiming prior possession of the technique since 1795, which ignited a priority dispute with Legendre. Yet Gauss's contribution went well beyond Legendre's algebraic recipe: he wove the method into the fabric of probability theory, linked it to the normal distribution, and demonstrated that the arithmetic mean is the optimal estimate of a location parameter under those assumptions.

From Ad Hoc Fitting to Optimal Estimation — Theoretical Foundations

The theoretical scaffolding that elevates least squares from a useful trick to a provably optimal procedure was assembled over several decades. In 1810, Laplace, after establishing the central limit theorem, used it to supply a large-sample justification for both the least-squares criterion and the normal error distribution, effectively completing the program he had outlined earlier. In 1822 Gauss articulated what is now recognized as the Gauss-Markov theorem: in a linear model whose errors are uncorrelated, normally distributed, have zero mean, and share a common variance, the least-squares estimator is the best linear unbiased estimator of the coefficients. An extended form of this result broadens the conditions under which optimality holds. Independently, the American mathematician Robert Adrain formulated the least-squares idea in 1808, underscoring that the principle was arriving from multiple intellectual traditions simultaneously. Over the following two centuries, statisticians and error-theory researchers discovered numerous alternative implementations and generalizations, and the method's connection to the exponential family of distributions—where standardized least-squares and maximum-likelihood estimates coincide under mild regularity conditions—further cemented its place as a cornerstone of statistical inference.

Frequently Asked Questions

Who is Non-linear least squares?

Non-linear least squares is an iterative fitting procedure in statistical regression that estimates n unknown parameters (with m ≥ n observations) by repeatedly approximating a non-linear model with a linear one and refining the estimates.

What are Non-linear least squares's powers/role?

It linearizes a non-linear model around the current parameter guess, solves the resulting linear least-squares problem, and updates the parameters in a loop until convergence. It underpins probit regression, threshold regression, smooth regression, logistic link regression, and Box–Cox transformed regressors.

How does Non-linear least squares's story end?

The iteration halts when successive parameter updates fall below a chosen tolerance, signaling that the local linear approximation has settled on a stable least-squares solution for the underlying non-linear model.

Why is Non-linear least squares important?

Many scientific and engineering relationships are inherently curved, so a single closed-form linear fit cannot capture them; non-linear least squares provides a systematic iterative path to extract reliable parameter estimates from those curved models.

What is Non-linear least squares's origin story?

It grew out of classical least-squares regression, extending the method to cases where parameters enter the model non-linearly and therefore require a repeated cycle of local linearization rather than one algebraic solution.

More in Probability & Statistics 1-24

Spotted an error? Know more?

This is a living reference — every entry is fact-audited, and reader corrections feed straight into our audit queue. Suggest an edit · See this site's audit record

Comments

Loading…
Open in the interactive codex →