[R] Robust Standard Error in R

Ben Bolker bbolker at gmail.com
Sun Sep 28 19:08:37 CEST 2014


Arnab Dutta <arnab.killy <at> gmail.com> writes:

> 
> Hi,
> 
>     In order to have robust standard errors in R, what would be the command
> that can generate results similar to the "robust" option in STATA? I tried
> using the "lmrob" command from the package "robustbase". With that, the
> Adjusted R squared is quite different from the normal "lm" command. This
> does not happen in STATA. Can anybody please enlighten me on this?
> 
> -Regards
>  Arnab


  I think you're looking for the sandwich package

example(lm)
library(sandwich)
sqrt(diag(vcov(lm.D9)))
sqrt(diag(vcovHAC(lm.D9)))

(or see example(vcovHAC)



More information about the R-help mailing list