Nonlinear regression

Intermediate

What you need first. Nothing else on this path comes first. This page is part of Statistical inference.

In regression, a nonlinear regression is a least-squares fit of a mean that is not linear in its unknown coefficients. A response sometimes bends, levels off, or decays in a way no straight line, and no polynomial in the predictors with fixed powers, can represent by coefficients that enter the mean only through sums and products. The curve is then nonlinear in the unknown coefficients, and the fit that minimises the sum of squared vertical gaps is nonlinear least squares. A mean is a nonlinear regression when it is not linear in the parameters. The same squared-error criterion is used as in a linear fit. What changes is that the minimiser is found by iteration.[1][2]

Nonlinear regression

Nonlinear regression
Fact Value
Topic Statistical inference
Listed on Statistical inference
Worked example 1

Motivating example

Concrete gains strength quickly at first and then approaches a ceiling as it cures. A straight line in time has no horizontal asymptote, so it keeps rising or falling at the extremes of the time axis. A mean such as β0+β1exp⁡(−β2t)\beta_0+\beta_1\exp(-\beta_2 t) can rise fast and then flatten, because the rate β2\beta_2 sits inside the exponential. The three coefficients cannot be recovered by the closed-form slope formula for a straight line. They are chosen by searching for the values that make the squared gaps between measured strength and the curve as small as possible. The way the parameters are estimated is conceptually the same least-squares idea as in a linear model. The search is what the nonlinearity forces.[2]

Definition

Observations (xi,yi)(x_i,y_i) are modelled as

yi=f(xi;β)+εi,y_i=f(x_i;\beta)+\varepsilon_i,

where ff is a known function that is not linear in the coefficient vector β\beta. Nonlinear least squares chooses β^\hat\beta to minimise

S(β)=∑i(yi−f(xi;β))2.S(\beta)=\sum_i\bigl(y_i-f(x_i;\beta)\bigr)^2.

The same criterion defines the procedure: a regression is called nonlinear when the mean is not linear in the coefficients, and the coefficients are estimated by least squares. Smoothness of ff and a unique minimum make the search practical, but they are not required for the definition.[2][1]

Setting the derivatives of SS to zero produces one equation for each coefficient,

∑i(yi−f(xi;β))∂f(xi;β)∂βj=0.\sum_i\bigl(y_i-f(x_i;\beta)\bigr)\frac{\partial f(x_i;\beta)}{\partial\beta_j}=0.

Those normal equations are themselves nonlinear when ff is nonlinear in β\beta, so they need not have a solution, or they may have more than one. They are solved by iteration. Gauss–Newton linearises ff in the coefficients at the current guess, by a Taylor expansion, and solves the resulting linear least-squares step. Levenberg–Marquardt mixes that step with a move that only shrinks SS.[1]

A function that is nonlinear in xx can still be linear in β\beta. The mean β0+β1x+β2x2\beta_0+\beta_1 x+\beta_2 x^2 is a polynomial curve and is estimated by ordinary linear least squares, because each term is a coefficient times a known function of xx. In that statistical sense the model is linear in the parameters even though the graph is curved. The mean β0exp⁡(−β1x)\beta_0\exp(-\beta_1 x) is not. A function that is not linear in the parameters can sometimes be rewritten, by a transformation of the response, as a function that is. When no such transformation exists, the fit stays in the nonlinear iteration.[3][1]

Properties

The fitted coefficients minimise squared vertical error for the function that was written down. They are not, in general, available from a matrix formula. A second start can finish at a different value of SS when the surface has more than one dip. When a minimum has been reached, intervals for the coefficients and for the mean are available from the same linearisation used in the last step, and those intervals are approximate. The probabilistic reading of the interval is only approximately correct, and the approximation is still the interval that is used in practice.[2]

Small samples can still identify a nonlinear mean when the curve is a good description of the process, because the criterion uses every observation. One or two wild responses can move the curve a long way, for the same reason they move a least-squares line: the criterion squares their gaps. Nonlinear fits have fewer routine diagnostics for that movement than linear fits do.[2]

Worked example

Three measurements follow a decay: (x,y)=(0,4)(x,y)=(0,4), (1,2)(1,2), (2,1.2)(2,1.2). The mean β0exp⁡(−β1x)\beta_0\exp(-\beta_1 x) is nonlinear in β1\beta_1. At the start (β0,β1)=(4,0.7)(\beta_0,\beta_1)=(4,0.7) the fitted values are 44, 4e−0.7≈1.98634e^{-0.7}\approx 1.9863 and 4e−1.4≈0.98644e^{-1.4}\approx 0.9864, and

S(4,0.7)=(4−4)2+(2−1.986341)2+(1.2−0.986388)2=0.045817.S(4,0.7)=(4-4)^2+(2-1.986341)^2+(1.2-0.986388)^2=0.045817.

A numerical minimiser moves to β0=3.9742\beta_0=3.9742, β1=0.6389\beta_1=0.6389. The fitted values are 3.97423.9742, 2.0978722.097872 and 1.1074091.107409, and

S(3.9742,0.6389)=0.018818.S(3.9742,0.6389)=0.018818.

