0

I'm trying to 1. get stargazer output to show the correct standard errors and show the right significance (stars); 2. to add robust F-statistics (from linearHypothesis).

Problem 1: The significance stars are not right. If you compare r_mod1 with the output from stargazer, you will notice that r_mod1 has only 1 star for the marriedyes-variable, but the stargazer output shows two stars.

Problem 2: I don't know how to get the robust F-statistics. Iv'e read that you have to do it manually somewhere, because stargazer doesn't have the functionality to do this. Is this true? It seems like a kinda basic limitation for such a well developed package as stargazer.

Any help would be much appreciated!

My code:


# Libraries

library(tidyverse)
library(Ecdat)
library(lmtest) 
library(sandwich) 
library(stargazer)
library(car)

# Get data from Ecdat
data(Wages)
wages <- Wages
rm(Wages)


# A sample model

mod1 <- lm(lwage ~ ed + exp + I(exp^2) + wks + bluecol + ind + 
             south + smsa + married + sex + union + black, 
           data = wages)


# Robust standard errors
r_mod1 <- coeftest(mod1,vcov=(vcovHC(mod1,"HC1")))

# Robust F-stats
lh1 <- linearHypothesis(mod1,names(coef(mod1))[-1], white.adjust = T)

# Extract robust values
se1 <- r_mod1[, 2]
p1 <- r_mod1[, 4]
t1 <- r_mod1[, 3]


# STARGAZER
stargazer(mod1,
          type = "text", 
          column.labels=c("Model one (All)"),
          title = "Regression results",
          style = "qje",
          single.row = TRUE,
          t.auto = T, # Necessary?
          p.auto = T, # Necessary?
          se = list(se1), 
          p = list(p1), 
          t = list(t1))


Tomas R
  • 440
  • 2
  • 10
  • I have just run your dataset. The F statistic has three stars. All but one variables in your model show three stars. What exactly shows only two stars? – Fons MA Jun 10 '21 at 12:18
  • Does this answer your question? [Robust Standard Errors in lm() using stargazer()](https://stackoverflow.com/questions/58923112/robust-standard-errors-in-lm-using-stargazer) – Fons MA Jun 10 '21 at 12:21
  • Sorry, should have specified. In this model its the marriedyes-variable (see edit in main post). But this problem is also repeated in my original script which has many more models and several stars that are mismatched like this. – Tomas R Jun 10 '21 at 12:22

0 Answers0