difference-in-differences model
definition
Difference in Differences (Difference in Differences) : By using observational learning data, calculate the incremental gap between the “experimental group” and the “control group” under intervention in natural experiments.
step:
- Grouping: For a natural experiment, it divides all sample data into two groups: one group is affected by the intervention, that is, the experimental group; the other group is not affected by the same intervention, that is, the control group;
- Target selection: Select a target indicator that needs to be observed, such as purchase conversion rate and retention rate, which are generally KPIs that you want to improve;
- The first difference: perform two differences (subtraction) before and after the intervention to obtain the difference between the two groups, which represents the relative relationship between the experimental group and the control group before and after the intervention;
- The second difference: The second difference is performed on the difference between the two groups, so as to eliminate the original difference between the experimental group and the control group, and finally obtain the net effect of the intervention.
Refer to 【Portal】
δ ^ = ( y ˉ T , 1 − y ˉ T , 0 ) − ( y ˉ C , 1 − y ˉ C , 0 ) \hat{\delta}=\left(\bar{y} _{T, 1}-\bar{y}_{T, 0}\right)-\left(\bar{y}_{C, 1}-\bar{y}_{C, 0}\right )d^=(yˉT,1−yˉT,0)−(yˉC,1−yˉC,0)
is the difference between the mean value before and after the intervention in the experimental group minus the difference between the mean value before and after the intervention in the control group
understand
1. In some paper reports, there is a DID variable, you can see the following example to understand.
It is the product of the individual (time) and the policy dummy variable.
stata implementation
gen gd=t*treated
reg fte gd treated t bk kfc roys,r
diff fte, t(treated) p(t) cov(bl kfc roys) robust
Under normal circumstances: Do PSM propensity score matching first
Answer: Because when studying the impact of a certain policy, other policy influencing factors may also be included, and the purpose of PSM is to remove other interference.