# Robust Regression Analysis in R

Arndt Regorz, Dipl. Kfm. & M.Sc. Psychology, 09/30/2021

(Note: When you click on this video you are using a service offered by YouTube.)

The following annotated code runs a robust regression in R

You will need the following R packages, each of which must be installed once before use, e.g. install.packages("robustbase"):

- robustbase
- olsrr

R code

library(robustbase)

# Dataframe from package robustbase

head(CrohnD)

# Ordinary least squares regression

fit.reg <- lm(nrAdvE ~ BMI + height, data= CrohnD)

summary(fit.reg)

# Robust regression

# IMPORTANT: N should be >= 100!

fit.rob <- lmrob(nrAdvE ~ BMI + height, data= CrohnD)

summary(fit.rob)

# Outlier analysis

library(olsrr)

ols_plot_resid_lev(fit.reg)

Additional information about the MM-estimator:

The MM-estimator, on which the robust regression in the robustbase package is based, was introduced in this paper:

Yohai, V. J. (1987). High breakdown-point and high efficiency robust estimates for regression. The Annals of Statistics, 15(2), 642-656. https://www.jstor.org/stable/2241331