Statistics Toolbox | ![]() ![]() |
Robust Regression
In Example: Multiple Linear Regression we found an outlier when we used ordinary least squares regression to model a response as a function of five predictors. How did that outlier affect the results?
Let's estimate the coefficients using the robustfit
function.
load moore x = moore(:,1:5); y = moore(:,6); [br,statsr] = robustfit(x,y); br br = -1.7742 0.0000 0.0009 0.0002 0.0062 0.0001
Compare these estimates to those we obtained from the regress
function.
To understand why the two differ, it is helpful to look at the weight variable from the robust fit. It measures how much weight was given to each point during the fit. In this case, the first point had a very low weight so it was effectively ignored.
statsr.w' ans = Columns 1 through 7 0.0577 0.9977 0.9776 0.9455 0.9687 0.8734 0.9177 Columns 8 through 14 0.9990 0.9653 0.9679 0.9768 0.9882 0.9998 0.9979 Columns 15 through 20 0.8185 0.9757 0.9875 0.9991 0.9021 0.6953
For another example illustrating robust fitting, see The robustdemo Demo.
![]() | Robust and Nonparametric Methods | Kruskal-Wallis Test | ![]() |