打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Stata: 不可不知的4种断点回归 (RDD) 中的平滑性检验方法

Stata: 不可不知的4种断点回归 (RDD) 中的平滑性检验方法


断点回归由Thistlewaite and Campbell(1960)首次使用,但直到1990年代末才引起经济学家的重视。Thistlethwaite、Campbell于1960年首次提出使用断点回归设计研究处理效应, 在该文中他们的目的是研究奖学金对于未来学业的影响, 学生是否获得奖学金取决于考试的分数。此后30年, 该方法并未引起学术界的重视,直到1990年以后, 断点回归设计开始被应用于各种领域,并且近年来成为因果分析和政策评估领域最重要的研究方法。

Hahn et al(2001)提供了断点回归在计量经济学理论基础。目前,断点回归在教育经济学、劳动经济学、健康经济学、政治经济学以及区域经济学的应用仍方兴未艾。参见Imbens and Lemieux(2008),Van Der Klaauw(2008)以及Lee and Lemieux(2010)的文献综述。

在进行断点回归(RD)设计时,一般需要检验参考变量分布连续性检验/检验内生分组

这里检验内生分组,即主要检验配置变量,其实就是RD中个体是否将自行进入断点两侧,决定是否进入实验的,并是否存在某种跳跃性的变化。如果存在内生分组,个体将自行进入实验,导致在断点两侧的分布不均匀,这样分组变量x的密度函数f(x)在x=c处不连续,出现左右极限不相等的情况。

McCrary(2008)提出了一种核密度函数的检验方法(命令是DCdensity,介绍见下述操作),将参考变量划分成不同的区间并计算各区间中的个体数量,如果个体能够操纵参考变量,我们将能观测到断点左右个体数量有较大差别,比如很多个体通过操纵到了断点的右侧,那么,在断点右侧的区间中个体数量可能将大大超过断点左侧区间中个体的数量,利用带宽选择和曲线拟合方法, 可以检验在断点处c是否存在跳跃 。

案例数据

Cattaneo, Frandsen和Titiunik构建的数据集(2015),其中包括1914-2010年期间美国参议院在任优势的衡量。

该数据包含以下两个变量的1390个观察值的数据框架。

其包含两个变量vote和margin,vote表示某次选举民主党在州参议院的席位占比,margin表示上次选举中获得相同参议院席位的边际收益,其中大于0表示民主党胜出,反之则为失败。

将vote作为被解释变量,margin作为解释变量,即可研究民主党赢得参议院席位对于在下次选举中获得相同席位的影响。

1、绘图

可以直接使用histogram命令来绘制配置变量的连续性直方图


use 'E:\stata\data\rdrobust_rdsenate.dta'

. ed

. desc

Contains data from E:\stata\data\rdrobust_rdsenate.dta
 Observations:         1,390                  
    Variables:             2                  28 Nov 2012 11:45
-------------------------------------------------------------------------------------------------------------------------------------
Variable      Storage   Display    Value
    name         type    format    label      Variable label
-------------------------------------------------------------------------------------------------------------------------------------
margin          float   %9.0g                 Democratic margin of victory at t (previous election for same seat)
vote            float   %9.0g                 Democratic vote share at t+2
-------------------------------------------------------------------------------------------------------------------------------------
Sorted by: 

. histogram margin , lcolor ( brown ) fcolor ( gs16 ) title ( 'Senate_selection' ) xtitle ( 'margin' )
(bin=31, start=-100, width=6.4516129)



用图形来观测断点处频数的变化和断点两侧的一个变化情况,它的一个优点是简单直观,缺点是由于在不同组间距中间的样本数量不同,因此是很难直观上观测连续性相关的一个属性。

结果为:

通过这个代码我们可以看见分配变量,也就是在临界点处连续性,临界值两侧没有明显的波动,说明分配变量的密度函数的满足连续性

2、麦克拉瑞检验

McCrary(2008)可以通过非官方命令DCdensity来实现,其中DC表示Discontinuity,可以来检验分组变量的密度函数在断点处是否连续。依此判断,是否存在内生分组问题。

该命令的下载地址为:https://eml.berkeley.edu/~jmccrary/DCdensity/

然后将该命令的DCdensity.ado下载安装或者复制到C:\ado\plus,Mac系统的需要自己sysdir查询外部命令安装路径,自行复制下载。命令语法格式为:

