xuyiqing / fect_stata

Stata package for Fixed Effect Counterfactual Estimators
MIT License
23 stars 11 forks source link

Always Return r(198) Error #3

Open caiyishu opened 1 year ago

caiyishu commented 1 year ago

I would like to express my gratitude for providing the FECT package, which has been extremely useful for my work. I really appreciate your efforts in creating and maintaining it.

However, I have recently encountered an issue with it, which previously worked smoothly but has recently started always returning a 198 error. For example:

. use "https://raw.githubusercontent.com/xuyiqing/fect_stata/master/simdata.dta"
  (Written by R)

. fect Y, treat(D) unit(id) time(time) cov(X1 X2) method("fe") force("two-way")
  Balanced Panel Data
  Treatment has reversals.
  r(198);

I tried to troubleshoot by examining the ado file, but unfortunately, I wasn’t able to resolve this issue. I am currently using Stata 17.0.

If you have any suggestions or advice on what might be causing this error and how to fix it, I would greatly appreciate it.

xuyiqing commented 1 year ago

Thanks for reporting the error!

Dear Ziyi and Shijian, Do you know what might have happened?

Thanks! Yiqing

On Tue, Aug 15, 2023 at 1:43 AM coding_sheep @.***> wrote:

I would like to express my gratitude for providing the FECT package, which has been extremely useful for my work. I really appreciate your efforts in creating and maintaining it.

However, I have recently encountered an issue with it, which previously worked smoothly but has recently started always returning a 198 error. For example:

. use "https://raw.githubusercontent.com/xuyiqing/fect_stata/master/simdata.dta" (Written by R)

. fect Y, treat(D) unit(id) time(time) cov(X1 X2) method("fe") force("two-way") Balanced Panel Data Treatment has reversals. r(198);

I tried to troubleshoot by examining the ado file, but unfortunately, I wasn’t able to resolve this issue. I am currently using Stata 17.0.

If you have any suggestions or advice on what might be causing this error and how to fix it, I would greatly appreciate it.

— Reply to this email directly, view it on GitHub https://github.com/xuyiqing/fect_stata/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGEUPEQGEGUVBBBU5LLXVMZDHANCNFSM6AAAAAA3QZACVE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Yiqing Xu

Assistant Professor Department of Political Science Stanford University https://yiqingxu.org/

Six-Persimmon commented 1 year ago

Hi! Thanks for using the FECT package. The r(198) error can be solved by updating to the latest FECT Stata package, where we added more features when data have treatment reversals. Please reinstall it from the github page.

caiyishu commented 1 year ago

Hi Authors,

Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now.

I hope this can be helpful to other users! Thank you!

xuyiqing commented 1 year ago

Glad it worked!

On Tue, Aug 15, 2023 at 7:07 PM coding_sheep @.***> wrote:

Hi Authors,

Thank you for your reply. I manually reinstalled the package and restart STATA, and it is working well now.

— Reply to this email directly, view it on GitHub https://github.com/xuyiqing/fect_stata/issues/3#issuecomment-1679860169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGCL5UCPCYBQWFSMQ73XVQTMXANCNFSM6AAAAAA3QZACVE . You are receiving this because you commented.Message ID: @.***>

-- Sent from IPhone. Please pardon typos and brevity.

Lyn0628 commented 1 year ago

Hi Authors,

Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now.

I hope this can be helpful to other users! Thank you!

Hi, I also manually reinstalled the package and restarted stata, however, it still shows a 198 error. So i would like to ask if you have any suggestions...

Six-Persimmon commented 1 year ago

Hi Authors, Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now. I hope this can be helpful to other users! Thank you!

Hi, I also manually reinstalled the package and restarted stata, however, it still shows a 198 error. So i would like to ask if you have any suggestions...

The r(198) error is due to a misspecification when the treatment has reversal, which has been solved in the current edition. I would suggest you to reinstall and install from the fect_state main page (not the fork version on your own github page) and try again. Also please update your reghdfe and _gwtmean to the latest version. Please let us know if the problem still exists.

caiyishu commented 1 year ago

Hi Authors, Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now. I hope this can be helpful to other users! Thank you!

Hi, I also manually reinstalled the package and restarted stata, however, it still shows a 198 error. So i would like to ask if you have any suggestions...

Hi Lyn, In addition to the reasons provided by the authors, I've discovered that the inconsistency between the versions of reghdfe and fect can also trigger the 198 error.

I would recommend manually removing all packages related to reghdfe (such as reghdfe, ftools) from the "./ado/plus" directory. After that, reinstall the package (manually for fect). To ensure everything runs smoothly, you might consider restarting Stata.

Please remember to backup your entire "./ado/plus" folder.

Lyn0628 commented 1 year ago

Hi Authors, Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now. I hope this can be helpful to other users! Thank you!

Hi, I also manually reinstalled the package and restarted stata, however, it still shows a 198 error. So i would like to ask if you have any suggestions...

The r(198) error is due to a misspecification when the treatment has reversal, which has been solved in the current edition. I would suggest you to reinstall and install from the fect_state main page (not the fork version on your own github page) and try again. Also please update your reghdfe and _gwtmean to the latest version. Please let us know if the problem still exists.

Really thanks for your reply. Acutually I did reinstall the package from the fect_state main page and also update my reghdfe and _gwtmean to the latest version (version 6.12.3 08aug2023). However, it still reported the 198 error. And Yishu guess that it may be because I installed other packages related to the reghdfe (such as pretrends and honestdid package), which will affect the version of reghdfe. I‘m very grateful that Yishu shared his ado folder with me and replaced mine so that I can continue to use fect_stata normally.

Lyn0628 commented 1 year ago

Hi Authors, Thank you for your reply. I manually reinstalled the package from the GitHub page and restarted Stata, and it is working well now. I hope this can be helpful to other users! Thank you!

Hi, I also manually reinstalled the package and restarted stata, however, it still shows a 198 error. So i would like to ask if you have any suggestions...

Hi Lyn, In addition to the reasons provided by the authors, I've discovered that the inconsistency between the versions of reghdfe and fect can also trigger the 198 error.

I would recommend manually removing all packages related to reghdfe (such as reghdfe, ftools) from the "./ado/plus" directory. After that, reinstall the package (manually for fect). To ensure everything runs smoothly, you might consider restarting Stata.

Please remember to backup your entire "./ado/plus" folder.

Thank you so much for your recommendation.