MATLAB Examples

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.

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))
ans =

     2
    13
    28
    44
    58
    70
    71
    84
    93
    95