Hello, I am having trouble writing a regression equation for a series of comparisons of means. Here is some sample data:
I have a pre and post-policy period, policy and nonpolicy states, and targeted and nontargeted individuals. Note that the targeted individuals are only observed in the post-policy period.
I first create a "placebo" diff-in-diff value using only the "nontargeted" units.
di placebodd
55
Which can easily be replicated in a regression framework (represented by the interaction term):
Next, I compare differences among targeted individuals and subtract the "placebo" DD :
. di ddd
-25
Now, my question is how do I write a regression equation that will yield a coefficient representing this scalar ddd (-25)?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(year y target policy post) 2015 55 0 0 0 2015 57 0 0 0 2016 58 0 0 0 2016 44 0 0 0 2017 46 0 0 1 2017 59 0 0 1 2015 100 0 1 0 2015 100 0 1 0 2016 150 0 1 0 2016 156 0 1 0 2017 189 0 1 1 2017 184 0 1 1 2015 44 0 0 0 2015 32 0 0 0 2016 57 0 0 0 2016 66 0 0 0 2017 56 0 0 1 2017 59 0 0 1 2015 120 0 1 0 2015 130 0 1 0 2016 123 0 1 0 2016 156 0 1 0 2017 190 0 1 1 2017 188 0 1 1 2016 100 1 1 0 2016 105 1 1 0 2017 104 1 1 1 2017 103 1 1 1 2016 70 1 0 0 2016 72 1 0 0 2017 71 1 0 1 2017 76 1 0 1 end
I have a pre and post-policy period, policy and nonpolicy states, and targeted and nontargeted individuals. Note that the targeted individuals are only observed in the post-policy period.
I first create a "placebo" diff-in-diff value using only the "nontargeted" units.
Code:
sum y if policy==1 & post==1 & target==0 scalar t1post=r(mean) sum y if policy==1 & post==0 & target==0 scalar t1pre=r(mean) scalar t1diff=t1post-t1pre sum y if policy==0 & post==1 & target==0 scalar c1post=r(mean) sum y if policy==0 & post==0 & target==0 scalar c1pre=r(mean) scalar c1diff=c1post-c1pre scalar placebodd=t1diff-c1diff di placebodd
55
Which can easily be replicated in a regression framework (represented by the interaction term):
Code:
di placebodd reg y i.post##i.policy if target==0
Next, I compare differences among targeted individuals and subtract the "placebo" DD :
Code:
sum y if policy==1 & post==1 & target==1 scalar t2post=r(mean) sum y if policy==0 & post==1 & target==1 scalar c2post=r(mean) scalar t2diff=t2post-c2post scalar ddd=t2diff-placebodd di ddd
. di ddd
-25
Now, my question is how do I write a regression equation that will yield a coefficient representing this scalar ddd (-25)?
Comment