www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeCoefficientConfidenceIntervalsExample.m

    %% Compute Coefficient Confidence Intervals  
% This example shows how to compute coefficient confidence intervals.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Load the sample data and fit a linear regression model. 
load hald
mdl = fitlm(ingredients,heat);  

%% 
% Display the 95% coefficient confidence intervals. 
coefCI(mdl) 

%%
% 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, $\beta_0$ . Likewise, the second row shows
% the limits for $\beta_1$ and so on.  

%% 
% Display the 90% confidence intervals for the coefficients ($\alpha$ = 0.1). 
coefCI(mdl,0.1) 

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