I am running a multivariate OLS regression using lmtest with two-way clustered standard errors. The coefficients and standard errors work perfectly, but the usual stats (e.g. number of observations, R2, adj. R2, Residual SE, F Statistic) are not being displayed at the bottom of the regression table.
Here is how the code looks:
model1 <- lm(Y ~ X + Z data=df)
model2 <- lm(Y ~ W + Y + Z, data=df)
stargazer(
(coeftest(model1,vcovCL, cluster = ~ A + B)),
(coeftest(model2,vcovCL, cluster = ~ A + B)),
type='text')
Here is the output:
============================================
Dependent variable:
----------------------------
(1) (2)
--------------------------------------------
X 0.053***
(0.010)
W 0.048***
(0.014)
Y 0.058***
(0.013)
Z 0.089*** 0.089***
(0.003) (0.003)
============================================
============================================
Note: *p<0.1; **p<0.05; ***p<0.01
I learned that when I don't use the coeftest function, the table displays the results along with the common stats at the bottom. Please find below the example without the coeftest fuction, which produces the output containing the desired stats at the bottom:
stargazer(model1, model2, type='text')
===================================================================================
Dependent variable:
---------------------------------------------------------------
(1) (2)
-----------------------------------------------------------------------------------
X 0.053***
(0.002)
W 0.048***
(0.002)
Y 0.058***
(0.002)
Z 0.089*** 0.089***
(0.0002) (0.0002)
-----------------------------------------------------------------------------------
Observations 1,119,677 1,119,677
R2 0.151 0.151
Adjusted R2 0.151 0.151
Residual Std. Error 0.079 (df = 1119673) 0.079 (df = 1119672)
F Statistic 66,250.650*** (df = 3; 1119673) 49,690.200*** (df = 4; 1119672)
===================================================================================
Note: *p<0.1; **p<0.05; ***p<0.01
This other thread (Appending statistics to coeftest output to include in stargazer tables) addresses the same issue, but none of the answers solved the problem.
How do I produce these common statistics while passing the coeftest function through stargazer?