0

I am running models with plm with re-calculated standard errors. The challenge? I want to turn the models with the updated standards errors into a stargazer regression table.

Here is some sample data


library(plm)
library(stargazer)

df <- data.frame(year= rep(c(2000:2005), each=6),
                 county= rep(c("c1", "c2", "c3", "c4", "c5", "c6"), times=6),
                 temperature= runif(36, min=40, max=80),
                 trade= runif(36, min=10, max=20),
                 policy.outcome= runif(36, min=0, max=100))

df.p <- pdata.frame(df, index=c("county", "year"))

m1 <- plm(policy.outcome
 ~ temperature + trade, data=df.p, model="within", effect="twoways")

summary(m1)

I would like to load this model into stargazer

summary(m1, vcov = function(x) vcovDC(x, type="HC1"))

stargazer(m1, align= T, type = "text")
3
  • What happens when you run your stargazer(m1, ...) code? Does it not return what you want, throw an error, etc? Commented Dec 17, 2024 at 1:38
  • 1
    help("stargazer") specifies how you can pass modified standard errors ... Commented Dec 17, 2024 at 6:09
  • As a side note modelsummary lets you do this in the same call with modelsummary(m1, vcov = \(x) vcovDC(x, type = 'HC1')) Commented Dec 17, 2024 at 13:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.