optim_doc: nlinfit

Previous: lsqcurvefit, Up: Compatibility wrappers [Index]

### 7.5 Non-linear regression.

This function is for Matlab compatibility. It attempts to work like `nlinfit` by calling nonlin_curvefit and curvefit_stat.

Function File: nlinfit (X, Y, modelfun, beta0)
Function File: nlinfit (X, Y, modelfun, beta0, options)
Function File: nlinfit (…, Name, Value)
Function File: [beta, R, J, CovB, MSE] = nlinfit (…)

  Nonlinear Regression.

      min [EuclidianNorm (Y - modelfun (beta, X))] ^ 2
      beta

  X is a matrix of independents, Y is the observed output and modelfun is the nonlinear regression model function. modelfun should be specified as a function handle, which accepts two inputs: an array of coefficients and an array of independents – in that order. The first four input arguments must be provided with non-empty initial guess of the coefficients beta0. Y and X must be the same size as the vector (or matrix) returned by fun. options is a structure containing estimation algorithm options. It can be set using `statset`. Follwing Matlab compatible options are recognized:

  `TolFun` Minimum fractional improvement in objective function in an iteration (termination criterium). Default: 1e-6.

  `MaxIter` Maximum number of iterations allowed. Default: 400.

  `DerivStep` Step size factor. The default is eps^(1/3) for finite differences gradient calculation.

  `Display` String indicating the degree of verbosity. Default: "off". Currently only supported values are "off" (no messages) and "iter" (some messages after each iteration).

  Optional Name, Value pairs can be provided to set additional options. Currently the only applicable name-value pair is ’Weights’, w, where w is the array of real positive weight factors for the squared residuals.

  Returned values:

  beta

    Coefficients to best fit the nonlinear function modelfun (beta, X) to the observed values Y.

  R

    Value of solution residuals: `modelfun (beta, X) - Y`. If observation weights are specified then R is the array of weighted residuals: `sqrt (weights) .* modelfun (beta, X) - Y`.

  J

    A matrix where `J(i,j)` is the partial derivative of `modelfun(i)` with respect to `beta(j)`. If observation weights are specified, then J is the weighted model function Jacobian: `diag (sqrt (weights)) * J`.

  CovB

    Estimated covariance matrix of the fitted coefficients.

  MSE

    Scalar valued estimate of the variance of error term. If the model Jacobian is full rank, then MSE = (R’ * R)/(N-p), where N is the number of observations and p is the number of estimated coefficients.

  This function is a compatibility wrapper. It calls the more general `nonlin_curvefit` and `curvefit_stat` functions internally.

  See also: nonlin_residmin, nonlin_curvefit, residmin_stat, curvefit_stat.

Previous: lsqcurvefit, Up: Compatibility wrappers [Index]