www.gusucode.com > stats 源码程序 matlab案例代码 > stats/DetermineObservationsInfluentialonFittedResponseUsingDffExample.m
%% Determine Observations Influential on Fitted Response Using Dffits % This example shows how to determine the observations that are influential % on the fitted response values using |Dffits| values. 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); %% % Plot the Dffits values. plotDiagnostics(mdl,'Dffits') %% % The influential threshold limit for the absolute value of Dffits in this % example is 2*sqrt(5/100) = 0.45. Again, there are some observations with % Dffits values beyond the recommended limits. %% % Find the Dffits values that are large in absolute value. find(abs(mdl.Diagnostics.Dffits)>2*sqrt(4/100))