library(fixest)
library(sandwich)
est <- feols(mpg ~ hp + i(cyl) | am, mtcars, vcov = "hc1")
vcov_bs <- sandwich::vcovBS(est, R = 500)
### attach new vcov to est
est_bs <- summary(est, vcov = vcov_bs)
###
etable(est, est_bs)
#> est est_bs
#> Dependent Var.: mpg mpg
#>
#> hp -0.0442*** (0.0116) -0.0442** (0.0132)
#> cyl = 6 -3.925** (1.215) -3.925** (1.304)
#> cyl = 8 -3.533. (1.920) -3.533 (2.101)
#> Fixed-Effects: ------------------- ------------------
#> am Yes Yes
#> _______________ ___________________ __________________
#> S.E. type Heteroskedast.-rob. Custom
#> Observations 32 32
#> R2 0.82488 0.82488
#> Within R2 0.72645 0.72645
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Created on 2024-05-15 with reprex v2.1.0