Nonlinear Regression Calculator

This nonlinear regression calculator fits curved models by true non-linear least squares using the Levenberg-Marquardt algorithm. You get fitted parameters with standard errors, R², AIC and a residual plot.

Same number of values as x.

Leave blank to use automatic starting values.

Checks on your data

  • S-shaped fits need data on both sides of the bend. If the data stop before the plateau, the upper limit is mostly a guess.

Results

Fitted equation
y = 76.006 / (1 + e^(−0.73507(x − 5.0152)))
Parameter L
76.00643
± 0.182 (standard error)
Parameter k
0.7350666
± 0.00495 (standard error)
Parameter x₀
5.015195
± 0.0119 (standard error)
R²
0.99996
SSE
0.302047
RMSE
0.16571
Residual standard error
0.19431
df = 8
AIC
-33.546
Converged
Yes
Data and fitted curve (R² = 1)
0500246810xy
Residuals: look for patterns that suggest a poor model
-0.200.20246810xresidual
Observed, fitted and residual
xyFittedResidual
02.11.85810.2419
13.93.77510.1249
27.67.47070.1293
314.214.0790.1213
424.124.447-0.3469
537.837.7910.009015
651.251.1880.01236
761.961.670.2303
868.468.3840.01609
97272.15-0.1503
1074.174.107-0.007381
Show step-by-step solution
  1. Model: Logistic y = L / (1 + e^(−k(x − x₀))), with 3 parameters (L, k, x₀).
  2. Starting values: L = 81.51, k = 0.4, x₀ = 5.
  3. Levenberg-Marquardt iterations adjust the parameters to reduce the sum of squared errors, blending Gauss-Newton steps with gradient descent for stability.
  4. Final SSE = 0.302047; R² = 0.99996.
  5. Standard errors come from the Jacobian at the solution: SE(pⱼ) = s √[(JᵀJ)⁻¹]ⱼⱼ.
MethodLevenberg-Marquardt least squares
ModelsExp, logistic, power, MM, Gompertz
OutputParameters ± SE, R², residuals
TipGood starting values help

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

  1. Choose the model that matches the shape of your data and the underlying process.
  2. Enter x and y values in matching order; you need at least one more point than the model has parameters.
  3. Leave the starting values blank, or supply your own if the fit fails to converge.
  4. 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

S(β)=∑i(yi−f(xi,β))2S(\boldsymbol\beta)=\sum_{i}\bigl(y_i-f(x_i,\boldsymbol\beta)\bigr)^2

Levenberg-Marquardt update

(JTJ+λ diag(JTJ)) δ=JTr(\mathbf J^T\mathbf J+\lambda\,\mathrm{diag}(\mathbf J^T\mathbf J))\,\boldsymbol\delta=\mathbf J^T\mathbf r

Logistic

y=L1+e−k(x−x0)y=\frac{L}{1+e^{-k(x-x_0)}}

Michaelis-Menten

v=Vmax [S]Km+[S]v=\frac{V_{max}\,[S]}{K_m+[S]}

Gompertz

y=a e−b e−cxy=a\,e^{-b\,e^{-cx}}

Nonlinear Regression Variables Explained

SymbolMeaningNotes
x, yYour paired data
θModel parametersEstimated by the fit
SSESum of squared errorsThe quantity minimised
λDamping parameterUsed by Levenberg-Marquardt
R², AICFit measures

Nonlinear Regression Worked Example

Using the example values (press “Load example” above to try them):

  1. Model: Logistic y = L / (1 + e^(−k(x − x₀))), with 3 parameters (L, k, x₀).
  2. Starting values: L = 81.51, k = 0.4, x₀ = 5.
  3. Levenberg-Marquardt iterations adjust the parameters to reduce the sum of squared errors, blending Gauss-Newton steps with gradient descent for stability.
  4. Final SSE = 0.302047; R² = 0.99996.
  5. 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

Shapes and typical uses
ModelShapeTypical uses
Exponential a·e^(bx)Unbounded growth or decayEarly epidemic growth, compound interest
Exponential with offsetGrowth or decay to or from a baselineCooling, charging a capacitor
Power a·x^bCurved, no inflectionAllometry, scaling laws
LogisticS-shape, symmetricPopulation growth, technology adoption, dose response
GompertzS-shape, asymmetricTumour growth, mortality, market saturation
Michaelis-MentenRises and saturatesEnzyme kinetics, Langmuir adsorption
Decay to baselineFalls to a plateauDrug 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.

Related calculators

Last updated 2026-11-09. See our disclaimer.