Nonlinear Regression — Definition, Formula & Example
Nonlinear regression is a way to fit a curve to data when the model's unknown constants cannot be solved for with one direct formula. The computer guesses values for those constants and keeps adjusting them until the curve fits the data as closely as it can.
Nonlinear regression fits a model in which is nonlinear in at least one parameter. This means some partial derivative depends on . The estimate minimizes the sum of squared residuals. Because the resulting equations generally have no closed-form solution, is found iteratively from starting values, for example by the Gauss–Newton or Levenberg–Marquardt algorithm.
Key Formula
Where:
- = observed response for the i-th data point
- = model prediction at using parameter values θ
- = the unknown parameters, adjusted to make SSE as small as possible
- = number of data points
Worked Example
Problem: A gardener measures extra plant growth (inches) for ounces of fertilizer: , , . The growth levels off, so she uses the saturation model , where sits in the denominator. During the iterative search, the software tries guess A (, ) and guess B (, ). Which guess fits better?
Step 1: Compute the predictions for guess A by substituting each x-value into the model.
Step 2: Subtract each prediction from its observed value to get the residuals . Then square them and add.
Step 3: Repeat for guess B. The predictions are , so every residual equals .
Answer: Guess A has the smaller sum of squared residuals (2 compared with 3), so it fits better. Nonlinear regression software repeats this kind of comparison, moving the parameters in the direction that lowers SSE, until SSE stops decreasing.
Why It Matters
Many scientific models are nonlinear in their parameters. Examples include Michaelis–Menten enzyme kinetics in biochemistry, dose-response curves in pharmacology, and logistic population growth in ecology and epidemiology. Fitting these models in a college lab course or a research job requires nonlinear regression in software such as R, Python, or Excel Solver.
Common Mistakes
Mistake: Calling any curved fit, such as quadratic regression, "nonlinear regression."
Correction: The word nonlinear refers to the parameters, not the shape of the graph. The model draws a parabola, but it is linear in , , and . Ordinary least squares solves it exactly. A model like is truly nonlinear and needs an iterative search. That search can also depend on your starting guesses.