DCdensity assign_var,breakpoint(#) generate(Xj Yj r0 fhat se_fhat) graphname(filename) 

其中,assign_var 为分组变量,必选项breakpoint(#)用来指定断点位置,generate(Xj Yj r0 fhat se_fhat)用来指定输出变量名,graphname用来命名指定密度函数图。

代码为:

DCdensity margin , breakpoint ( 0 ) gen ( Xj Yj r0 fhat se_fhat )

结果为

. DCdensity margin , breakpoint ( 0 ) gen ( Xj Yj r0 fhat se_fhat )
Using default bin size calculation, bin size = 1.84133021
Using default bandwidth calculation, bandwidth = 25.8493835

Discontinuity estimate (log difference in height): -.100745626
                                                   (.117145041)
Performing LLR smoothing.
110 iterations will be performed 
...........



可以看出断点两侧密度函数估计值的置信区间有很大部分重叠,所以断点两侧的密度函数不存在显著差异,检验结果为不存在内生分组,可以继续进行断点回归分析。

3、 rdcont 命令

rdcont语法格式为:

rdcont running_var [if] [in], [options]

选项含义为:


    options                 Description
    --------------------------------------------------------------------------
    Options
      alpha(real)            specifies critical value for calculation of
                              optimal bandwidth
      threshold(real)        specifies cutoff value for the test
      qobs(real)             specifies # of observations closest to cutoff
    ------------------------------------------------------------------------

具体表示为:alpha(real) 指定计算最优带宽的临界值 Threshold (real)指定测试的截止值 qobs(real)指定最接近截止点的观测值

案例代码为:

clear
set more off
capture log close
//cd '...'                                     //Change to working directory
log using 'rdcont_example.smcl', replace 

********************************************************************************
//Bugni & Canay (2019) RDD Continuity test on Lee(2008)
********************************************************************************

use table_two_final.dta, clear    //Loading data
capture program drop rdcont       //Installing rdcont program


//Approximate Sign-Test | Bugni & Canay 
rdcont difdemshare if use==1
return list

log off 

使用上述案例数据进行操作的代码为:


rdcont margin , threshold ( 0 )

结果为

 rdcont margin , threshold ( 0 )
RDD non-randomized approximate sign test
Running variable: margin
Cutoff c =       0 | Left of c  Right of c            Number of obs =       1390
-------------------+----------------------            q             =         67
     Number of obs |       640         750
Eff. number of obs |        30          37
 Eff. neighborhood |    -1.347       1.329
-------------------+----------------------
           p-value |     0.464

断点回归在指定测试的临界值0处的P值为0.464,不能拒绝原假设,说明所以断点两侧的密度函数不存在显著差异,是连续的。

4、rddensity命令

语法格式为:

  rddensity var [if] [in] [, c(#) p(#) q(#) kernel(kernelfn)
        fitselect(fitmethod) hl(#) hr(#) hscale(#) bwselect(bwmethod)
        vce(vcemethod) all ]

操作1、使用默认选项进行操作Manipulation test using default options:

rddensity margin


 use 'E:\stata\data\rdrobust_rdsenate.dta'

. rddensity margin
Computing data-driven bandwidth selectors.

RD Manipulation Test using local polynomial density estimation.

Cutoff c =      0.000 | Left of c  Right of c            Number of obs =         1390
----------------------+----------------------            Model         = unrestricted
        Number of obs |       640         750            BW method     =         comb
   Eff. Number of obs |       408         460            Kernel        =   triangular
 Order loc. poly. (p) |         2           2            VCE method    =    jackknife
         Order BC (q) |         3           3
   Bandwidths (hl,hr) | estimated   estimated
     Bandwidth values |    19.841      27.119

Running variable: margin.
---------------------------------------------
               Method |       T        P>|T|
----------------------+----------------------
Robust Bias-Corrected |   -0.8753      0.3814
---------------------------------------------


由于上述稳健的偏差校正(bias-corrected )统计量 取值为-0.8753 ,而其对应的概率值为0.3814。因此接受原假设,认为断点两侧密度函数满足连续性。不存在内生分组问题。

操作2、Manipulation test using all three method available:


. rddensity margin, all

结果为

 . rddensity margin, all
Computing data-driven bandwidth selectors.

RD Manipulation Test using local polynomial density estimation.

Cutoff c =      0.000 | Left of c  Right of c            Number of obs =         1390
----------------------+----------------------            Model         = unrestricted
        Number of obs |       640         750            BW method     =         comb
   Eff. Number of obs |       408         460            Kernel        =   triangular
 Order loc. poly. (p) |         2           2            VCE method    =    jackknife
         Order BC (q) |         3           3
   Bandwidths (hl,hr) | estimated   estimated
     Bandwidth values |    19.841      27.119
     Bandwidth scales |     0.500       0.500

Running variable: margin.
---------------------------------------------
               Method |       T        P>|T|
----------------------+----------------------
         Conventional |   -1.6506      0.0988
        Undersmoothed |   -0.8944      0.3711
Robust Bias-Corrected |   -0.8753      0.3814
---------------------------------------------

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
断点回归方法 (RDD) 全网最全操作指南,保姆级教学
RDD断点回归, Stata程序百科全书式的宝典
RDD:断点回归可以加入控制变量吗?
Stata: 断点回归 (RDD) 教程
【推荐】社会经济政策的计量经济学评估--理论与应用​
【菜单版】stata三天写论文!精确断点回归实战
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服