Fitting a robust linear regression model with rlm
An outlier in the dataset will move the regression line away from the mainstream. Apart from removing it, we can apply a robust linear regression to fit datasets containing outliers. In this recipe, we introduce how to apply
rlm to perform robust linear regression to datasets containing outliers.
Prepare the dataset that contains an outlier that may move the regression line away from the mainstream. Here, we use the
Quartet dataset loaded from the previous recipe.
How to do it...
Perform the following steps to fit the robust linear regression model with
- Generate a scatter plot of the
> plot(Quartet$x, Quartet$y3)
- Next, you should ...