安慰剂检验介绍操作及举例_第1页
安慰剂检验介绍操作及举例_第2页
安慰剂检验介绍操作及举例_第3页
安慰剂检验介绍操作及举例_第4页
安慰剂检验介绍操作及举例_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、安慰剂检验介绍(Placebo test )安慰剂是一种附加实证检验的思路,并不存在一个具体的特定的 操作方法。一般存在两种寻找安慰剂变量的方法。比如,在已有的实证检验中,发现自变量Xi会影响自变量Zi与因变量Yi之间存在相关关系。在其后的实证检验中,采用其他主体 (国家,省份,公司)的Xj变量作为安慰剂变量,检验 Xj是否影响 Zi与Yi之间的相关关系。如果不存在类似于 Xi的影响,即可排除Xi 的安慰剂效应,使得结果更为稳健。另一种寻找安慰剂变量的方法。已知, Xi是虚拟变量,Xi=1,if t>T ; Xi=0 if t<T ; Xi对Zi对Yi的影响的影响在T时前后有显著差

2、 异(DID )。在其后的实证检验中,将 Xi'设定为Xi'=1,if t>T+n ; Xi'=0 if t<T+n,其中n根据实际情况取值,可正可负。检验 Xi'是 否影响Zi与Yi之间的相关关系。如果不存在类似于 Xi的影响,即可 排除Xi的安慰剂效应,使得结果更为稳健。举例:以美国市场某种政策冲击识别策略的因果关系考察,在最后部分选取英国同期的因变量,检验是否有类似的特征,就是安慰剂检验。以中国2007年所得税改革作为减税的政策冲击以验证减税对企 业创新的影响。亦可以通过把虚拟的政策实施时间往前往后推几年, 作为虚拟的政策时点,如果检验发现没有

3、类似的因果,文章的主要结 论就更加可信了。以下是详细的例题,安慰剂检验在最后Survivi ng Graduate Econo metrics with R:Differe nce-i n-Differe nces Estimati on2 of 8The follow ing replicati on exercise closely follows the homework assig nment #2 in ECNS 562. The data for this exercise can be found here.The data is about the expa nsion of

4、the Earned In come Tax Credit. This is alegislatio n aimed at provid ing a tax break for low in come in dividuals.For somebackgro und on the subject, seeEissa, Nada, and Jeffrey B. Liebma n. 1996. Labor Supply Resp on ses to theEarned In come Tax Credit. Quarterly Journal of Econ omics.111 (2): 605-

5、637.The homework questi ons (abbreviated):1. Describe and summarize data.2. Calculate the sample means of all variables for (a) sin gle wome n with nochildre n, (b) sin gle wome n with 1 child, and (c) sin gle wome n with 2+ childre n.3. Create a new variable with earnings con diti onal on work ing

6、(miss ing fornon-employed) and calculate the means of this by group as well.4. Con struct a variable for the“ treatme nt” called ANYKIDS and a variable for afterthe expa nsio n (called POST93 should be 1 for 1994 and later).5. Create a graph which plots mean annual employme nt rates by year(1991-199

7、6) for sin gle wome n with childre n (treatme nt) and without childre n(con trol).6. Calculate the uncon diti onal differe nce-i n-differe nee estimates of the effect ofthe 1993 EITC expa nsion on employme nt of sin gle wome n.7. Now run a regressi on to estimate the con diti onal differe nce-i n-di

8、ffere neeestimate of the effect of the EITC. Use all women with children as the treatment group.8. Reestimate this model in cludi ng demographic characteristics.9. Add the state un employme nt rate and allow its effect to vary by the prese nee ofchildre n.10. Allow the treatment effect to vary by th

9、ose with 1 or 2+ children.11. Estimate a “ placebo ” treatment model. Take data from only the pre -reformperiod. Use the same treatme nt and con trol groups. In troduce a placebo policythat begi ns in 1992 (so 1992 and 1993 both have this fake policy).A review: Loadi ng your dataRecall the code for

