nlpredci - Nonlinear regression prediction confidence intervals

Syntax

[ypred,delta] = nlpredci(modelfun,x,beta,resid,'covar',sigma)
[ypred,delta] = nlpredci(modelfun,x,beta,resid,'jacobian',J)
[...] = nlpredci(...,param1,val1,param2,val2,...)

Description

[ypred,delta] = nlpredci(modelfun,x,beta,resid,'covar',sigma) returns predictions, ypred, and 95% confidence interval half-widths, delta, for the nonlinear regression model defined by modelfun, at input values x. modelfun is a function handle, specified using @, that accepts two arguments—a coefficient vector and the array x—and returns a vector of fitted y values. Before calling nlpredci, use nlinfit to fit modelfun by nonlinear least squares and get estimated coefficient values beta, residuals resid, and estimated coefficient covariance matrix sigma.

[ypred,delta] = nlpredci(modelfun,x,beta,resid,'jacobian',J) is an alternative syntax that also computes 95% confidence intervals. J is the Jacobian computed by nlinfit. If the 'robust' option is used with nlinfit, use the 'covar' input rather than the 'jacobian' input so that the required sigma parameter takes the robust fitting into account.

[...] = nlpredci(...,param1,val1,param2,val2,...) accepts optional parameter name/value pairs.

Name

Value

'alpha'

A value between 0 and 1 that specifies the confidence level as 100(1-alpha)%. Default is 0.05.

'mse'

The mean squared error returned by nlinfit. This is required to predict new observations (see 'predopt') if the robust option is used with nlinfit; otherwise, the 'mse' is computed from the residuals and does not take the robust fitting into account.

'predopt'

Either 'curve' (the default) to compute confidence intervals for the estimated curve (function value) at x, or 'observation' for prediction intervals for a new observation at x. If 'observation'is specified after using a robust option with nlinfit, the 'mse' parameter must be supplied to specify the robust estimate of the mean squared error.

'simopt'

Either 'on' for simultaneous bounds, or 'off' (the default) for nonsimultaneous bounds.

nlpredci treats NaNs in resid or J as missing values, and ignores the corresponding observations.

The confidence interval calculation is valid for systems where the length of resid exceeds the length of beta and J has full column rank at beta. When J is ill-conditioned, predictions and confidence intervals may be inaccurate.

Example

Continuing the example from nlinfit, you can determine the predicted function value at the value newX and the half-width of a confidence interval for it.

load reaction;

[beta,resid,J] = nlinfit(reactants,rate,@hougen,beta);

newX = reactants(1:2,:);
[ypred,delta] = nlpredci(@hougen,newX,beta,resid,J)
ypred =
    8.4179
    3.9542
delta =
    0.2805
    0.2474

See Also

nlinfit, nlparci

  


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