nlinfit - Nonlinear regression

Syntax

b = nlinfit(X,y,fun,b0)
[b,r,J,COVB,mse] = nlinfit(X,y,fun,b0)
[...] = nlinfit(X,y,fun,b0,options)

Description

b = nlinfit(X,y,fun,b0) returns a p-by-1 vector b of coefficient estimates for a nonlinear regression of the responses in y on the predictors in X using the model specified by fun. X is an n-by-p matrix of p predictors at each of n observations. y is an n-by-1 vector of observed responses. fun is a function handle, specified using the @ sign (as in @myfun) to a function of the form

yhat = myfun(b,X)

where b is a coefficient vector. b0 is a vector containing initial values for the coefficients.

[b,r,J,COVB,mse] = nlinfit(X,y,fun,b0) returns the fitted coefficients b, the residuals r, the Jacobian J of fun, the estimated covariance matrix COVB for the fitted coefficients, and an estimate mse of the variance of the error term. You can use these outputs with nlpredci to produce error estimates on predictions, and with nlparci to produce error estimates on the estimated coefficients. If you use the robust fitting option (see below), you must use COVB and may need mse as input to nlpredci or nlparci to insure that the confidence intervals take the robust fit properly into account.

[...] = nlinfit(X,y,fun,b0,options) specifies control parameters for the algorithm used in nlinfit. options is a structure created by a call to statset. Applicable statset parameters are:

nlinfit treats NaNs in y or fun(b,X) as missing data and ignores the corresponding rows.

nlintool is a graphical user interface to nlinfit.

Example

The data in reaction.mat are partial pressures of three chemical reactants and the corresponding reaction rates. The function hougen implements the nonlinear Hougen-Watson model for reaction rates. The following fits the model to the data:

load reaction

betahat = nlinfit(reactants,rate,@hougen,beta)
betahat =
    1.2526
    0.0628
    0.0400
    0.1124
    1.1914

Reference

[1] Seber, G. A. F., and C. J. Wild, Nonlinear Regression, John Wiley & Sons Inc., 1989.

See Also

nlparci, nlpredci, nlintool

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS