Main Content

coefCI

Confidence intervals of coefficient estimates of nonlinear regression model

Description

example

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

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

Examples

collapse 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 = 4×2

   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.

ci(4,:)
ans = 1×2
10-4 ×

    0.4048    0.6663

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

Input Arguments

collapse all

Nonlinear regression model object, specified as a NonLinearModel object created by using fitnlm.

Significance level for the confidence interval, specified as a numeric value in the range [0,1]. The confidence level of ci is equal to 100(1 – alpha)%. alpha is the probability that the confidence interval does not contain the true value.

Example: 0.01

Data Types: single | double

Output Arguments

collapse all

Confidence intervals, returned as a k-by-2 numeric matrix, where k is the number of coefficients. The jth row of ci is the confidence interval of the jth coefficient of mdl. The name of coefficient j is stored in the CoefficientNames property of mdl.

Data Types: single | double

More About

collapse all

Confidence Interval

The coefficient confidence intervals provide a measure of precision for regression coefficient estimates.

A 100(1 – α)% confidence interval gives the range for the corresponding regression coefficient with 100(1 – α)% confidence, meaning that 100(1 – α)% of the intervals resulting from repeated experimentation will contain the true value of the coefficient.

The software finds confidence intervals using the Wald method. The 100(1 – α)% confidence intervals for regression coefficients are

bi±t(1α/2,np)SE(bi),

where bi is the coefficient estimate, SE(bi) is the standard error of the coefficient estimate, and t(1–α/2,np) is the 100(1 – α/2) percentile of the t-distribution with n – p degrees of freedom. n is the number of observations and p is the number of regression coefficients.

Version History

Introduced in R2012a