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

    %% Determine Observations Influential on Coefficients Using Dfbetas  
% This example shows how to determine the observations that have large influence
% on coefficients using |Dfbetas|.   Load the sample data and define the
% response and independent variables. 

% Copyright 2015 The MathWorks, Inc.

load hospital
y = hospital.BloodPressure(:,1);
X = double(hospital(:,2:5)); 

%% 
% Fit a linear regression model. 
mdl = fitlm(X,y);  

%% 
% Find the |Dfbetas| values that are high in absolute value. 
[row,col] = find(abs(mdl.Diagnostics.Dfbetas)>3/sqrt(100));
disp([row col])