This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

NonlinearRegress

NonlinearRegress[data, expr, pars, vars]
finds numerical values of the parameters pars that make the model expr give a best fit to data as a function of vars and provides diagnostics for the fitting.
NonlinearRegress[data, {expr, cons}, pars, vars]
finds a best fit and provides diagnostics subject to the constraints cons.
  • The data can have the form {{x1, y1, ..., f1}, {x2, y2, ..., f2}, ...}, where the number of coordinates x, y, ... is equal to the number of variables in the list vars.
  • The data can also be of the form {f1, f2, ...}, with a single coordinate assumed to take values 1, 2, ....
  • The model expr must yield a numerical value when pars and vars are all numerical.
  • The estimates of the model parameters give a least-squares fit, minimizing the sum of squared residuals.
  • NonlinearRegress returns a list of rules for results and diagnostics specified by the option RegressionReport.
  • The model expr must yield a numerical value when pars and vars are all numerical.
  • For constrained models, the constraints cons can contain equations, inequalities, or logical combinations of equations and inequalities.
  • Parameters are specified using the same syntax as in FindFit.
  • The results found by NonlinearRegress may correspond only to a local optimum.
  • The following options can be given:
AccuracyGoalAutomaticthe accuracy sought
CompiledAutomaticwhether to compile the model
ConfidenceLevel0.95confidence level for confidence intervals
GradientAutomaticlist of gradient functions
MaxIterations100maximum number of iterations to use
MethodAutomaticmethod to use
PrecisionGoalAutomaticthe precision sought
RegressionReportSummaryReportfit diagnostics to include
ToleranceAutomaticnumerical tolerance for matrix operations
WeightsAutomaticlist of weights for each point or pure function
WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • Possible settings for Weights are Automatic, a list of numbers with the same length as data, or a pure function.
  • With the default setting Weights->Automatic, each data point is given a weight of 1.
  • With the setting Weights->g, the weight associated with each point is g[fi, xi, yi, ...].
  • For constrained models, RegressionReport values based on approximate normality assumptions may not be valid. When such values are included, the values will be generated along with a warning message.
Needs["NonlinearRegression`"]
Nonlinear regression with parameters a and b:
In[2]:=
Click for copyable input
Out[2]=