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

NonlinearModelFit

NonlinearModelFit
constructs a nonlinear model with structure form that fits the for successive x values , , ... using the parameters , ....
NonlinearModelFit
constructs a nonlinear model where form depends on the variables .
NonlinearModelFit
constructs a nonlinear model subject to the parameter constraints cons.
  • NonlinearModelFit returns a symbolic FittedModel object to represent the linear model it constructs. The properties and diagnostics of the model can be obtained from model["property"].
  • The value of the best-fit function from NonlinearModelFit at a particular point , ... can be found from .
  • With data in the form , the number of coordinates , , ... should equal the number of variables .
  • Data in the form is equivalent to data in the form .
  • NonlinearModelFit produces a nonlinear model of the form under the assumption that the original are independent normally distributed with mean and common standard deviation.
AccuracyGoalAutomaticthe number of digits of accuracy sought
ConfidenceLevel95/100confidence level for parameters and predictions
EvaluationMonitorNoneexpression to evaluate whenever expr is evaluated
MaxIterationsAutomaticmaximum number of iterations to use
MethodAutomaticmethod to use
PrecisionGoalAutomaticthe precision sought
StepMonitorNonethe expression to evaluate whenever a step is taken
VarianceEstimatorFunctionAutomaticfunction for estimating the error variance
WeightsAutomaticweights for data elements
WorkingPrecisionAutomaticthe precision used in internal computations
  • With ConfidenceLevel->p, probability-p confidence intervals are computed for parameter and prediction intervals.
  • With the setting Weights, the error variance for is assumed to be . By default unit weights are used.
  • With the setting VarianceEstimatorFunction->f, the common variance is estimated by where is the list of residuals and w is the list of weights.
  • Using VarianceEstimatorFunction and Weights, is treated as the known uncertainty of measurement and parameter standard errors are effectively computed only from the weights.
  • Possible settings for Method include , , , , , and , with the default being Automatic.
  • For constrained models, properties based on approximate normality assumptions may not be valid. When such values are computed, the values are generated along with a warning message.
  • Properties related to data and the fitted function using model["property"] include:
"BestFit"fitted function
"BestFitParameters"parameter estimates
"Data"the input data or design matrix and response vector
"Function"best-fit pure function
"Response"response values in the input data
  • Types of residuals include:
"FitResiduals"difference between actual and predicted responses
"StandardizedResiduals"fit residuals divided by the standard error for each residual
"StudentizedResiduals"fit residuals divided by single deletion error estimates
  • Properties related to the sum of squared errors include:
"ANOVATable"analysis of variance table
"ANOVATableDegreesOfFreedom"degrees of freedom from the ANOVA table
"ANOVATableEntries"unformatted array of values from the table
"ANOVATableMeanSquares"mean square errors from the table
"ANOVATableSumsOfSquares"sums of squares from the table
"EstimatedVariance"estimate of the error variance
  • Properties and diagnostics for parameter estimates include:
"CorrelationMatrix"asymptotic parameter correlation matrix
"CovarianceMatrix"asymptotic parameter covariance matrix
"ParameterBias"estimated bias in the parameter estimates
"ParameterConfidenceIntervals"parameter confidence intervals
"ParameterConfidenceIntervalTable"table of confidence interval information for the fitted parameters
"ParameterConfidenceIntervalTableEntries"unformatted array of values from the table
"ParameterConfidenceRegion"ellipsoidal parameter confidence region
"ParameterErrors"standard errors for parameter estimates
"ParameterPValues"-values for parameter -statistics
"ParameterTable"table of fitted parameter information
"ParameterTableEntries"unformatted array of values from the table
"ParameterTStatistics"-statistics for parameter estimates
  • Properties for curvature diagnostics include:
"CurvatureConfidenceRegion"confidence region for curvature diagnostics
"FitCurvatureTable"table of curvature diagnostics
"FitCurvatureTableEntries"unformatted array of values from the table
"MaxIntrinsicCurvature"measure of maximum intrinsic curvature
"MaxParameterEffectsCurvature"measure of maximum parameter effects curvature
  • Properties related to influence measures include:
"HatDiagonal"diagonal elements of the hat matrix
"SingleDeletionVariances"list of variance estimates with the ^(th) data point omitted
  • Properties of predicted values include:
