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

    %% Confidence Intervals with Specified Options  

%% 
% Load the sample data. 
load carbig  

%% 
% Fit a linear mixed-effects model for miles per gallon (MPG), with fixed
% effects for acceleration and horsepower, and a potentially correlated
% random effect for intercept and acceleration grouped by model year. First,
% store the data in a table. 
tbl = table(Acceleration,Horsepower,Model_Year,MPG);  

%% 
% Fit the model. 
lme = fitlme(tbl, 'MPG ~ Acceleration + Horsepower + (Acceleration|Model_Year)');  

%% 
% Compute the fixed-effects coefficient estimates. 
fe = fixedEffects(lme)  

%% 
% Compute the 99% confidence intervals for fixed-effects coefficients using
% the residuals method to determine the degrees of freedom. This is the
% default method. 
feCI = coefCI(lme,'Alpha',0.01)  

%% 
% Compute the 99% confidence intervals for fixed-effects coefficients using
% the Satterthwaite approximation to compute the degrees of freedom. 
feCI = coefCI(lme,'Alpha',0.01,'DFMethod','satterthwaite') 

%%
% The Satthertwaite approximation produces similar confidence intervals
% than the residual method.