ArOk
ArOk

Reputation: 193

R: robust standard errors into LATEX

I am running some fixed effect regressions with robust stadard errors. And I would like to get them into LATEX format with the stargazer package. Does anyone know how this works in a simple efficient way?

My code for the regressions looks like the following:

library(plm)
panel_data <- pdata.frame(data, index = c("country","time"))
FE_model <- plm(Y~X+Z, data = panel_data, model = "within",  effect = "twoway")

my code for the standard errors is this:

library(lmtest)
coeftest(FE_model, vcov.=vcovHC(FE_model, method = c("arellano")))

and the code I previously used with the stargazer package looks like this:

stargazer(FE_model_1,FE_model_2,FE_model_3, title="FE_model_Results",
      align=TRUE,
      omit.stat=c("LL","ser","f"), no.space = TRUE)

so this would only give me the output of the regressions with normal standard errors, but I would like to use the robust ones.

Upvotes: 0

Views: 548

Answers (1)

tmfmnk
tmfmnk

Reputation: 39858

Using some sample data from plm library:

data("Produc", package = "plm")

Fitting an example model from plm library documentation:

zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
          data = Produc, index = c("state","year"))

Estimating standard errors as you specified it:

se <- coeftest(zz, vcov.=vcovHC(zz, method = c("arellano")))

Generating the stargazer table:

stargazer(zz, title="FE_model_Results",
          align=TRUE,
          omit.stat=c("LL","f"), no.space = TRUE,
          se = list(se[,2]))

Upvotes: 1

Related Questions