Is there a way to transform the reported fixest coefficients and standard errors in an etable?

320 Views Asked by At

I am trying to report results from some fixest regressions using etable. However, I want to report incidence ratios alongside feols regression results on the same table. Incidence ratios are basically the exponentiated coefficients, and so are their standard errors. Therefore, I want to replace each coefficient (b) and corresponding standard error (s), with e^b and e^s - I cannot figure out a way to do this.

I tried replacing the original fixest objects with the exponentiated ones but that doesn't work because some of the values (like z scores) become invalid.

I did find this but this seems a bit inefficient for my purpose.

1

There are 1 best solutions below

0
On

One option would be to use the transform argument in the etable function to transform the coefficients and standard errors before they are displayed in the table. The transform argument takes a function as its value, and this function will be applied to the coefficients and standard errors before they are displayed in the table.

For example, if you have a fixest object called results, you could use the following code to create a table that displays the exponentiated coefficients and standard errors:

etable(results, transform = function(x) exp(x)) This will apply the exp function to the coefficients and standard errors before they are displayed in the table, resulting in the incidence ratios being displayed instead.

Another option would be to manually create the table using the xtable function, which allows for more control over the formatting and display of the table. You can use the exp function to transform the coefficients and standard errors, and then include these values in the table using the xtable function.

For example, if you have a fixest object called results, you could use the following code to create a table that displays the exponentiated coefficients and standard errors:

Create a matrix of the exponentiated coefficients and standard errors

results_exp = cbind(exp(results$coefficients), exp(results$stderr))

Use the xtable function to create a table of the exponentiated coefficients and standard errors

xtable(results_exp, digits = 2) This will create a table that displays the exponentiated coefficients and standard errors. You can then use the print function to display the table in your R session or save it to a file