JMSLab / xtevent

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

Left window of zero returns an error #188

Closed Constantino-Carreto-Romero closed 3 months ago

Constantino-Carreto-Romero commented 3 months ago

Per comment https://github.com/JMSLab/xtevent/pull/178#issuecomment-2093382033 When running

use example31, clear
xtevent y, w(0 3) pol(z) impute(stag)

we got the following error message.

Constantino-Carreto-Romero commented 3 months ago

@jorpppp The error arose because the definition of some temporary variables was missing. We had defined them in the section code that generates the pre-event time dummies variables, but since in the case of left window = 0 that section code is never executed, we must also define the temporary variables in the section code that generates the post-event time dummies variables. Besides, the ordering of the left endpoint needed some adjustment to not assume that there is always at least one pre-event time dummy variable.

Bug fixed in https://github.com/JMSLab/xtevent/commit/4c3fa880a8ca2f87fbce7774b14cb4c3c47d1cb1 and https://github.com/JMSLab/xtevent/commit/fb9f1b59af42ac854726be41cfac2ac06a2cf5c7

After, when running:

use example31, clear
xtevent y, w(0 3) pol(z) impute(stag) savek(aa)

I get the following outcome and the event-time dummies variables are properly ordered.

jorpppp commented 3 months ago

Thanks @Constantino-Carreto-Romero. I'm looking into the fact that plotting is not working now:

xtevent y, w(0 3) pol(z) impute(stag) plot

because there are no pre-event coefficients to test.

jorpppp commented 3 months ago

Summary: In this issue we addressed a bug when the user specified a left window of zero.

Thread continues in #194