lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
377 stars 59 forks source link

Custom coefficient format for a specific variable in fixest etable #369

Open matthewgson opened 1 year ago

matthewgson commented 1 year ago

I'm wondering if there's a way I can format the coefficient reported in etable in a customized way.

For example, in the below regression

library(fixest)
feols(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width | Species, iris)
model_fit = feols(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width | Species, iris)
etable(model_fit)

                       model_fit
Dependent Var.:     Sepal.Length

Sepal.Width     0.4959. (0.1206)
Petal.Length    0.8292* (0.0970)
Petal.Width     -0.3152 (0.1096)
Fixed-Effects:  ----------------
Species                      Yes
_______________ ________________
S.E.: Clustered      by: Species
Observations                 150
R2                       0.86731
Within R2                0.65201
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

I would like to multiply by 100 only to the coefficient of Sepal.Width for reporting and write a separate note for the adjustment, so that the etable report looks like

                       model_fit
Dependent Var.:     Sepal.Length

Sepal.Width     49.59 (0.1206)
Petal.Length    0.8292* (0.0970)
Petal.Width     -0.3152 (0.1096)
Fixed-Effects:  ----------------
Species                      Yes
_______________ ________________
S.E.: Clustered      by: Species
Observations                 150
R2                       0.86731
Within R2                0.65201
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Is there a handy way to achieve this in fixest etable?

Scaling Sepal.Width column and re-running the regression is the least preferable option for me. I would appreciate this feature because the scientific notation is deemed not conventional in my field.