What Is Nonlinear Regression?
Nonlinear regression estimates the parameters of a model that cannot be turned into a straight line, such as a logistic growth curve or a Michaelis-Menten saturation curve. It finds the parameters that minimise the sum of squared errors between the model and your data.
The calculator uses the Levenberg-Marquardt method, tells you whether the fit converged, and reports the fitted equation, residual standard error, RMSE, R² and AIC. If your relationship can be linearised, the simpler curve fitting calculator may be enough.
Below you will find the formulas, a variables table, a worked example and answers to common questions such as how to choose starting values and why a fit may fail to converge.
How to Use the Nonlinear Regression Calculator
- Choose the model that matches the shape of your data and the underlying process.
- Enter x and y values in matching order; you need at least one more point than the model has parameters.
- Leave the starting values blank, or supply your own if the fit fails to converge.
- Check R², the parameter standard errors and the residual plot. Large standard errors mean the parameters are poorly determined by the data.
Nonlinear Regression Formula
Least squares objective
Levenberg-Marquardt update
Logistic
Michaelis-Menten
Gompertz
Nonlinear Regression Variables Explained
| Symbol | Meaning | Notes |
|---|---|---|
| x, y | Your paired data | |
| θ | Model parameters | Estimated by the fit |
| SSE | Sum of squared errors | The quantity minimised |
| λ | Damping parameter | Used by Levenberg-Marquardt |
| R², AIC | Fit measures |
Nonlinear Regression Worked Example
Using the example values (press “Load example” above to try them):
- Model: Logistic y = L / (1 + e^(−k(x − x₀))), with 3 parameters (L, k, x₀).
- Starting values: L = 81.51, k = 0.4, x₀ = 5.
- Levenberg-Marquardt iterations adjust the parameters to reduce the sum of squared errors, blending Gauss-Newton steps with gradient descent for stability.
- Final SSE = 0.302047; R² = 0.99996.
- Standard errors come from the Jacobian at the solution: SE(pⱼ) = s √[(JᵀJ)⁻¹]ⱼⱼ.
Result: Fitted equation = y = 76.006 / (1 + e^(−0.73507(x − 5.0152))); Parameter L = 76.00643; Parameter k = 0.7350666; R² = 0.99996.
Choosing a model
| Model | Shape | Typical uses |
|---|---|---|
| Exponential a·e^(bx) | Unbounded growth or decay | Early epidemic growth, compound interest |
| Exponential with offset | Growth or decay to or from a baseline | Cooling, charging a capacitor |
| Power a·x^b | Curved, no inflection | Allometry, scaling laws |
| Logistic | S-shape, symmetric | Population growth, technology adoption, dose response |
| Gompertz | S-shape, asymmetric | Tumour growth, mortality, market saturation |
| Michaelis-Menten | Rises and saturates | Enzyme kinetics, Langmuir adsorption |
| Decay to baseline | Falls to a plateau | Drug concentration, relaxation |
Starting values and convergence
Non-linear fitting is iterative and can converge to a poor solution, or fail, if the starting values are far from the truth. The calculator picks starting values from the data (for example the maximum of y for a saturation level). If the result looks wrong, enter your own guesses based on the plot: for a logistic, a plateau L close to the largest y, a growth rate k and a midpoint x₀ near the steepest rise. A “not fully converged” flag means the optimiser reached its iteration limit.
Why not just linearise with logarithms?
Taking logs of an exponential or power model turns it into a straight line, but it also changes the error structure: the fit minimises errors on the log scale and gives small values disproportionate weight. True non-linear least squares fits the original scale, which is usually what is wanted when errors are additive. For some models, such as Michaelis-Menten, the classical linearisations (Lineweaver-Burk) are well known to distort the estimates.
Judging the fit
- R² shows overall closeness but can be high for a wrong model.
- Standard errors of parameters: if a parameter’s error is larger than its value, the data do not determine it.
- Residual plot: random scatter is good; systematic curves indicate a missing feature.
- AIC lets you compare models fitted to the same data; lower is better, and a difference of more than about 2 is meaningful.
- Extrapolation beyond the data is risky, especially for growth models that have not yet shown their plateau.
Where Nonlinear Regression Is Used
Growth and saturation curves
Fitting logistic or similar S-shaped data.
Enzyme kinetics
Estimating Michaelis-Menten parameters from rate data.
Parameter uncertainty
Getting standard errors for each fitted parameter.
Model checking
Using the residual plot to see whether the model is adequate.
Common Nonlinear Regression Mistakes to Avoid
- Plot the data first and choose the model by the shape and the science.
- Provide starting values when the automatic ones fail.
- Use as many points as you can, especially around the bend of the curve.
- For logistic and Gompertz fits, data should cover the plateau, otherwise the plateau estimate is very uncertain.
Nonlinear Regression Terms and Definitions
- Jacobian
- The matrix of partial derivatives of the model with respect to each parameter.
- Convergence
- The point at which further steps no longer reduce the error.
- Asymptote
- The value a curve approaches but does not reach.
Nonlinear Regression FAQs
What is non-linear regression?
Fitting a model that is non-linear in its parameters to data by choosing the parameters that minimise the sum of squared errors.
What is the Levenberg-Marquardt algorithm?
An iterative method that blends Gauss-Newton and gradient descent steps, and is the standard for non-linear least squares.
Why did my fit fail or look wrong?
Usually the starting values are poor or the model does not suit the data. Try your own starting values or another model.
How do I fit a logistic growth curve?
Choose the logistic model. The three parameters are the upper limit L, the growth rate k and the midpoint x₀.
Can I compare models?
Yes. Fit each model to the same data and compare AIC, R² and the residual plots. Lower AIC is better.
What do the parameter standard errors mean?
They measure how precisely the data determine each parameter, assuming the model is right and errors are roughly normal.
What is the difference from the curve fitting calculator?
Curve fitting compares polynomial, exponential, power and log families, mostly via linear methods. This tool fits genuinely non-linear models by iterative least squares.