Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leedtwoway in Stata 16 fails to find the command pytw and gives an error saying 'unable to open URL' #47

Open
diosas17 opened this issue Apr 27, 2023 · 8 comments

Comments

@diosas17
Copy link

Hi,

I am trying to use leedtwoway in Stata 16 to implement pytwoway using Stata.
Using the sample data and the configuration file provided in https://tlamadon.github.io/pytwoway/doc-stata.html, I ran leedtwoway and got an error that reads as:

zsh:1: command not found: pytw
Error -601, Unable to open URL: file not found
Warning: No response from source?!?

I am using Mac, but when I use Windows with my laptop, it shows the same last two lines of the errors above.
Just in case, python version is 3.9.13 and the version of pytwoway installed is 0.3.21.

Could you please let me know how I could resolve this error?

Thank you for your help and consideration!

@tlamadon
Copy link
Owner

@adamoppenheimer
Copy link
Collaborator

Hi @diosas17, just following up on this, were you able to get the code to run?

@diosas17
Copy link
Author

@tlamadon I have tried leed2way and it worked. I guess it is only for FE homogeneity. Would it be possible to implement CRE using leed2way with a flexible configuration option?

@diosas17
Copy link
Author

@adamoppenheimer leedtwoway doesn't work for me. But leed2way in https://github.com/tlamadon/pytwoway/wiki/Pytwoway-with-Stata-on-Apple-silicon-(M1,-M2,-etc) can do FE version correction with homogeneity.

@adamoppenheimer
Copy link
Collaborator

@diosas17 that's great to hear! I will try to update leedtwoway over the summer.

Also, if you look at the code for leed2way you should be able to use similar code to get the CRE estimator working. I recommend looking at the CRE notebook.

Sorry I can't help more at the moment, I'll have more time over the summer.

Please send an update if you get the CRE code working.

@diosas17
Copy link
Author

Thanks! I will give it a try leed2way again.

@adamoppenheimer
Copy link
Collaborator

Hi @diosas17,

I just uploaded new code to the dev branch that will enable you to run FE and CRE from Stata, and in addition now allows you to specify whether you want HO/HE or both corrections, and also allows you to run FE with controls.

For now, since it's just in the dev branch you will have to install that version of the package (first, uninstall pytwoway with pip uninstall pytwoway, then run pip install git+https://github.com/tlamadon/pytwoway@dev to get the dev version of the package).

Then, you will have to manually add the new Stata code from here. At the moment, I've only tested it on Mac, the options for Windows and Linux will be developed once I can find people who are willing to help me test them (I don't have Windows or Linux, so I can't test them myself).

Then you run the code the same as before. There are more options now, so I included a sample config file below. Since you are running it through Stata, make sure to specify stata = True. Also be careful about the double quotes around lists.

Please let me know if you have any questions, and I would appreciate any feedback you can give to help improve the package!

Best,
Adam

filepath = twoway_sample_data.csv
filetype = csv
i = i
j = j
y = y
t = t
fe = True
fe_continuous_controls = ""['j']""
fe_Q_var = ""['psi', 'alpha', 'j']""
fe_Q_cov = ""[(['psi', 'alpha'], ['psi'])]""
fe_ho = True
fe_he = True
cre = True
fe_outputfile = res_fe.json
cre_outputfile = res_cre.json
collapse
collapse_level = spell
connectedness = leave_out_spell
seed = 1234
stata = True

@diosas17
Copy link
Author

Thank you for your kind help!
I will try it and let you know how it works when it's done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants