nlinfit
Nonlinear regression
Syntax
Description
returns
a vector of estimated coefficients for the nonlinear regression of
the responses in beta
= nlinfit(X
,Y
,modelfun
,beta0
)Y
on the predictors in X
using
the model specified by modelfun
. The coefficients
are estimated using iterative least squares estimation, with initial
values specified by beta0
.
uses
additional options specified by one or more name-value pair arguments.
For example, you can specify observation weights or a nonconstant
error model. You can use any of the input arguments in the previous
syntaxes.beta
= nlinfit(___,Name,Value
)
[
additionally returns the residuals, beta
,R
,J
,CovB
,MSE
,ErrorModelInfo
]
= nlinfit(___)R
,
the Jacobian of modelfun
, J
,
the estimated variance-covariance matrix for the estimated coefficients, CovB
,
an estimate of the variance of the error term, MSE
,
and a structure containing details about the error model, ErrorModelInfo
.
Examples
Input Arguments
Output Arguments
More About
Tips
To produce error estimates on predictions, use the optional output arguments
R
,J
,CovB
, orMSE
as inputs tonlpredci
.To produce error estimates on the estimated coefficients,
beta
, use the optional output argumentsR
,J
,CovB
, orMSE
as inputs tonlparci
.If you use the robust fitting option,
RobustWgtFun
, you must useCovB
—and might needMSE
—as inputs tonlpredci
ornlparci
to ensure that the confidence intervals take the robust fit properly into account.
Algorithms
nlinfit
treatsNaN
values inY
ormodelfun(beta0,X)
as missing data, and ignores the corresponding observations.For nonrobust estimation,
nlinfit
uses the Levenberg-Marquardt nonlinear least squares algorithm [1].For robust estimation,
nlinfit
uses the algorithm of Iteratively Reweighted Least Squares ([2], [3]). At each iteration, the robust weights are recalculated based on each observation’s residual from the previous iteration. These weights downweight outliers, so that their influence on the fit is decreased. Iterations continue until the weights converge.When you specify a function handle for observation weights, the weights depend on the fitted model. In this case,
nlinfit
uses an iterative generalized least squares algorithm to fit the nonlinear regression model.
References
[1] Seber, G. A. F., and C. J. Wild. Nonlinear Regression. Hoboken, NJ: Wiley-Interscience, 2003.
[2] DuMouchel, W. H., and F. L. O'Brien. “Integrating a Robust Option into a Multiple Regression Computing Environment.” Computer Science and Statistics: Proceedings of the 21st Symposium on the Interface. Alexandria, VA: American Statistical Association, 1989.
[3] Holland, P. W., and R. E. Welsch. “Robust Regression Using Iteratively Reweighted Least-Squares.” Communications in Statistics: Theory and Methods, A6, 1977, pp. 813–827.
Version History
Introduced before R2006a