Hi! I want to control for heteroscedasticity with robust standard errors.
I have read a lot about the pain of replicate the easy robust
option from STATA to R to use robust standard errors. I replicated following approaches: StackExchange and Economic Theory Blog. They work but the problem I face is, if I want to print my results using the stargazer
function (this prints the .tex
code for Latex files).
Here is the illustration to my problem:
reg1 <- lm(rev~id + source + listed + country , data=data2_rev)
stargazer(reg1)
This prints the R output as .tex
code (non-robust SE) If i want to use robust SE, i can do it with the sandwich
package as follow:
vcov <- vcovHC(reg1, "HC1")
if I now use stargazer(vcov)
only the output of the vcovHC function is printed and not the regression output itself.
How can I use robust standard errors in the lm function? Did anybody face the same problem?