The fixest
package lets the user specify varying slopes using the fe1[x2]
syntax. A varying slope indicator is then printed at the bottom of fixest::etable()
. However, I was unable to find the term for the varying slope fixed-effects using modelsummary::get_gof()
: only the "classic" fixed-effects appear.
Is there a way to programmatically extract and display varying slope indicators from fixest
in the GoF section of a modelsummary
table?
library(fixest)
library(modelsummary)
base = iris
names(base) = c("y", paste0("x", 1:3), "fe1")
base$fe2 = rep(letters[1:5], 30)
est_vs = feols(y ~ x1 | csw(fe1, fe1[x2]), base)
est_vs
#> Standard-errors: Clustered (fe1)
#> Fixed-effects: fe1
#> Estimate Std. Error t value Pr(>|t|)
#> x1 0.803561 0.071397 11.2548 0.0078023 **
#> ---
#> Fixed-effects: fe1 + fe1[x2]
#> Estimate Std. Error t value Pr(>|t|)
#> x1 0.450006 0.156731 2.8712 0.10292
est_vs |> etable()
#> est_vs.1 est_vs.2
#> Dependent Var.: y y
#>
#> x1 0.8036** (0.0714) 0.4500 (0.1567)
#> Fixed-Effects: ----------------- ---------------
#> fe1 Yes Yes
#> Varying Slopes: ----------------- ---------------
#> x2 (fe1) No Yes
#> _______________ _________________ _______________
#> S.E.: Clustered by: fe1 by: fe1
#> Observations 150 150
#> R2 0.72591 0.86900
#> Within R2 0.28115 0.17894
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
modelsummary(est_vs)
fixef: fe1 | fixef: fe1 + fe1[x2] | |
---|---|---|
x1 | 0.804 | 0.450 |
(0.071) | (0.157) | |
:————— | ———–: | ———————: |
Num.Obs. | 150 | 150 |
R2 | 0.726 | 0.869 |
R2 Adj. | 0.720 | 0.864 |
R2 Within | 0.281 | 0.179 |
R2 Within Adj. | 0.276 | 0.173 |
AIC | 181.9 | 77.2 |
BIC | 194.0 | 98.3 |
RMSE | 0.43 | 0.30 |
Std.Errors | by: fe1 | by: fe1 |
FE: fe1 | X | X |
get_gof(est_vs[[1]])
#> aic bic r.squared adj.r.squared r2.within r2.within.adjusted
#> 1 181.9366 193.9791 0.7259066 0.7202746 0.28115 0.2762264
#> rmse nobs FE: fe1 vcov.type
#> 1 0.4320777 150 X by: fe1
get_gof(est_vs[[2]])
#> aic bic r.squared adj.r.squared r2.within r2.within.adjusted
#> 1 77.19273 98.26718 0.8690027 0.8635063 0.1789439 0.1732022
#> rmse nobs FE: fe1 vcov.type
#> 1 0.2987058 150 X by: fe1
Created on 2023-07-11 with reprex v2.0.2