synth_runner
synth_runner copied to clipboard
Synth_Runner trunit syntax error
Hello,
I am currently pursuing my thesis and I am using the synthetic control method. For some of my models I am having a recurrent issue with the treated unit.
In my case, I have 1 trunit and I continuously encounter the following:
Error estimating treatment effect for unit 19 invalid syntax r(101)
.
I have tried to find an error in my database with my variables and have not found an error, also I checked to see if there was another way to run the code and have been unsuccessful.
This is the following line of code as an example that isn't working:
tempfile keepfile synth_runner V1(1989) V1(1985) V1(1974), trunit(19) trperiod (1990) keep (
keepfile')`
Hope someone is able to help.
Thank you.
Please fill-out the form that was pre-populated in the new issue window so that we get information about your setup. You can get the form here and paste it in either a new comment below or edit your original response
Preliminaries
Before submitting an issue, please check (with x
in brackets) that you:
- [x] Are using the newest release (see here for latest release version number).
- [x] Have checked that the examples in the help work.
- [x] Have read the help (HTML version).
- [x] Have checked that there is not already an existing issues for what you are reporting.
- [x] Have check running synth directly for one of the treated units works.
Expected behavior and actual behavior
Described what you expected to see and what you actually see
I am using a strongly balanced panel with no missing values. I am trying to run synth_runner with minimal setting, and managed to run it once. However, the code will not run for a second time, with the following error message. It makes me think something gets stuck in stata memory. I have also tried to do it with set trace on, did not get any other error message.
Error estimating treatment effect for unit 240 Re-running last -synth- command with output/errors un-captured
control units: for 333 of out 333 units outcome variable rate_total is missing in 1996 pre- intervention MSPE period - check mspeperiod() invalid syntax
Steps to reproduce the problem
use "data.dta"
* generating treatment unit identifier
sort Ward year
egen unit=group(Ward)
* declare panel
tsset unit year
* generate treatment dummy
#delimit ;
gen byte D =(unit==240 & year>=2011) | (unit==251 & year>=2011) | (unit==261 & year>=2011) | (unit==271 & year>=2011) |
(unit==241 & year>=2011) | (unit==252 & year>=2011) | (unit==262 & year>=2011) | (unit==272 & year>=2011) |
(unit==242 & year>=2011) | (unit==253 & year>=2011) | (unit==263 & year>=2011) | (unit==273 & year>=2011) |
(unit==243 & year>=2011) | (unit==254 & year>=2011) | (unit==264 & year>=2011) | (unit==274 & year>=2011) |
(unit==244 & year>=2011) | (unit==255 & year>=2011) | (unit==265 & year>=2011) | (unit==275 & year>=2011) |
(unit==245 & year>=2011) | (unit==256 & year>=2011) | (unit==266 & year>=2011) | (unit==276 & year>=2011) |
(unit==246 & year>=2011) | (unit==257 & year>=2011) | (unit==267 & year>=2011) | (unit==277 & year>=2011) |
(unit==247 & year>=2011) | (unit==258 & year>=2011) | (unit==268 & year>=2011) | (unit==286 & year>=2011) |
(unit==248 & year>=2011) | (unit==259 & year>=2011) | (unit==269 & year>=2011) | (unit==287 & year>=2011) |
(unit==249 & year>=2011) | (unit==260 & year>=2011) | (unit==270 & year>=2011) | (unit==288 & year>=2011) |
(unit==250 & year>=2011) ;
#delimit cr
* synth_runner
synth_runner rate_total edu_total, d(D) trends
Please include a minimal, complete, and verifiable example. If possible, use system-provided or generated data. Otherwise please link to data so that the example can be verified by others. Format the code with an initial and final line of three backticks(`) for readability (see GitHub's markdown formatting)
System information
- Stata version and flavor (e.g. v14 MP): 15.0
- OS type and version (e.g. Windows 10): Windows 10
- synth_runner version: downloaded each time with the following code:
ssc install synth cap ado uninstall synth_runner //in-case already installed net install synth_runner, from(https://raw.github.com/bquistorff/synth_runner/master/) replace
Do you get the same issue if you run the example multiple times?
Hi everyone! I don't know what happened to @lhmaraganov 's problem in the end, but I'm having the same issue. More specifically, if I use more than one predictor I get the following error:
Error estimating treatment effect for unit # invalid syntax r(198);
The same setting, with one predictor works perfectly. Could anyone help me with that please?
Many thanks!