I hope you are doing well. I wanted to run a placebo test where I rerun my main estimation by randomly scrambling the identity of my districts. A sample of my data is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str5 bench int yeardecision byte StateWins double NewJudges_TotalJudges "abohc" 2016 0 .8888888888888888 "abohc" 2003 0 0 "abohc" 2011 0 .5555555555555556 "abohc" 2011 1 .5555555555555556 "abohc" 2011 0 .5555555555555556 "abohc" 2012 0 .5555555555555556 "abohc" 2009 1 0 "banhc" 1994 0 0 "banhc" 1994 0 0 "banhc" 2009 0 0 "banhc" 2003 0 0 "banhc" 2009 1 0 "banhc" 1994 0 0 "banhc" 1996 1 0 "dikhc" 1991 0 0 "dikhc" 2005 1 0 "hydhc" 1995 0 0 end
Essentially, I want to assess if I in my main explanatory variable that varies by district-year is correlated with the dependent variable when the districts are swapped/scrambled e.g. district (bench) "abohc" becomes "banhc". I would want to estimate .
Code:
regress StateWins NewJudges_TotalJudges_Scrambled i.yeardecision i.bench
regress StateWins NewJudges_TotalJudges i.yeardecision i.bench, vce(cluster bench)
I am not sure exactly how I would go in constructing a new NewJudges_TotalJudges variable where the bench is swapped along with the explanatory variable and then regressed on the originally ordered State Wins variable.
I thought about using uniform distribution to tag randomly districts but I am not sure how I would go about creating first a swapped bench (district) variable and then estimating the effect of NewJudges_TotalJudges on State Wins.
Your help in this regard will really be appreciated.
0 Response to Help with randomly scrambling the districts
Post a Comment