"MeanPredictionBands"confidence bands for mean predictions
"MeanPredictionConfidenceIntervals"confidence intervals for the mean predictions
"MeanPredictionConfidenceIntervalTable"table of confidence intervals for the mean predictions
"MeanPredictionConfidenceIntervalTableEntries"unformatted array of values from the table
"MeanPredictionErrors"standard errors for mean predictions
"PredictedResponse"fitted values for the data
"SinglePredictionBands"confidence bands based on single observations
"SinglePredictionConfidenceIntervals"confidence intervals for the predicted response of single observations
"SinglePredictionConfidenceIntervalTable"table of confidence intervals for the predicted response of single observations
"SinglePredictionConfidenceIntervalTableEntries"unformatted array of values from the table
"SinglePredictionErrors"standard errors for the predicted response of single observations
  • Properties that measure goodness of fit include:
"AdjustedRSquared" adjusted for the number of model parameters
"AIC"Akaike Information Criterion
"BIC"Bayesian Information Criterion
"RSquared"coefficient of determination
Fit a nonlinear model to some data:
Obtain the functional form:
Evaluate the model at a point:
Visualize the fitted function with the data:
Extract and plot the residuals:
Fit a nonlinear model to some data:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Obtain the functional form:
In[3]:=
Click for copyable input
Out[3]=
Evaluate the model at a point:
In[4]:=
Click for copyable input
Out[4]=
Visualize the fitted function with the data:
In[5]:=
Click for copyable input
Out[5]=
Extract and plot the residuals:
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
Fit a model of more than one variable:
Give starting values when parameters are far from the default value 1:
With the default starting values, the model is effectively 0:
Obtain a list of available properties for a nonlinear model:
Fit a nonlinear model:
Extract the original data:
Obtain and plot the best fit:
Obtain the fitted function as a pure function:
Examine residuals for a fit:
Visualize the raw residuals:
Visualize scaled residuals in stem plots:
Plot the absolute differences between the standardized and Studentized residuals:
Fit a nonlinear model to some data:
Extract the estimated error variance:
Obtain the analysis of variance table:
Get the sums of squares column from the table:
Extract the numeric entries from the table:
Use Grid to add formatting:
Obtain a formatted table of parameter information:
Extract the column of -statistic values:
Get the unformatted array of values from the table:
Add formatting using Grid:
Add formatting via TableForm:
Fit a nonlinear model to some data:
Obtain a table of curvature measures for the fitted model:
Extract the list of numeric values from the table:
Extract the max parameter effects curvature value:
Fit some data containing extreme values to a nonlinear model:
Use single deletion variances to check the impact on the error variance of removing each point:
Check the diagonal elements of the hat matrix to assess influence of points on the fitting:
Fit a nonlinear model:
Plot the predicted values against the observed values:
Obtain tabular results for mean and single-prediction confidence intervals:
Get the single-prediction intervals from the table:
Extract 99% mean prediction bands:
Obtain a table of goodness-of-fit measures for a nonlinear model:
Fit data to a model defined by a numerical operation:
Make the computation much faster by caching solutions of the differential equation:
Perform other mathematical operations on the functional form of the model:
Integrate symbolically and numerically:
Find a predictor value that gives a particular value for the model:
The default gives 95% confidence intervals:
Use 99% intervals instead:
Set the level to 90% within FittedModel:
Use the default unbiased estimate of error variance:
Assume a known error variance:
Estimate the variance by the mean squared error:
Fit a model using equal weights:
Give explicit weights for the data points:
Use WorkingPrecision to get higher precision in parameter estimates:
Obtain the fitted function:
Reduce the precision in property computations after the fitting:
Simulate some data:
Fit a nonlinear model to the data:
Obtain 90%, 95%, 99%, and 99.9% confidence bands:
Visualize the confidence bands with the model and data:
NonlinearModelFit fits linear and nonlinear models assuming normally distributed errors:
LinearModelFit fits linear models assuming normally distributed errors:
FindFit and NonlinearModelFit fit equivalent models:
NonlinearModelFit allows for extraction of additional information about the fitting:
NonlinearModelFit assumes normally distributed responses:
LogitModelFit assumes binomially distributed responses:
The fits are not identical:
The same is true for ProbitModelFit:
Distributional assumptions are based upon an unconstrained model:
Here the confidence interval for contains points that violate the constraint:
New in 7