10、import ing your data:STATA:STATA:/*Last modified 1/11/2011 */*The followi ng block of comma nds go at the start of n early all do files*/*Bracket comme nts with /* */ or just use an asterisk at li ne beg inningclear/*Clears memory*/set mem50m/*Adjustthis for your particular dataset*/cd "C:DATAE

11、co n 562homework" /*Cha nge this for your file structure*/log using stata_assign2.log, replace /*Log file records all commands& results*/ display "$S_DATE $S_TIME"set more offin sheet using eitc.dta, clear*R:# Kevin Gouldi ng# ECNS 562 - Assig nment 23456If If If If If If If If If

12、 If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If If II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II

13、 II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II II# Load the foreig n packagerequire(foreig n)7891011121314# Import data from web site# update: first download the file eitc.dta from this link:# # Then import from your hard drive:eitc

14、 = read.dta("C:/li nk/to/my/dow nl oad/folder/eitc.dta")</pre>Note that any comme nts can be embedded into R code, simply by putti ng a <code> # </code> to the can download the data file, and import it from your hard drive:15eitc = read.dta("C:DATACoursesEcon 562home

15、workeitc.dta")Describe and summarize your dataRecall from part 1 of this series, the following code to describe and summarize your data:dessumR:In R, each colu mn of your data is assig ned a class which will determ ine how your data is treated in various functions. To see what class R has inter

16、preted for all your variables, run the follow ing code:1 sapply(eitc,class)2 summary(eitc)3 source('sumstats.r')4 sumstats(eitc)To output the summary statistics table to LaTeX, use the following code:1 require(xtable)2 xtable(sumstats(eitc)Note: You will n eed to re-run the code for an earli

17、er post.# xtable package helps create LaTeX codesumstats() which you can find inCalculate Con diti onal Sample MeansSTATA: summarize if childre n=0summarize if childre n = 1summarize if childre n >=1summarize if children >=1 & year = 1994 mea n work if post93 = 0 & an ykids = 1R:1 # Th

18、e follow ing code utilizes the sumstats fun cti on (you will n eed to re-run this code)2 sumstats(eitceitc$childre n=0,)3 sumstats(eitceitc$childre n=1,)4 sumstats(eitceitc$childre n>=1,)5 sumstats(eitceitc$childre n>=1 & eitc$year = 1994,)66 # Alternately, you can use the built-in summary

19、 function7 summary(eitceitc$childre n=0,)8 summary(eitceitc$childre n=1,)9 summary(eitceitc$childre n>=1,)10 summary(eitceitc$childre n>=1& eitc$year = 1994,)1211 # Ano ther example: Summarize variable 'work' for wome n with one child from 1993 on wards.-but say you are only intere

20、sted12 summary(subset(eitc, year >= 1993 & childre n = 1, select=work)The code above in cludes all summary statistics in the mea n. You could the n be more specific in your codi ng, like this:1 mean( eitceitc$childre n = 0, 'work')2 mean( eitceitc$childre n = 1, 'work')3 mean(

21、 eitceitc$childre n >= 1, 'work')Try out any of the other head ings withi n the summary output, they should alsowork: min()for mi nimum value,max() for maximum value, stdev() forsta ndard deviati on, and others.Create a New VariableTo create a new variable calledc.ear nequal to earnings c

22、on diti onal onwork ing (ifwork ”= 1),"NA” otherwise (“ userthe foltoQ)ng ce:STATA:STATA: gen cear n = earn if work = 1R:1 eitc$c.ear n=eitc$ear n*eitc$work2 z = n ames(eitc)3 X = as.data.frame(eitc$c.ear n)4 X = lapply(X, fun ctio n(x)replace(x, x = 0, NA)5 eitc = cbin d(eitc,X)6 eitc$c.earn =

23、 NULL7 n ames(eitc) = zCon struct a Treatme nt VariableCon struct a variable for thetreatme nt called“ an ykids” = 1 for treated in dividualpost93(has at least one child); and a variable for after the expa nsion called1 for 1994 and later.STATA: gen an ykids = (childre n >= 1)gen post93 = (year &

24、gt;= 1994)R:1 eitc$post93 = as .n umeric(eitc$year >= 1994)2 eitc$a nykids = as.nu meric(eitc$childre n > 0)Create a plotCreate a graph which plots mean annual employme nt rates by year (1991-1996)for single women with children (treatment) and without children (control).preservecollapse work,

25、by(year an ykids)gen workO = work if an ykids=Olabel var work0 "Si ngle wome n, no childre n"gen work1 = work if an ykids=1label var work1 "Si ngle wome n, childre n"twoway (line work0 year, sort) (line work1 year, sort), ytitle(Labor ForceParticipati on Rates)graph save Graph &q

26、uot;homeworkeitc1.gph", replaceR:1 # Take average value of 'work' by year, con diti onal on an ykids2 minfo = aggregate(eitc$work, list(eitc$year,eitc$a nykids = 1), mean)33 # ren ame colu mn headi ngs (variables)4 n ames(mi nfo) = c("YR","Treatme nt","LFPR"

27、;)65 # Attach a new colu mn with labels6 minfo$Group1:6 = "Single women, no children"7 mi nfo$Group7:12 = "Si ngle wome n, childre n"8 minfo119 require(ggplot2)#package for creati ng n ice plots1310 qplot(YR, LFPR, data=mi nfo, geom=c("poi nt","li ne"), colour

28、=Group,11 xlab="Year", ylab="Labor Force Participatio n Rate")The ggplot2 package produces some nice look ing charts.Calculate the D-l-D Estimate of the Treatme nt EffectCalculate the uncon diti onal differe nce-i n-differe nee estimates of the effect of the 1993 EITC expa nsion

