Robust regression inference and Sandwich estimators Can you give me an example of the use of sandwich estimators in order to perform robust regression inference?
I can see the example in ?sandwich, but I don't quite understand how we can go from lm(a ~ b, data) (r-coded) to an estimate and a p value resulting from a regression model using the variance-covariance matrix returned by the function sandwich.  
 A: I think there are a few approaches. I haven't looked at them all and not sure which is the best:


*

*The sandwich package:
library(sandwich)    
coeftest(model, vcov=sandwich)

But this doesn't give me the same answers I get from Stata for some reason. I've never tried to work out why, I just don't use this package.


*

*The rms package: I find this a bit of a pain to work with but usually get good answers with some effort. And it is the most useful for me.
model = ols(a~b, x=TRUE)    
robcov(model)


*You can code it from scratch (see this blog post).  It looks like the most painful option, but remarkably easy and this option often works the best.  
A simple / quick explanation is that Huber-White or Robust SE are derived from the data rather than from the model, and thus are robust to many model assumptions. But as always, a quick Google search will lay this out in excruciating detail if you're interested.
A: One can use an alternative summary function to perform a robust regression. 
lm.object <- lm(a~b+c)
summary(lm.object, robust=TRUE)

To obtain robust standard errors you set the parameter ''robust'' in your summary function to TRUE. 
The following blog entry provides the function and a detailed description of the function: 
https://economictheoryblog.com/2016/08/08/robust-standard-errors-in-r
