Solved – Robust regression in R

least squaresrregressionrobust

I've used an ordinary least square linear regression model in R that looks something like this:

ols <- lm(DV ~ IV1 + IV2)

When I type this:

summary(ols) 

I get a table showing Estimate, Std Error, t value and P(>|t|) for each coefficient. I also get the residual standard error, multiple r-square, adjusted r-square, f-statistic, and p-value for the model.

And I've used a robust linear regression model that looks something like this:

roblm <- rlm(DV ~ IV1 + IV2) 

When I type this:

summary(roblm)

I get a table showing Value, Std Error, and t value for each coefficient. But I don't get a p-value for each coefficient. Similarly, I get the residual standard error for the model, but I don't get multiple r-square, adjusted r-square, f-statistic, and p-value for the model.

Why aren't these additional statistics provided for the robust linear regression model? Do they not make sense in the context of this model? If these statistics do make sense, how would I go about getting them?

Best Answer

To expand on the advice of @kjetilbhalvorsen, here is an example of robust regression with the robustbase package. Note that the summary includes p-values for the effects and an r-squared value.

Source and load packages

### Adapted from: http://rcompanion.org/handbook/I_11.html

if(!require(robustbase)){install.packages("robustbase")}
if(!require(car)){install.packages("car")}
if(!require(multcomp)){install.packages("multcomp")}

Toy data

DV=c(1,4,3,6,5,8,1,4,3,6,5,12,1,2,3,4,5,6,1,2,3,4,5,6)
IV1 = factor(c(rep("A",6), rep("B",6), rep("C",6), rep("D",6)))
IV2 = factor(rep(c("M","N"),12))

Fit robust model and view summary

library(robustbase)

model = lmrob(DV ~ IV1 + IV2)

summary(model)

A p-value for the effects can be determined using the anova.lmrob function.

### Effect of IV1

model.2 = lmrob(DV ~ IV2)

anova(model, model.2)

### Effect of IV2

model.3 = lmrob(DV ~ IV1)

anova(model, model.3)

The documentation for car:Anova doesn't mention lmrob objects, but at least for this example, it seems to match the application of the anova.lmrob function.

library(car)

Anova(model)

Likewise, the documentation for the multcomp package doesn't mention lmrob objects, but at least for this example, the results seem reasonable.

library(multcomp)

mc = glht(model,
          mcp(IV2 = "Tukey"))

mcs = summary(mc, test=adjusted("single-step"))

mcs


mc = glht(model,
          mcp(IV1 = "Tukey"))

mcs = summary(mc, test=adjusted("single-step"))

mcs
Related Question