29、on employme nt of sin gle wome n.mean work if post93=0 & an ykids=O mean work if post93=0 & an ykids=1 mean work if post93=1 & an ykids=O mea n work if post93=1 & an ykids=1R:1 a =colMea ns(subset(eitc,post93 = 0& an ykids=0,select=work)2 b =colMea ns(subset(eitc,post93 = 0&

30、an ykids=1,select=work)3 c =colMea ns(subset(eitc,post93 = 1& an ykids=0,select=work)4 d =colMea ns(subset(eitc,post93 = 1& an ykids=1,select=work)5 (d-c)-(b-a)Run a simple D-l-D Regressi onsin© albrk ” , uNow we will run a regressi on to estimate the con diti onal differe nce-i n-diffe

31、re nee estimate of the effect of the Earned In come Tax Credit onwome n with childre n as the treatme nt group. The regressi on equati on is as follows:work =曲 + 血皿乳93 + anykith x 时屛93 ) + £Where is the white no ise error term.STATA:gen in teract ion = post93*a nykidsreg work post93 an ykids in

32、 teracti onR:1 reg1 = lm(work post93 + an ykids + post93*a nykids, data = eitc)2 summary(reg1)In clude Releva nt Demographics in Regressi onAdding additional variables is a matter of including them in your coded regressi on equati on, as follows:STATA:gen age2 = ageA2 /*Create age-squared variable*/

33、gen nonl abori nc = fine - earn/*Non-labor in come*/ reg work post93 an ykids in teracti on non white age age2 ed fine nonl abori ncR:1 reg2 = lm(work an ykids + post93 + post93*a nykids + non white2 + age + I(ageA2) + ed + fine + I(fi nc-ear n), data = eitc)3 summary(reg2)Create some new variablesW

34、e will create two new in teract ion variables:1. The state un employme nt rate in teracted with nu mber of childre n.2. The treatme nt term in teracted with in dividuals with one child, or more tha n onechild.STATA: gen in teru = urate*a nykids gen on ekid = (childre n=1)gen twokid = (childre n>=

35、2)gen postX one = post93* on ekidgen postXtwo = post93*twokidR:1 # The state un employme nt rate in teracted with nu mber of childre n2 eitc$urate.i nt = eitc$urate*eitc$a nykids33 #4 # Creat ing a new treatme nt term:65 # First, we'll create a new dummy variable to distinguish between one child and 2+.6 eitc$ma nykids = as.nu meric(eitc$childre n >= 2)97 # Next, we'll create a new variable by in teract ing the new dummy8 # variable with the origi nal in teract ion term.9 eitc$tr2 = eitc$p93kids.i nteractio n*eitc$ma

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论