Main Content

confint

Confidence intervals for fit coefficients ofcfitorsfitobject

Description

ci= confint(fitresult)returns 95% confidence boundscion the coefficients associated with thecfitorsfitobjectfitresultfitresultmust be an output from thefitfunction to contain the necessary information forciciis a 2-by-narray wheren = numcoeffs(fitresult)。第一行的cicontains 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 bylevellevelmust be between0and1。The default value oflevelis0.95

Examples

collapse all

Load the data and call thefitfunction to obtain thefitresultinformation.

loadcensusfitresult = 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 theconfintfunction onfitresult

ci = confint(fitresult,0.95)
ci = 0.0061242 -25.086 19641 0.0069581 -21.934 22618

fitandconfintdisplay the confidence bounds in slightly different formats.

Input Arguments

collapse all

Fit information for confidence bounds calculation, specified as acfitorsfitobject.fitresultmust be an output from thefitfunction.

Confidence level, specified as a scalar. This argument must be between0and1

Data Types:single|double

Output Arguments

collapse all

Confidence bounds on the coefficients associated with thecfitorsfitobjectfitresult, returned as a matrix.

Tips

To calculate confidence bounds,confintusesR-1(the inverseRfactor fromQRdecomposition of the Jacobian), the degrees of freedom for error, and the root mean squared error. This information is automatically returned by thefitfunction and contained withinfitresult

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 ifcategory(fitresult)is'spline'or'interpolant'

Introduced before R2006a