Main Content

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.

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.

Note

confint cannot compute confidence intervals for non-parametric fittypes such as Interpolant, Lowess, and Spline.

example

Examples

collapse all

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

load census

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.

Limitations

If one or more coefficients are active at a lower or upper coefficient constraint bound, or if constraint points are specified, those coefficient estimates are regarded as fixed at bounds and the confidence interval values are NaN.

More About

collapse all

Version History

Introduced before R2006a