Nonlinear Regression · Foundational

Nonlinear Curve Fitting Is an Iterative Search

Why nonlinear models require starting values, repeated approximations, and careful checks for convergence.

A model can be curved in xx and still be linear in its parameters. True nonlinear least squares begins when the unknown parameters enter nonlinearly, as in

f(x;A,k)=Aekx.f(x;A,k)=Ae^{-kx}.

There is usually no single formula for the best estimates. The computer must search for them.

Residuals as a function of parameters

Write

ri(θ)=yif(xi;θ),S(θ)=iri(θ)2.r_i(\boldsymbol\theta)=y_i-f(x_i;\boldsymbol\theta), \qquad S(\boldsymbol\theta)=\sum_i r_i(\boldsymbol\theta)^2.

The goal is to find a low point on the objective surface SS. Unlike linear least squares, this surface may contain long valleys, flat regions, or several local minima.

Starting values matter

An iterative method begins at a proposed parameter vector θ0\boldsymbol\theta_0. Good starting values may come from a plot, a simplified model, physical bounds, or several deliberately different initial guesses.

A typical fitting loop

  1. Evaluate predictions and residuals.
  2. Calculate how predictions change with each parameter.
  3. Propose a parameter step.
  4. Accept, shorten, or modify the step.
  5. Stop when changes in parameters, error, or gradient are sufficiently small.

Scaling is important. If one parameter is near 10610^{-6} and another near 10610^6, the numerical problem may be poorly balanced even when the scientific model is reasonable.

Identifiability

Parameters are identifiable when the available data can distinguish their effects. If several parameter combinations produce nearly the same curve, individual estimates can be highly uncertain even when predictions look good.

After convergence

Plot the fit and residuals, compare runs from different starting values, inspect parameter correlations, and report uncertainty. Bounds can enforce physical constraints, but a parameter pressed against a bound is itself a diagnostic.

Learn from a profile of the objective

For yi=Aekti+εiy_i=Ae^{-kt_i}+\varepsilon_i, fix kk temporarily. The model is then linear in AA, so the best AA can be found by linear least squares. Repeating across candidate kk values creates a profile S(k)S(k). A sharp minimum means kk is well determined; a broad valley means many decay rates fit similarly.

A convergence checklist

Require agreement across multiple starts, a small gradient, stable predictions under small perturbations, plausible parameters, and residuals without structure. Report whether bounds were active and whether uncertainty came from local linearization, a profile, bootstrap, or another method.

Check your understanding

Why can a log transformation of y=Aekxy=Ae^{-kx} change the fitted answer?

Show the reasoning

Fitting logy=logAkx\log y=\log A-kx minimizes squared errors on the log scale, implying multiplicative rather than additive errors. It also fails for nonpositive observations. The transformed and original objectives answer different statistical questions.

Continue exploring

Connections

Related concepts

Gauss–Newton MethodGauss–Newton Linearizes Nonlinear Least SquaresLevenberg–Marquardt MethodLevenberg–Marquardt Balances Caution and SpeedLeast SquaresLeast Squares Finds the Closest ModelFit DiagnosticsGoodness of Fit Requires More Than R²

Applications

  • growth models
  • reaction kinetics
  • decay curves
  • dose-response models