其他
DID双重差分中安慰剂检验思路及绘图的操作代码分享!
凡是搞计量经济的,都关注这个号了
稿件:econometrics666@126.com
一
Pei Li, Yi Lu, Jin Wang, 2016, Does flattening government improve economic performance? Evidence from China, Journal of Development Economics, 123, 18-37. This paper examines a causal relationship between the flattening of a government hierarchy and economic performance by exploiting a panel data set on government reorganization in China from 1995 to 2012. Delayering has led to increases in revenue and inter-governmental transfers for county governments, but the associated enlarged span of control makes it difficult for upper-level governments to coordinate and monitor local ones. This has led to a reduction in county governments' total public expenditure and pro-growth expenditure, as well as an increase in land corruption. Overall, the flattening of the government hierarchy has a negative effect on economic performance.
Figure 4: Placebo PMC Status forvalues i=1(1)500 { use placebo,clear save pmc_data,replace use pmc_data,clear keep county year drop if year==2012|year==1995 save dummy_data,replace use dummy_data,clear create the false dataset bysort year: keep if _n==1 sample 1, count keep year save temp,replace use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 58, count keep year county rename year pmc_year save pmc_time,replace keep county save pmc_drop,replace update new dummy_data file use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 113, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 75, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 15, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 254, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 201, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 153, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace update new dummy_data file use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace update new temp file bysort year: keep if _n==1 sample 1, count keep year save temp,replace update new pmc_time file use dummy_data,clear merge m:1 year using temp keep if _merge==3 drop _merge sample 87, count keep year county rename year pmc_year save pmc_temp,replace append using pmc_time save pmc_time,replace use pmc_temp keep county save pmc_drop,replace use dummy_data, clear merge m:1 year using temp keep if _merge==1 drop _merge merge m:1 county using pmc_drop keep if _merge==1 drop _merge save dummy_data,replace Generate the PMC variable use pmc_time merge m:m county using pmc_data drop _merge replace pmc_year=2013 if pmc_year==. gen false_pmc=(pmc_year-year<=0) save pmc_data,replace Generate the treatment variable use pmc_time keep county save pmc_county,replace use pmc_data merge m:1 county using pmc_county gen treatment=(_merge==3) drop _merge save pmc_data,replace Regression gen ly=log(gdp_percapita) gen t=year-1994 gen treatment_trend=treatment*t xi: areg ly false_pmc treatment_trend cpe i.year i.year*county_city i.year*poor_county i.year*food_county i.year*provboundary_county i.year*slope i.year*altitude i.year*urban_rate00 i.year*fiscal_gap99,absorb(county) cluster(county) parmest,format (estimate min95 max95 %8.2f p %8.3f) saving("temp.dta", replace) use "temp.dta", clear keep if parm=="false_pmc" append using "pmc_simulations.dta" save "pmc_simulations.dta", replace } erase "temp.dta" use "pmc_simulations.dta", clear drop if estimate==. save "pmc_simulations.dta", replace Graphs Density Plot dpplot estimate,xline(-0.039) xtitle("PMC effect estimate") saving("PDF_PMC_dpplot.gph", replace)
二
借鉴上面这篇文章的范式(在方法上和实证设计上借鉴了上面这篇JDE文章),下面这篇中文文章的安慰剂检验及操作代码。
卢盛峰,董如玉,叶初升.“一带一路”倡议促进了中国高质量出口吗——来自微观企业的证据[J].中国工业经济,2021(03):80-98. "一带一路"倡议促进了沿线国家和地区之间的互联互通,也推动了中国外贸出口的高速增长。然而,这一出口增长源自粗放式数量驱动还是高附加值产品质量驱动,即"一带一路"倡议是否促进了中国高质量出口?针对这一问题的研究将有利于进一步厘清"一带一路"倡议推动中国出口增长的内在动力。本文基于2010—2015年中国海关出口统计数据,通过构建双重差分模型评估了"一带一路"倡议对中国企业出口质量的因果效应,并识别了中间的潜在影响机制。研究结果表明:(1)"一带一路"倡议显著提高了国内沿线城市企业出口产品的平均质量,即显著促进了中国企业的高质量出口;(2)考虑内生性问题、样本选择性偏误及进一步安慰剂检验的结果都表明上述结论具有高度稳健性;(3)在影响机制方面,"一带一路"倡议改善了沿线城市的政策环境,提高了地方政府对企业创新的政策支持力度,最终促进了中国企业的高质量出口。本文的研究对于进一步理解中国"一带一路"倡议的经济效果,以及对中国出口高质量发展的政策实践都具有借鉴意义。
图2:安慰剂检验 cd C:\Users\user\Desktop\数据\placebo set more off forvalues i=1(1)500 { use dodata,clear save ydyl_data,replace use ydyl_data,clear keep citycode _日期 bysort citycode _日期: gen temp_code=_n keep if temp_code==1 drop temp_code drop if _日期==2010 save dummy_data,replace use dummy_data,clear create the false dataset bysort _日期: keep if _n==1 sample 1, count keep _日期 save temp,replace use dummy_data,clear merge m:1 _日期 using temp keep if _merge==3 drop _merge sample 36, count keep _日期 citycode rename _日期 ydyl_日期 save ydyl_time,replace Generate the false_ydyl_after variable use ydyl_time merge 1:m citycode using ydyl_data gen false_citycode=(_merge==3) drop _merge egen tt=mean(ydyl_日期) replace ydyl_日期=tt drop tt gen false_after=(_日期-ydyl_日期>=0) gen false_ydyl_after=false_citycode*false_after save ydyl_data,replace Regression reghdfe ln_quality false_ydyl_after Capital_City_t Yangtz_City_t ratio_fiscal_t ratio_gdp_t lnstudent_t ratio_city_t Capital_City_t2 Yangtz_City_t2 ratio_fiscal_t2 ratio_gdp_t2 lnstudent_t2 ratio_city_t2 Capital_City_t3 Yangtz_City_t3 ratio_fiscal_t3 ratio_gdp_t3 lnstudent_t3 ratio_city_t3 , absorb(i._日期 _企业编码) vce(cluster province) parmest,format (estimate min95 max95 %8.2f p %8.3f) saving("temp.dta", replace) use "temp.dta", clear keep if parm=="false_ydyl_after" append using "ydyl_simulations.dta" save "ydyl_simulations.dta", replace } erase "temp.dta" use "ydyl_simulations.dta", clear drop if estimate==. save "ydyl_simulations.dta", replace Graphs Density Plot dpplot estimate,xline(0.129) xtitle("虚假估计系数") ytitle("估计系数密度分布") saving("PDF_ydyl_dpplot.gph", replace)
三
陈钊,申洋.限购政策的空间溢出与土地资源配置效率[J].经济研究,2021,56(06):93-109.
2.5年,计量经济圈近1000篇不重类计量文章,
可直接在公众号菜单栏搜索任何计量相关问题,
Econometrics Circle
数据系列:空间矩阵 | 工企数据 | PM2.5 | 市场化指数 | CO2数据 | 夜间灯光 | 官员方言 | 微观数据 | 内部数据计量系列:匹配方法 | 内生性 | 工具变量 | DID | 面板数据 | 常用TOOL | 中介调节 | 时间序列 | RDD断点 | 合成控制 | 200篇合辑 | 因果识别 | 社会网络 | 空间DID数据处理:Stata | R | Python | 缺失值 | CHIP/ CHNS/CHARLS/CFPS/CGSS等 |干货系列:能源环境 | 效率研究 | 空间计量 | 国际经贸 | 计量软件 | 商科研究 | 机器学习 | SSCI | CSSCI | SSCI查询 | 名家经验计量经济圈组织了一个计量社群,有如下特征:热情互助最多、前沿趋势最多、社科资料最多、社科数据最多、科研牛人最多、海外名校最多。因此,建议积极进取和有强烈研习激情的中青年学者到社群交流探讨,始终坚信优秀是通过感染优秀而互相成就彼此的。