Confidence intervals for fit coefficients of cfit
or
sfit
object
ci = confint(fitresult)
ci = confint(fitresult,level)
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
.
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+004 (1.964e+004, 2.262e+004) ci = confint(fitresult,0.95) ci = 0.0061242 -25.086 19641 0.0069581 -21.934 22618
Note that fit
and confint
display the
confidence bounds in slightly different formats.
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'
.