名奢网 名表 名表日报 查看内容

免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...

2023-3-30 21:04| 发布者: 夏梦飞雨| 查看: 130| 评论: 0

放大 缩小
简介:来源:数量经济技术经济研讨《 专利质押、融资约束与企业劳动雇佣 》本文措施主题:DID模型运用到了DID模型 平行趋向检验 安慰剂检验措施 PSM-DID 随机抽样1000次绘制安慰剂检验图 运用到的主要命令:描画结果输出lx ...

来源:数量经济技术经济研讨《 专利质押、融资约束与企业劳动雇佣


本文措施主题:DID模型


  • 运用到了DID模型


  • 平行趋向检验


  • 安慰剂检验措施


  • PSM-DID


  • 随机抽样1000次绘制安慰剂检验图


运用到的主要命令:


  • 描画结果输出lxhsum


  • 相关剖析系数输出lxhcorr


  • 结果输出lxhreg


  • 平行趋向检验绘图eventdd


  • DID模型剖析命令xtreg


  • PSM-DID剖析中触及到psmatch2、pstest


第一部分:双重差分学问回想

免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


免费公开课--DID专题视频(论文精讲--传统DID、PSM-DID ...


第二部分:双重差分代码完成


* --------------------------------------------------


*


* $$$$$ $$$$$$$$ $ $$$$$$$$ $


* $$ $$ $ $$ $ $$ $ $$ $ $$


* $$ $ $$ $$$ $$ $$$


* $$$ $$ $ $$ $$ $ $$


* $$$ $$ $ $$ $$ $ $$


* $$$ $$ $$$$$ $$ $$$$$


* $ $$ $$ $ $$ $$ $ $$


* $$ $$ $$ $ $$ $$ $ $$


* $$$$$ $$$$ $$$ $$$$ $$$$ $$$ $$$$


*


* --------------------------------------------------


*


*


*-------------------------------------------------------------------------------


* 参考资料:


* 《初级计量经济学及Stata应用:Stata从入门到进阶》


* 《高级计量经济学及Stata应用:Stata回归剖析与应用》


* 《量化社会科学措施》


* 《社会科学因果推断》


* 《面板数据计量剖析措施》


* 《时间序列计量剖析措施》


* 《高级计量经济学及Eviews应用》


* 《R、Python、Mtalab初高级教程》


* 《空间计量入门:空间计量在Geoda、GeodaSpace中的应用》


* 《零基础|轻松搞定空间计量:空间计量及GeoDa、Stata应用》


* 《空间计量第二部:空间计量及Matlab应用课程》


* 《空间计量第三部:空间计量及Stata应用课程》


* 《空间计量第四部:《空间计量及ArcGis应用课程》


* 《空间计量第五部:空间计量经济学》


* 《空间计量第六部:《空间计量及Python应用》


* 《空间计量第七部:《空间计量及R应用》


* 《空间计量第八部:《高级空间计量经济学》


*-------------------------------------------------------------------------------


* ==================================================


* 双重差分措施:DID专题


* ==================================================


*--------------------------------------------------------


** # *-> 案例6、数量经济技术经济研讨--2022年第9期


** # *-> 论文复刻:专利质押、融资约束与企业劳动雇佣.pdf


*--------------------------------------------------------


** # 1、导入数据


cdC:\Users\Metrics\Desktop\DID专题


use 数据.dta, clear


global c "Size Lev Roa Soe p_GDP Second_ind "


** # 2、描画性统计-表2(P7页)


lxhsum Labor Hlabor Policy $cusing 描画性统计.rtf, ///


replace s(N mean(%13.3f) sd(%13.3f) min(%13.3f) median(%13.3f) max(%13.3f))


拓展学问点:


  • 描画结果输出lxhsum


  • 相关剖析系数输出(lxhcorr)


  • 结果输出(lxhreg)


* 拓展学问、描画性统计输出(lxhsum)

* 命令语法:


lxhsum [varlist] [ if] [ in] [using/] [, ///


replace append Statistics(string) TItle(string) Alignment(string) PAGE(string)]


* 选项阐明:


* varlist


* using


* replace


* append


* statistics:能够输入的全部统计量有:N mean sd min median max p1 p5 p10 p25 p75 p90 p95 p99。


* 若为空,则默许输入N mean sd min median max。


* title:表格题目,若为空,则默许为Summary statistics。


sysuse "auto.dta", clear //翻开auto美国1978年汽车行业横截面数据


reg price mpg


lxhsum


lxhsum price mpg


lxhsum price mpg, s(N sd(3) min(%9.2f) p99(%9.3fc))


lxhsum price mpg, s(N sd(3) min(%9.2f) p99(%9.3fc)) ti(this is a title)


lxhsum price mpg using Tabls1.rtf, replace s(N sd(3) min(%9.2f) ) ti(this is a title)


** # 2、相关剖析系数输出(lxhcorr)


lxhcorr [varlist] [ if] [ in] [using/] [, ///


replace append B(string) P(string) STARAUX NOSTAR ///


CORR PWCORR TItle(string) Alignment(string) PAGE(string) ]


* varlist:


* using:


* replace:


* append:含义同上。


* staraux和nostar:


* corr和pwcorr:


* 选项corr表示讲演的相关系数与corr默许状态下分歧(在计算相关系数前会先去除包含缺漏值的察看值);


* 选项pwcorr表示讲演的相关系数与pwcorr默许状态下分歧(在计算相关系数前不会先删除包含缺漏值);若两者均为空,则默许导入corr。


sysuse "auto.dta", clear //翻开auto美国1978年汽车行业横截面数据


reg price mpg


lxhcorr


lxhcorr price mpg


lxhcorr price mpg, b(2)


lxhcorr price mpg, b(2) p(%9.3f)


lxhcorr price mpg, b(2) p(%9.3f) staraux


lxhcorr price mpg, b(2) p(%9.3f) nostar


lxhcorr price mpg, b(2) p(%9.3f) corr


lxhcorr price mpg, b(2) p(%9.3f) ti(this is a title)


lxhcorr price mpg using Myfile.rtf, replace b(2) p(%9.3f)


** # 3、结果输出(lxhreg)


** # 3、基准回归剖析--**********3.1基准回归-表3**********(P8页)


use 数据, clear


xtset code year


qui xtreg Labor Policy i.year,fe vce(cluster code) // 不带控制变量 //


est store m1


qui xtreg Labor Policy $ci.year ,fe vce(cluster code)


est store m2


qui xtreg Hlabor Policy i.year ,fe vce(cluster code)


est store m3


qui xtreg Hlabor Policy $ci.year ,fe vce(cluster code)


est store m4


lxhreg m1 m2 m3 m4 using 基准回归结果1.rtf, replace t(%13.3f) b(%13.3f) drop( *year* )


* est_store_names:


* using:含义同上。


* replace:含义同上。


* append:含义同上。


* drop:不讲演输入变量的系数;drop(_cons)表示不需求讲演常数项。


* keep:


* varlabels:


基准回归 ** # 3、基准回归剖析--**********3.1基准回归-表3**********(P8页)


use 数据, clear


xtset code year


qui xtreg Labor Policy i.year,fe vce(cluster code) // 不带控制变量 //


est store m1


qui xtreg Labor Policy $ci.year ,fe vce(cluster code)


est store m2


qui xtreg Hlabor Policy i.year ,fe vce(cluster code)


est store m3


qui xtreg Hlabor Policy $ci.year ,fe vce(cluster code)


est store m4


lxhreg m1 m2 m3 m4 using 基准回归结果1.rtf, replace t(%13.3f)b(%13.3f) drop( *year* )


DID有效性检验与其他稳健性测试 ** # 4、**********3.2 DID有效性检验与其他稳健性测试**********


************平行趋向检验-图2******


use 数据,clear


xtset code year


replace Policy_year=. ifPolicy_year==0


gen yeardif=year-Policy_year


xtset code year


eventdd Labor $ci.year, timevar(yeardif) method(fe) cluster(code) level(95) baseline(0) ///


graph_op( yline(0,lcolor(edkblue*0.8) ) ///


xlabel(-6 "- 6"-5 "- 5"-4 "- 4"-3 "- 3"-2 "-2"-1 "-1"0 "0"1 "1"2 "2"3 "3"4 "4"5 "5"6 "6") ///


ylabel(-0.1(0.1)0.4,format (%7.1f)) ///


xline(0 ,lwidth(vthin) lpattern(dash) lcolor(teal)) ///


xtitle(` "{fontface "宋体 ": 政策时点}"', size(medium small)) ///


ytitle(`"{fontface "宋体": 回归系数}{stSerif: (Labor)}"' , size(medium small)) ///


legend(order(2 ` "{fontface "宋体 ": 回归系数}"' 1 "95% confidence interval" )) scheme(s1mono))


graph export "平行趋向Labor.png", replace


eventdd Hlabor $c i.year, timevar(yeardif) method(fe) cluster(code) level(95) baseline(0) ///


graph_op( yline(0,lcolor(edkblue*0.8) ) ///


xlabel(-6 "- 6" -5 "- 5" -4 "- 4" -3 "- 3" -2 "-2" -1 "-1" 0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6") ///


ylabel(-0.2(0.2)1,format (%7.1f)) ///


xline(0 ,lwidth(vthin) lpattern(dash) lcolor(teal)) ///


xtitle(`"{fontface "宋体": 政策时点}"' , size(medium small)) ///


ytitle(` "{fontface "宋体 ": 回归系数}{stSerif: (HLabor)}"', size(medium small)) ///


legend(order(2 `"{fontface "宋体": 回归系数}"' 1 "95% confidence interval")) scheme(s1mono))


graph export"平行趋向HLabor.png", replace


预期效应与政策外生性检验 ** # 5、**********************预期效应与政策外生性检验-表4***********


***********预期效应-表4(1)-(2)******


use 数据, clear


replace Policy_year=. ifPolicy_year==0


gen Policy_psy=Policy_year-1


gen Policy_pre1=0


replace Policy_pre1=1 ifyear==Policy_psy & Treat==1


xtset code year


qui xtreg Labor Policy Policy_pre1 $ci.year, fe vce(cluster code)


est store m1


qui xtreg Hlabor Policy Policy_pre1 $ci.year, fe vce(cluster code)


est store m2


lxhreg m1 m2 using 预期效应pre1.rtf,replace t(%13.3f)b(%13.3f) drop (*year*)


********保存政策前样本——政策时点交流为2007年表4(3)-(4)***********


use 数据,clear


keep ifyear<=2007


gen Policy_ps=0


replace Policy_ps=1 ifTreat==1 & year==2007


qui xtreg Labor Policy_ps $ci.year,fe vce(cluster code)


est store m1


qui xtreg Hlabor Policy_ps $ci.year,fe vce(cluster code)


est store m2


lxhreg m1 m2 using 预期效应置换政策2007.rtf,replace t(%13.3f)b(%13.3f) drop (*year*)


***政策随机性——生存剖析(接受政策时点的时间长短)表4(5)-(6)***********


use 数据, clear


replace Policy_year=2015 ifPolicy_year==0


bys code : gen count=_N


drop ifcount<11 /*drop 8362 obs*/


gen dif1=Policy_year-year


// replace dif =5 iftreat==0


drop ifdif1<0


gen poo=0


replace poo=1 ifdif1==0


gen yearcs=2005


stset year, id(code) failure(poo==1) origin(yearcs)


xi:stcox Labor $c, nohr


est store model


xi:stcox Hlabor $c, nohr


est store model1


lxhreg model model1 using cox生存剖析.rtf, replace t(%13.3f)b(%13.3f)


6、安慰剂检验(随机系数法)


** # 6、安慰剂检验(随机系数法)


***************安慰剂检验(随机系数法)-图2(a)、(b)*************


use 数据,clear


duplicates drop code,force


bro code year ifTreat==1 // 591个企业被定义为实验组,将用于被选择//


*-删除暂时文件


forvalue i=1/1000{


erase placebo`i '.dta


}


clear


set matsize 500


* 系数矩阵


mat b = J(500,1,0)


* 规范误矩阵


mat se = J(500,1,0)


* P值矩阵


mat t = J(500,1,0)


forvalues i=1/500{


* 循环1000次


use 数据,clear


duplicates drop code,force


sample 591, count


keep code


cap drop u


gen u = uniform


sort u


drop u


gen j=_n


save matchidt, replace


use 数据,clear


sample 591, count //随机抽取591企业样本


keep year //得到所抽取样本的id编号


cap drop u


gen u = uniform


sort u


drop u


gen j=_n


save matchidy, replace


merge 1:1 j using matchidt


drop j _m


rename year yearrandom


merge 1:m code using regress


replace Treat = (_merge == 3)


gen Postrandom=0


replace Postrandom=1 if year>yearrandom


tostring year ,replace


//gen feffect=substr(indcd,1,2)+substr(year,1,4)


//egen effect=group(feffect)


destring year,replace


global c "Size Lev Roa Soe p_GDP Second_ind "


gen Policy1 = Treat*postrandom


xtset code year


qui xtreg Labor Policy1 $c i.year , fe vce(cluster code)


g _b_random_rep78= _b[Policy1] //提取x的回归系数


g _se_random_rep78= _se[Policy1] //提取x的规范误


qui xtreg Hlabor Policy1 $c i.year , fe vce(cluster code)


g _b_random1_rep78= _b[Policy1] //提取x的回归系数


g _se_random1_rep78= _se[Policy1] //提取x的规范误


keep _b_random_rep78 _se_random_rep78 _b_random1_rep78 _se_random1_rep78


duplicates drop _b_random_rep78 _b_random1_rep78, force


save placebo`i' , replace


}


*- 纵向兼并1000次的系数和规范误


use placebo1, clear


forvalue i=2/500{


append using placebo`i ' //纵向兼并1000次回归的系数及规范误


}


gen tvalue= _b_random_rep78/ _se_random_rep78


gen p2=2*ttail(2910, abs(tvalue))


gen tvalue1= _b_random1_rep78/ _se_random1_rep78


gen p21=2*ttail(2910, abs(tvalue1))


twoway (scatter p2 _b_random_rep78 ,yaxis(1) xline( 0.145, lwidth(0.3) lp(solid)) ///


xlabel(-0.10(0.05)0.15, format(%7.2f) grid) xtitle(Coefficient) ytitle(P value) ylabel(0(0.5)2, format(%7.2f)axis(1) gmin angle(horizontal)) ///


yline(0.1, lwidth(0.2) lp(shortdash) ) ///


msymbol(smcircle_hollow) msize(tiny) legend(off)) (kdensity _b_random_rep78 ,yaxis(2) ytitle("Density",axis(2)) ylabel(0(2)10, axis(2) gmin angle(horizontal))scheme(s1mono) )


graph export "安慰剂检验1.png", replace


twoway (scatter p21 _b_random1_rep78 ,yaxis(1) xline( 0.228, lwidth(0.3) lp(solid)) ///


xlabel(-0.2(0.1)0.3, format(%7.1f) grid) xtitle(Coefficient) ytitle(P value) ylabel(0(0.5)2, format(%7.2f) axis(1) gmin angle(horizontal)) ///


yline(0.1, lwidth(0.2) lp(shortdash) ) ///


msymbol(smcircle_hollow) msize(tiny) legend(off)) (kdensity _b_random1_rep78 ,yaxis(2) ytitle("Density",axis(2)) ylabel(0(1)5, axis(2) gmin angle(horizontal))scheme(s1mono))


graph export "安慰剂检验2.png", replace


*******安慰剂检验(事情年前推一年两年)-附录表A2********


use 数据,clear


gen Policy_current=0


replace Policy_current=1 if b2008==1 & year>2008


gen Policy_pre1=0


replace Policy_pre1=1 if b2008==1 & year>2007


gen Policy_pre2=0


replace Policy_pre2=1 if b2008==1 & yea>2006


replace Policy_current=1 if b2009==1 & year>2009


replace Policy_pre1=1 if b2009==1 & year>2008


replace Policy_pre2=1 if b2009==1 & year>2007


replace Policy_current=1 if b2010==1 & yea>2010


replace Policy_pre1=1 if b2010==1 & year>2009


replace Policy_pre2=1 if b2010==1 & year>2008


keep if year<2011


xtset code year


qui xtreg Labor Policy_pre1 $c i.year,fe vce(cluster code)


est store m1


qui xtreg Hlabor Policy_pre1 $c i.year,fe vce(cluster code)


est store m2


qui xtreg Labor Policy_pre2 $c i.year,fe vce(cluster code)


est store m3


qui xtreg Hlabor Policy_pre2 $c i.year,fe vce(cluster code)


est store m4


lxhreg m1 m2 m3 m4 using 前推一年两年安慰剂.rtf,replace t(%13.3f)b(%13.3f) drop (*year*)


PSM--DID剖析


** # 7、PSM--DID剖析


**************PSM-DID估量-表5*****************


use 数据,clear


preserve


keep ifyear==2007


drop ifb2009==1|b2010==1


save sample2007,replace


restore


preserve


keep ifyear==2008


drop ifb2008==1|b2010==1


save sample2008,replace


restore


preserve


keep ifyear==2009


drop ifb2008==1|b2009==1


save sample2009,replace


restore


*******1:3匹配*********


use sample2007,clear


global c "Size Lev Roa Soe p_GDP Second_ind "


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(3) qui


pstest, both


******核密度图——共同支撑检验-见附录图A1*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.05)0.3, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2007pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.05)0.3, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2007post.png", replace


save ps2007,replace


keep if_weight !=.


save psm2007,replace


use sample2008,clear


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(3) qui


pstest, both


******核密度图——共同支撑检验-附录图A2*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.05)0.25, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2008pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.05)0.25, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2008post.png", replace


save ps2008,replace


keep if_weight !=.


save psm2008,replace


use sample2009,clear


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(3) qui


pstest, both


******核密度图——共同支撑检验-附录图A3*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.1)0.6, format(%7.1f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2009pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.1)0.5, format(%7.1f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2009post.png", replace


save ps2009,replace


keep if_weight !=.


save psm2009,replace


use psm2007,clear


append using psm2008


append using psm2009


duplicates drop code,force


keep code


save psmpipei3,replace


** # 8、PSM--DID剖析


**********PSM-DID1:3估量-表5(1)-(2)列*******


use 数据,clear


merge m:1 code using psmpipei3


keep if_m==3


drop _merge


global c "Size Lev Roa Soe p_GDP Second_ind"


xtset code year


qui xtreg Labor Policy $ci.year ,fe vce(cluster code)


est store ind1


qui xtreg Hlabor Policy $ci.year ,fe vce(cluster code)


est store ind2


lxhreg ind1 ind2 using psm1比3.rtf,replace t(%13.3f)b(%13.3f) drop( *year* )


**************PSM1:5***********


use sample2007,clear


global c "Size Lev Roa Soe p_GDP Second_ind "


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(5) qui


pstest, both


******核密度图——共同支撑检验-附录图A4*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.05)0.3, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比5核密度2007pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.05)0.3, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比5核密度2007post.png", replace


save ps52007,replace


keep if_weight !=.


save psm52007,replace


use sample2008,clear


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(5) qui


pstest, both


******核密度图——共同支撑检验-附录图A5*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.05)0.25, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比5核密度2008pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.05)0.25, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm5核密度2008post.png", replace


save ps52008,replace


keep if_weight !=.


save psm52008,replace


use sample2009,clear


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(5) qui


pstest, both


******核密度图——共同支撑检验-附录图A6*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.1)0.6, format(%7.1f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2009pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.1)0.5, format(%7.1f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"核密度2009post.png", replace


save ps52009,replace


keep if_weight !=.


save psm52009,replace


use psm52007,clear


append using psm52008


append using psm52009


duplicates drop code,force


keep code


save psmpipei5,replace


**********PSM-DID1:5估量-表5(3)-(4)列*******


use 数据,clear


merge m:1 code using psmpipei5


keep if_m==3


drop _merge


global c "Size Lev Roa Soe p_GDP Second_ind "


xtset code year


qui xtreg Labor Policy $ci.year ,fe vce(cluster code)


est store ind1


qui xtreg Hlabor Policy $ci.year ,fe vce(cluster code)


est store ind2


lxhreg ind1 ind2 using psm1比5.rtf,replace t(%13.3f)b(%13.3f) drop( *year* )


*********************全样本PSM匹配——附录表A9-A10***********


************1:3******


use 数据,clear


global c "Size Lev Roa Soe p_GDP Second_ind "


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(3) qui


pstest, both


******核密度图——共同支撑检验-附录图A7*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.1)0.6, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比3核密度全样本pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.1)0.5, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比3核密度全样本post.png", replace


save ps3quan,replace


keep if_weight !=.


save psm3quan,replace


********************全样本1:3匹配PSM-DID估量-附录表A11(1)-(2)*****


use psm3quan, clear


global c "Size Lev Roa Soe p_GDP Second_ind "


xtset code year


qui xtreg Labor Policy $ci.year ,fe vce(cluster code)


est store ind1


qui xtreg Hlabor Policy $ci.year ,fe vce(cluster code)


est store ind2


lxhreg ind1 ind2 using psm1比31.rtf,replace t(%13.3f)b(%13.3f) drop( *year* )


************1:5*********


use 数据,clear


global c "Size Lev Roa Soe p_GDP Second_ind "


capdrop u


gen u = uniform


sort u


psmatch2 Treat $c, common n(5) qui


pstest, both


******核密度图——共同支撑检验-附录图A8*****


//-(a)before matching: 匹配前的密度函数图//


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0,lp(dash) lw(*2.5)), ///


ytitle( "Density") ///


ylabel(,angle(0)) ///


xtitle( "Propensity Score") ///


xscale(titlegap(2)) ///


xlabel(0(0.1)0.6, format(%7.2f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比5核密度全样本pre.png", replace


*-(b)after matching: 匹配后的密度函数图


twoway (kdensity _pscore if_treat==1,lp(solid) lw(*2.5)) ///


(kdensity _pscore if_treat==0&_wei!=.,lp(dash) lw(*2.5)), ///


ytitle( "Density") ylabel(,angle(0)) ///


xtitle( "Propensity Score") xscale(titlegap(2)) ///


xlabel(0(0.1)0.5, format(%7.1f)) ///


legend(label(1 "treat") label(2 "control") row(2) ///


position(3) ring(0)) ///


scheme(s1mono)


graph export"psm1比5核密度全样本post.png", replace


save ps5quan,replace


keep if_weight !=.


save psm5quan,replace


********************全样本1:5匹配PSM-DID估量-附录表A11(3)-(4)*****


use psm5quan, clear


global c "Size Lev Roa Soe p_GDP Second_ind "


xtset code year


qui xtreg labor policy $ci.year ,fe vce(cluster code)


est store ind1


qui xtreg hlabor policy $ci.year ,fe vce(cluster code)


est store ind2


lxhreg ind1 ind2 using psm1比51.rtf,replace t(%13.3f)b(%13.3f) drop( *year* )


更多内容请查看《数量经济技术经济研讨》



路过

雷人

握手

鲜花

鸡蛋
已有 0 人参与

会员评论

文章排行

  • 阅读
  • 评论

最新文章

文章列表

 名表回收网手机版

官网微博:名表回收网服务平台

今日头条二维码 1 微信公众号二维码 1 抖音小程序二维码 1
浙江速典奢贸易有限公司 网站经营许可证 备案号:浙ICP备19051835号2012-2022
名表回收网主要专注于手表回收,二手名表回收/销售业务,可免费鉴定(手表真假),评估手表回收价格,正规手表回收公司,浙江实体店,支持全国范围上门回收手表
返回顶部