Robust linear regression

When doing linear regression, we have seen that our estimates can change dramatically in the presence of influential points. This is usually problematic when dealing with noisy datasets. R exposes the rlm function, which offers several weighting options: Huber, and bi-square among them.

Huber weights are appropriate when we don't have many extreme cases, and bisquare weights are best for those extreme cases. In either case, the algorithm operates in the same fashion, by using iteratively reweighted least squares (IRLS), which is described at the end of this recipe.

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.