March 2019
Beginner to intermediate
448 pages
13h 14m
English
We'll generate a synthetic dataset containing two independent variables. We will then contaminate it and see how both lm and rlm perform:
set.seed(10) x1 = rnorm(100,0,2) x2 = rnorm(100,0,2) y = x1 + x2 + rnorm(100,0,1)
y[100] = 100 plot(x1,y) The following screenshot shows the plot between x1 and the dependent variable: y (notice the outlier on the upper-right part of the plot):

Read now
Unlock full access