This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Class: NonLinearModel

Confidence intervals of coefficient estimates of nonlinear regression model


ci = coefCI(mdl)
ci = coefCI(mdl,alpha)


ci = coefCI(mdl) returns confidence intervals for the coefficients in mdl.

ci = coefCI(mdl,alpha) returns confidence intervals with confidence level 1 - alpha.

Input Arguments


Nonlinear regression model, constructed by fitnlm.


Scalar from 0 to 1, the probability that the confidence interval does not contain the true value.

Default: 0.05

Output Arguments


k-by-2 matrix of confidence intervals. The jth row of ci is the confidence interval of coefficient j of mdl. The name of coefficient j of mdl is in mdl.CoefNames.


Confidence Interval

Assume that model assumptions hold (the data comes from a model represented by the formula mdl.Formula, with independent normally distributed errors). Then row j of the confidence interval matrix ci gives a confidence interval [ci(j,1),ci(j,2)] that contains coefficient j with probability 1 - alpha.


expand all

Create a nonlinear model for auto mileage based on the carbig data. Then obtain confidence intervals for the resulting model coefficients.

Load the data and create a nonlinear model.

load carbig
ds = dataset(Horsepower,Weight,MPG);
modelfun = @(b,x)b(1) + b(2)*x(:,1) + ...
    b(3)*x(:,2) + b(4)*x(:,1).*x(:,2);
beta0 = [1 1 1 1];
mdl = fitnlm(ds,modelfun,beta0)
mdl = 

Nonlinear regression model:
    MPG ~ b1 + b2*Horsepower + b3*Weight + b4*Horsepower*Weight

Estimated Coefficients:
          Estimate      SE            tStat      pValue    
    b1        63.558        2.3429     27.127    1.2343e-91
    b2      -0.25084      0.027279    -9.1952    2.3226e-18
    b3     -0.010772    0.00077381    -13.921    5.1372e-36
    b4    5.3554e-05    6.6491e-06     8.0542    9.9336e-15

Number of observations: 392, Error degrees of freedom: 388
Root Mean Squared Error: 3.93
R-Squared: 0.748,  Adjusted R-Squared 0.746
F-statistic vs. constant model: 385, p-value = 7.26e-116

All the coefficients have extremely small p-values. This means a confidence interval around the coefficients will not contain the point 0, unless the confidence level is very high.

Find 95% confidence intervals for the coefficients of the model.

ci = coefCI(mdl)
ci =

   58.9515   68.1644
   -0.3045   -0.1972
   -0.0123   -0.0093
    0.0000    0.0001

The confidence interval for b4 seems to contain 0. Examine it in more detail.

ans =
   1.0e-04 *
    0.4048    0.6663

As expected, the confidence interval does not contain the point 0.

Related Examples


You can create the intervals from the model coefficients in mdl.Coefficients.Estimate and an appropriate multiplier of the standard errors sqrt(diag(mdl.CoefficientCovariance)). The multiplier is tinv(1-alpha/2,dof), where level is the confidence level, and dof is the degrees of freedom (number of data points minus the number of coefficients).

Was this topic helpful?