MATLAB Examples

# Compute Coefficient Confidence Intervals

This example shows how to compute coefficient confidence intervals.

Load the sample data and fit a linear regression model.

load hald mdl = fitlm(ingredients,heat); 

Display the 95% coefficient confidence intervals.

coefCI(mdl) 
ans = -99.1786 223.9893 -0.1663 3.2685 -1.1589 2.1792 -1.6385 1.8423 -1.7791 1.4910 

The values in each row are the lower and upper confidence limits, respectively, for the default 95% confidence intervals for the coefficients. For example, the first row shows the lower and upper limits, -99.1786 and 223.9893, for the intercept, . Likewise, the second row shows the limits for and so on.

Display the 90% confidence intervals for the coefficients ( = 0.1).

coefCI(mdl,0.1) 
ans = -67.8949 192.7057 0.1662 2.9360 -0.8358 1.8561 -1.3015 1.5053 -1.4626 1.1745 

The confidence interval limits become narrower as the confidence level decreases.