如何使用rddtools实现预定带宽

时间:2018-01-18 14:06:48

标签: r regression

我正在使用Card et al medicalare data。我想实现2年的宽度:从ageyrs = 64ageyrs = 66。似乎有关带宽的文档很稀疏。这就是我到目前为止所做的:

load(file ="C:/Users/perdue/Desktop/Adv.MicroEconometrics/HA 9/medicare.Rdata")

rd.medic.1<-rdd_data(y=er,x=ageyrs, covar=ageyrs, cutpoint=65, data = medicare)

x <- medicare$er

y<- medicare$ageyrs

h = dpill(x, y, blockmax = 2, trim = 0.4)

rd.reg.1c <- rdd_reg_lm(rdd_object=rd.medic.1, covariates = "ageyrs", slope = ("same"), covar.opt = list("include", bw = 2))
rd.reg.1a <- rdd_reg_lm(rdd_object=rd.medic.1, covariates = "ageyrs", slope = ("same"), covar.opt = list("include"))

stargazer(rd.reg.1c, rd.reg.1a, type="text")

===========================================================
                                   Dependent variable:     
                               ----------------------------
                                            y              
                                    (1)            (2)     
-----------------------------------------------------------
D                                 9.175***      9.175***   
                                  (3.243)        (3.243)   

x                                14.342***      14.342***  
                                  (0.565)        (0.565)   

ageyrs                                                     


Constant                         479.508***    479.508***  
                                  (2.035)        (2.035)   

-----------------------------------------------------------
Observations                        120            120     
R2                                 0.965          0.965    
Adjusted R2                        0.964          0.964    
Residual Std. Error (df = 117)     8.746          8.746    
F Statistic (df = 2; 117)       1,605.695***  1,605.695*** 
===========================================================
Note:                           *p<0.1; **p<0.05; ***p<0.01

两次回归的点估计和标准误差是相同的,这使我感到相信没有发生任何事情。 如果有关于此主题的文档提供了比CRAN文档更多的信息,请告诉我。

1 个答案:

答案 0 :(得分:0)

我想我有一个解决方案:

rd.medic.1<-rdd_data(y=er,x=ageyrs, covar=ageyrs, cutpoint=65, data = medicare)

h <- rdd_bw_rsw(rd.medic.1, type = "global") 

rd.reg.1a <- rdd_reg_lm(rdd_object=rd.medic.1, covariates = "ageyrs", slope = ("same"), covar.opt = list("include"))

rd.reg.1c <- rdd_reg_lm(rdd_object=rd.medic.1, covariates = "ageyrs", slope = ("same"), covar.opt = list("include"), bw = h)


stargazer(rd.reg.1c, rd.reg.1a, type="text")

plot(rd.reg.1c)

enter image description here

我记得在截止的两边都是1年。我认为这是预期的结果。