confint

Confidence intervals for fit coefficients of cfit or sfit object

Description

ci = confint(fitresult) returns 95% confidence bounds ci on the coefficients associated with the cfit or sfit object fitresult. fitresult must be an output from the fit function to contain the necessary information for ci. ci is a 2-by-n array where n = numcoeffs(fitresult). The top row of ci contains the lower bound for each coefficient; the bottom row contains the upper bound.

example

ci = confint(fitresult,level) returns confidence bounds at the confidence level specified by level. level must be between 0 and 1. The default value of level is 0.95.

Examples

collapse all

Load the data and call the fit function to obtain the fitresult information.

fitresult = fit(cdate,pop,'poly2')
fitresult =

Linear model Poly2:
fitresult(x) = p1*x^2 + p2*x + p3
Coefficients (with 95% confidence bounds):
p1 =    0.006541  (0.006124, 0.006958)
p2 =      -23.51  (-25.09, -21.93)
p3 =   2.113e+04  (1.964e+04, 2.262e+04)

To obtain the confidence intervals, call the confint function on fitresult.

ci = confint(fitresult,0.95)
ci =

0.0061242      -25.086        19641
0.0069581      -21.934        22618

fit and confint display the confidence bounds in slightly different formats.

Input Arguments

collapse all

Fit information for confidence bounds calculation, specified as a cfit or sfit object. fitresult must be an output from the fit function.

Confidence level, specified as a scalar. This argument must be between 0 and 1

Data Types: single | double

Output Arguments

collapse all

Confidence bounds on the coefficients associated with the cfit or sfit object fitresult, returned as a matrix.

Tips

To calculate confidence bounds, confint uses R-1 (the inverse R factor from QR decomposition of the Jacobian), the degrees of freedom for error, and the root mean squared error. This information is automatically returned by the fit function and contained within fitresult.

If coefficients are bounded and one or more of the estimates are at their bounds, those estimates are regarded as fixed and do not have confidence bounds.

Note that you cannot calculate confidence bounds if category(fitresult) is 'spline' or 'interpolant'.