Open thorek1 opened 3 years ago
Hello,
summary()
returns per default standard errors based on the inverse of the negative Hessian (not clustered).
If you want to compute clustered standard errors, you need to specify further arguments, see example below:
# clustered by x3
summary(feglm(y ~ x1 + x2 | x3, dat) , type = "clustered", cluster = ~ x3)
# clustered by x4
summary(feglm(y ~ x1 + x2 | x3 | x4, dat) , type = "clustered", cluster = ~ x4)
A further example is available in the vignette: https://cran.r-project.org/web/packages/alpaca/vignettes/trade.html
Best wishes, Amrei
Thanks for your answer. I should have read the documentation more thoroughly.
In the second example you give, why would you need to specify the x4
in the formula? It seems redundant and does not change the functionality (not needed in your first example). I would have expected, from reading the help page of feglm that specifying it there would be enough to have clustered standard errors printed.
Using summary to print the clustered standard errors unfortunately makes a typical workflow of mine impossible:
results <- list()
alpaca::feglm(y ~ x1 + x2 | x3, dat) |> summary() -> results[[1]]
alpaca::feglm(y ~ x1 + x2 | x3 | x4, dat) |> summary() -> results[[2]]
library(texreg)
results |> texreg()
#Error in extract(l[[i]], ...) :
# Neither texreg nor broom supports models of class summary.feglm.
alpaca::feglm(y ~ x1 + x2 | x3, dat) -> results[[1]]
alpaca::feglm(y ~ x1 + x2 | x3 | x4, dat) -> results[[2]]
library(texreg)
results |> texreg()
# no clustered standard errors
Integration with other tools (such as texreg, stargazer,...) makes life a lot easer as is the case for fixest.
here is a a modification that I made to simplify the clustering https://github.com/amrei-stammann/alpaca/issues/17#issuecomment-2244095567
Hi,
I was wondering whether standard error clustering actually works. In the code example you can see that clustering does not change the standard errors whereas I would expect them to move and fixest estimates them to change: