# DID大法：多期DID如何做平行趋势检验？-经管之家官网！

>>

## TOP热门关键词

 扫码加入金融交流群

https://pic2.zhimg.com/80/v2-5eeb3f7e2f627c845f1f54d8d66edc95_720w.jpg

1. gen policy = wrkyr - branch_reform //生成政策时点前后期数
2. tab policy
3. replace policy = -10 if policy < -10
4. replace policy = 15 if policy > 15

5. forvalues i=10(-1)1{
6. gen pre`i'=(policy==-`i')
7. }

8. gen current= (policy==0)

9. forvalues i=1(1)15{
10. gen post`i'=(policy==`i')
11. }

12. drop pre1 //将政策前第一期作为基准组，很重要！！！

13. *两个命令结果一样
14. xtreg y pre* current post* i.wrkyr, fe vce(cluster statefip)
15. reghdfe y pre* current post*, absorb(statefip wrkyr) vce(cluster statefip)

https://pic3.zhimg.com/80/v2-f08cf3d1d159dab074a1bdda52748c92_720w.jpg

1. *绘图
2. coefplot, baselevels ///
3. keep(pre* current post*) ///
4. vertical ///转置图形
5. coeflabels( pre10 = "-10" ///
6. pre9 = "-9" ///
7. pre8 = "-8" ///
8. pre7 = "-7" ///
9. pre6 = "-6" ///
10. pre5 = "-5" ///
11. pre4 = "-4" ///
12. pre3 = "-3" ///
13. pre2 = "-2" ///
14. current = "0" ///
15. post1 = "1" ///
16. post2 = "2" ///
17. post3 = "3" ///
18. post4 = "4" ///
19. post5 = "5" ///
20. post6 = "6" ///
21. post7 = "7" ///
22. post8 = "8" ///
23. post9 = "9" ///
24. post10 = "10" ///
25. post11 = "11" ///
26. post12 = "12" ///
27. post13 = "13" ///
28. post14 = "14" ///
29. post15 = "15") ///
30. yline(0,lcolor(edkblue*0.8)) ///加入y=0这条虚线
31. ylabel(-0.06(0.02)0.06) ///
32. xline(10, lwidth(vthin) lpattern(dash) lcolor(teal)) ///
33. ylabel(,labsize(*0.75)) xlabel(,labsize(*0.75)) ///
34. ytitle("政策动态经济效应", size(small)) ///加入Y轴标题,大小small
35. xtitle("政策时点", size(small)) ///加入X轴标题，大小small
37. ciopts(lpattern(dash) recast(rcap) msize(medium)) ///CI为虚线上下封口
38. msymbol(circle_hollow) ///plot空心格式
39. scheme(s1mono)

https://pic1.zhimg.com/80/v2-a15b6aca80ddbe629f2293bb430c8c9c_720w.jpg

https://pic2.zhimg.com/80/v2-70bbd81f63b4606caccff0776180dfe5_720w.jpg

Beck T , Levkov R L . Big Bad Banks? The Winners and Losers from Bank Deregulation in the United States[J]. Journal of Finance, 2010, 65(5):1637-1667.

「经管之家」APP：经管人学习、答疑、交友，就上经管之家！

## 人气文章

#### 本文标题：DID大法：多期DID如何做平行趋势检验？

1.凡人大经济论坛-经管之家转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责；
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性，不作出任何保证或承若；
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。