Shifting only the rate back to 0.70.7, with the scale held at 3.97423.9742, raises SS to 0.0497550.049755. Shifting only the scale to 4.24.2, with the rate held at 0.63890.6389, raises SS to 0.0879980.087998. This pair is a local improvement on those two neighbours. It is the minimiser along the profile that, for each rate, chooses the best scale: the profiled minimum is at rate 0.638920.63892 and scale 3.974183.97418, and rounding to four decimals does not change SS at the reported precision.

The straight line fitted to the same three points has mean xx equal to 11, mean yy equal to 2.42.4, ∑(xi−xˉ)2=2\sum(x_i-\bar x)^2=2 and ∑(xi−xˉ)(yi−yˉ)=−2.8\sum(x_i-\bar x)(y_i-\bar y)=-2.8, so the slope is −2.8/2=−1.4-2.8/2=-1.4 and the intercept is 2.4−(−1.4)(1)=3.82.4-(-1.4)(1)=3.8. The fitted values are 3.83.8, 2.42.4 and 1.01.0, and the residual sum of squares is 0.240.24. The exponential uses the same squared-error criterion and cuts that sum from 0.240.24 to 0.0188180.018818, because the drops from 44 to 22 to 1.21.2 slow down rather than stay constant.[2][3]

Your turn. The curve y=β0e−β1xy=\beta_0 e^{-\beta_1 x} is required to pass through (0,5)(0,5) and (1,1)(1,1). Find β0\beta_0, β1\beta_1, and the residual sum of squares.

The point at x=0x=0 forces β0=5\beta_0=5. Then 5e−β1=15e^{-\beta_1}=1, so β1=ln⁡5≈1.6094\beta_1=\ln 5\approx 1.6094. Both residuals are zero, and the residual sum of squares is 00.

Assumptions and limits

The procedure assumes that the function ff was chosen before looking at the size of SS, that the gaps are the right scale on which to measure miss, and that a start near the minimiser is available. A bad start can stop at a local minimum, or the iteration can fail to move. Outliers pull the fit because they are squared. Approximate intervals inherit the usual least-squares story of comparable, weakly dependent errors, and they remain approximations even then. A process that truly levels off is a reason to leave the straight line. The formula still returns a number outside the times that were measured, and that number is an extrapolation of the fitted function, not a new observation.[2][1]

Taking logarithms and then using ordinary least squares minimises squared error on the log scale. The minimiser of SS on the original scale is the nonlinear least-squares fit. The two answers agree only when the logged model happens to match the criterion that was declared. A curve on the scatterplot is not, by itself, a nonlinear regression. Polynomial least squares draws a curve and still uses the linear normal equations.[3][1]

Check yourself

Try these questions before opening an answer.

A curved linear model

Why is a quadratic polynomial in the predictor still fit by linear least squares?

Each power of the predictor is a known column, and the unknown coefficients stand in front of those columns. Linearity is judged in the coefficients, not in the shape of the graph.

Two starts

Why can two different starting values finish at different fitted curves?

The sum of squared errors need not have a single minimum when the mean is nonlinear in the coefficients, so the iteration can stop in different dips.

History

The early published uses of a regression mean that is nonlinear in its coefficients date from the 1920s, including work by Fisher and Mackenzie on the manurial response of potato varieties. Routine fitting waited on automatic calculation in the 1970s, because each fit is an iterative minimisation of SS rather than one pass through the normal equations. The steps in common use linearise the mean at the current coefficients, in the manner of Gauss–Newton, or combine that linearisation with a damper, as in Levenberg–Marquardt. The least-squares criterion itself is older: Gauss, Legendre, and possibly Adrain developed it around the turn of the nineteenth century for problems that were linear in the parameters. Nonlinear regression is that criterion applied where the parameters sit inside the function.[1][3]

See also

Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability

Glossary and index

References

  1. ^ a b c d e f g a. (p. 372, Nonlinear regression) b. (pp. 372–373, Mathematical aspects) c. (p. 373, Mathematical aspects) d. (p. 373, Domains and limitations) e. (p. 373, Domains and limitations) f. (p. 372, Nonlinear regression) g. (pp. 372–373, History and Mathematical aspects) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
  2. ^ a b c d e f g a. (§4.1.4.2, Definition of a nonlinear regression model) b. (§4.1.4.2, Examples of nonlinear models) c. (§4.1.4.2, Definition of a nonlinear regression model) d. (§4.1.4.2, Advantages of nonlinear least squares) e. (§4.1.4.2, Disadvantages of nonlinear least squares) f. (§4.1.4.2, least squares for a nonlinear mean) g. (§4.1.4.2, starting values, outliers, and approximate intervals) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §4.1.4.2: Nonlinear Least Squares Regression. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd142.htm
  3. ^ a b c d a. (§4.1.4.1, Definition of a linear least squares model) b. (§4.1.4.1, the straight line as the statistically linear case) c. (§4.1.4.1, linear in the parameters) d. (§4.1.4.1, Why least squares) NIST/SEMATECH (2002). NIST/SEMATECH e-Handbook of Statistical Methods, §4.1.4.1: Linear Least Squares Regression. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm
Cite this page
Plain text
StatWiki (2026). "Nonlinear regression." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/nonlinear-regression.html
BibTeX
@misc{statwiki_nonlinear_regression,
  author = {{StatWiki}},
  title = {{Nonlinear regression}},
  year = {2026},
  url = {https://www.statwiki.io/articles/nonlinear-regression.html},
  urldate = {2026-12-02},
  note = {StatWiki, last updated 2 December 2026}
}