Hello,
i am trying to run a placebo test with the synth command downloaded from the homepage of Jens Hainmüller (Welcome to the Webpage of Jens Hainmueller (stanford.edu)
I have looked through old forums and there i could find basically the solution for creating the code.
My data set is a panel data set with yearly information on the Total Home Equity Loans and Total First Purchase Loans and a identifier for each state from the HMDA Data Set for each state.
Therefore i want to do a Placobo Test for one single State in 1998.
My Code:
tsset id year
forval i = 1/60 {
qui synth logRefstate logFPstate StateNumberHEL StateNumberFP logRefstate(1996), trunit(`i') trperiod(1998) keep(synth_`i', replace)
}
forval i = 1/60{
use synth_`i', clear
rename _time years
gen tr_effect_`i' = _Y_treated - _Y_synthetic
keep years tr_effect_`i'
drop if missing(years)
save synth_`i', replace
}
use synth_1, clear
forval i=2/60{
qui merge 1:1 years using synth_`i', nogenerate
}
local lp
forval i=1/60 {
local lp `lp' line tr_effect_`i' years, lcolor(gs12) ||
}
*
* create plot
twoway `lp' || line tr_effect_3 years, ///
lcolor(orange) legend(off) xline(1998, lpattern(dash))
My problem is that in the second line i receive the error message: treated unit not found in panelvar - check tr()
And it works if add one number betweeen 1-60 for the trunit() command. I don´t know why stata can´t find my identifier, it has to be a problem with the `i' within the trunit(`i') command.
If i run the code for example with trunit(1) it created 60 treatment effects but shows only the one for id 1, so the code works, i just don´t understand why the first loop doesn´t recognize the treatment unit.
Currently i am using Stata 16.1 - on the webpage of MR. Hainmüller there is written that the synth command works for Stata 9-15, but for my Synthtic Analysis it has also worked so i don´t know if Stata is Problem.
Thank you in advance.
Related Posts with Placebo Test
Analysing duplicatesHi guys, I need to analyse duplicates. I've got different newpaper articles. They all have a story_…
Help Panel Var..can't get over this!!Hello guys, I don't know if someone will be so nice to help me with this, but I'm trying to get to …
Errors when interpolating panel data using mipolateHello, Statalist, Long-time listener, first-time caller, here. I have panel data at the U.S. count…
Test overidentification when instrumenting xtivreg2 with predicted values of xtpoissonDear all I have two questions, one stata question and another econometric question. First the stat…
Binary probit or categorical probitDear community, In the first model I applied binary dependent and independent variables (see picture…
Subscribe to:
Post Comments (Atom)
0 Response to Placebo Test
Post a Comment