JMSLab / xtevent

Stata package -xtevent-
MIT License
43 stars 12 forks source link

Check results reposting for Sun and Abraham implementation #217

Closed jorpppp closed 2 months ago

jorpppp commented 2 months ago

After estimation via Sun and Abraham's method, the coefficients and standard errors are reposted to an xtevent regression, but other elements are not reposted, such as the degrees of freedom. Because of this, some elements of the header in the estimation results after Sun and Abraham estimation are wrong.

jorpppp commented 2 months ago

@Constantino-Carreto-Romero in https://github.com/JMSLab/xtevent/commit/c9a2fa24cd6c54078616d24c977bc18f37c0e865 I posted a change to post the model degrees of freedom to the baseline regression for you to take a look. From here we can:

Either way should work, so try to see which one would be easier @Constantino-Carreto-Romero

Constantino-Carreto-Romero commented 2 months ago

@Constantino-Carreto-Romero in c9a2fa2 I posted a change to post the model degrees of freedom to the baseline regression for you to take a look. From here we can:

  • Generalize the code to post all of the results from e() to the base regression
  • Set the interacted regression as the base regression for the Sun and Abraham case, and replace the coefficients for that one.

Either way should work, so try to see which one would be easier @Constantino-Carreto-Romero

@jorpppp in https://github.com/JMSLab/xtevent/commit/ff551c3afa616099cedc4c12f39bd8b7bbc52ae6 I implemented the second alternative. The SA estimation flow is as follows:

  1. Previously, first, it estimated a xtevent base regression, saved it, and then estimated the interacted regression. Now the base regression is not estimated, but only the interacted regression.
  2. Previously, the SA's corrected coefficient vector and covariance matrix were inserted into the base regression. Now, both elements replace the ones from the interacted regression. To be able to do this (and not to have to rely on an initial base regression to be able to post results), I changed the program repostdelta following this post.
    • After that change, however, there was a bug when posting the new regression table in the GMM-adjustment code if the underlying estimation command is regress. To be able to post the new regression table I changed cmd for _coef_table_header and _coef_table here.
    • Then, I ran the test file with the code from the main branch and a second time with the code in this issue to verify: i) Estimation output in settings other than SA should be the same; ii) in SA examples, the coefficients and se should not change, but the regression header should, reflecting the computations from the interacted regression. The comparison is in https://github.com/JMSLab/xtevent/commit/0c481da7d8731e1f627424c47e06db92cebc6293.
    • When inspecting that comparison, the regression output in settings other than SA was shortened in some cases. It is owing to the change of cmd for _coef_table_header and _coef_table.
    • In the SA examples, the covariate coefficients are not shown in the regression output anymore. Previously, these coefficients came from the base regression since SA corrects only the event-time dummy coefficients. This is similar to EventStudyInteract which reports only the event-time coefficients.
jorpppp commented 2 months ago

Thanks @Constantino-Carreto-Romero, this looks good. Opening a PR now.

jorpppp commented 2 months ago

Summary: In this issue we fixed a bug where header results were incorrect for Sun and Abraham estimation. Thread continues in #219