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

下载本文档

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

文档简介

安慰剂检验介绍(Placebo test)安慰剂是一种附加实证检验的思路,并不存在一个具体的特定的操作方法。一般存在两种寻找安慰剂变量的方法。比如,在已有的实证检验中,发现自变量Xi会影响自变量Zi与因变量Yi之间存在相关关系。在其后的实证检验中,采用其他主体(国家,省份,公司)的Xj变量作为安慰剂变量,检验Xj是否影响Zi与Yi之间的相关关系。如果不存在类似于Xi的影响,即可排除Xi的安慰剂效应,使得结果更为稳健。另一种寻找安慰剂变量的方法。已知,Xi是虚拟变量,Xi=1,if tT;Xi=0 if tT+n;Xi=0 if tT+n,其中n根据实际情况取值,可正可负。检验Xi是否影响Zi与Yi之间的相关关系。如果不存在类似于Xi的影响,即可排除Xi的安慰剂效应,使得结果更为稳健。举例:以美国市场某种政策冲击识别策略的因果关系考察,在最后部分选取英国同期的因变量,检验是否有类似的特征,就是安慰剂检验。以中国2007年所得税改革作为减税的政策冲击以验证减税对企业创新的影响。亦可以通过把虚拟的政策实施时间往前往后推几年,作为虚拟的政策时点,如果检验发现没有类似的因果,文章的主要结论就更加可信了。 以下是详细的例题,安慰剂检验在最后。Surviving Graduate Econometrics with R: Difference-in-Differences Estimation 2 of8The following replication exercise closely follows the homework assignment #2 in ECNS 562. The data for this exercise can be foundhere.The data is about the expansion of the Earned Income Tax Credit. This is a legislation aimed at providing a tax break for low income individuals. For some background on the subject, seeEissa, Nada, and Jeffrey B. Liebman. 1996. Labor Supply Responses to the Earned Income Tax Credit. Quarterly Journal of Economics.111(2): 605-637.The homework questions (abbreviated):1. Describe and summarize data.2. Calculate the sample means of all variables for (a) single women with no children, (b) single women with 1 child, and (c) single women with 2+ children.3. Create a new variable with earnings conditional on working (missing for non-employed) and calculate the means of this by group as well.4. Construct a variable for the “treatment” called ANYKIDS and a variable for after the expansion (called POST93should be 1 for 1994 and later).5. Create a graph which plots mean annual employment rates by year (1991-1996) for single women with children (treatment) and without children (control).6. Calculate the unconditional difference-in-difference estimates of the effect of the 1993 EITC expansion on employment of single women.7. Now run a regression to estimate the conditional difference-in-difference estimate of the effect of the EITC. Use all women with children as the treatment group.8. Reestimate this model including demographic characteristics.9. Add the state unemployment rate and allow its effect to vary by the presence of children.10. Allow the treatment effect to vary by those with 1 or 2+ children.11. Estimate a “placebo” treatment model. Take data from only the pre-reform period. Use the same treatment and control groups. Introduce a placebo policy that begins in 1992 (so 1992 and 1993 both have this fake policy).A review: Loading your dataRecall the code for importing your data:STATA:/*Last modified 1/11/2011 */*The following block of commands go at the start of nearly all do files*/*Bracket comments with /* */ or just use an asterisk at line beginningclear /*Clears memory*/set mem 50m /*Adjust this for your particular dataset*/cd C:DATAEcon 562homework /*Change this for your file structure*/log using stata_assign2.log, replace /*Log file records all commands & results*/display $S_DATE $S_TIMEset more offinsheet using eitc.dta, clear*R:123456789101112131415# Kevin Goulding# ECNS 562 - Assignment 2# Load the foreign packagerequire(foreign)# Import data from web site# update: first download the file eitc.dta from this link:# /open?id=0B0iAUHM7ljQ1cUZvRWxjUmpfVXM# Then import from your hard drive:eitc = read.dta(C:/link/to/my/download/folder/eitc.dta)Note that any comments can be embedded into R code, simply by putting a # to the left of your comments (e.g. anything to the right of # will be ignored by R). Alternately, you can download the data file, and import it from your hard drive:eitc = read.dta(C:DATACoursesEcon 562homeworkeitc.dta)Describe and summarize your dataRecall from part 1 of this series, the following code to describe and summarize your data:STATA:dessumR:In R, each column of your data is assigned a class which will determine how your data is treated in various functions. To see what class R has interpreted for all your variables, run the following code:1234sapply(eitc,class)summary(eitc)source(sumstats.r)sumstats(eitc)To output the summary statistics table to LaTeX, use the following code:12require(xtable) # xtable package helps create LaTeX code from R.xtable(sumstats(eitc)Note: You will need to re-run the code forsumstats()which you can find in anearlier post.Calculate Conditional Sample MeansSTATA:summarize if children=0summarize if children = 1summarize if children =1summarize if children =1 & year = 1994mean work if post93 = 0 & anykids = 1R:1234567891011121314# The following code utilizes the sumstats function (you will need to re-run this code)sumstats(eitceitc$children = 0, )sumstats(eitceitc$children = 1, )sumstats(eitceitc$children = 1, )sumstats(eitceitc$children = 1 & eitc$year = 1994, )# Alternately, you can use the built-in summary functionsummary(eitceitc$children = 0, )summary(eitceitc$children = 1, )summary(eitceitc$children = 1, )summary(eitceitc$children = 1 & eitc$year = 1994, )# Another example: Summarize variable work for women with one child from 1993 onwards.summary(subset(eitc, year = 1993 & children = 1, select=work)The code above includes all summary statistics but say you are only interested in the mean. You could then be more specific in your coding, like this:123mean(eitceitc$children = 0, work)mean(eitceitc$children = 1, work)mean(eitceitc$children = 1, work)Try out any of the other headings within the summary output, they should also work:min()for minimum value,max()for maximum value,stdev()for standard deviation, and others.Create a New VariableTo create a new variable called “c.earn” equal to earnings conditional on working (if “work” = 1), “NA” otherwise (“work” = 0) use the following code:STATA:gen cearn = earn if work = 1R:1234567eitc$c.earn=eitc$earn*eitc$workz = names(eitc)X = as.data.frame(eitc$c.earn)X = lapply(X, function(x)replace(x, x = 0, NA)eitc = cbind(eitc,X)eitc$c.earn = NULLnames(eitc) = zConstruct a Treatment VariableConstruct a variable for the treatment called “anykids” = 1 for treated individual (has at least one child); and a variable for after the expansion called “post93” = 1 for 1994 and later.STATA:gen anykids = (children = 1)gen post93 = (year = 1994)R:12eitc$post93 = as.numeric(eitc$year = 1994)eitc$anykids = as.numeric(eitc$children 0)Create a plotCreate a graph which plots mean annual employment rates by year (1991-1996) for single women with children (treatment) and without children (control).STATA:preservecollapse work, by(year anykids)gen work0 = work if anykids=0label var work0 Single women, no childrengen work1 = work if anykids=1label var work1 Single women, childrentwoway (line work0 year, sort) (line work1 year, sort), ytitle(Labor Force Participation Rates)graph save Graph homeworkeitc1.gph, replaceR:123456789101112131415# Take average value of work by year, conditional on anykidsminfo = aggregate(eitc$work, list(eitc$year,eitc$anykids = 1), mean)# rename column headings (variables)names(minfo) = c(YR,Treatment,LFPR)# Attach a new column with labelsminfo$Group1:6 = Single women, no childrenminfo$Group7:12 = Single women, childrenminforequire(ggplot2) #package for creating nice plotsqplot(YR, LFPR, data=minfo, geom=c(point,line), colour=Group,xlab=Year, ylab=Labor Force Participation Rate)The ggplot2 package produces some nice looking charts.Calculate the D-I-D Estimate of the Treatment EffectCalculate the unconditional difference-in-difference estimates of the effect of the 1993 EITC expansion on employment of single women.STATA:mean work if post93=0 & anykids=0mean work if post93=0 & anykids=1mean work if post93=1 & anykids=0mean work if post93=1 & anykids=1R:12345a = colMeans(subset(eitc, post93 = 0 & anykids = 0, select=work)b = colMeans(subset(eitc, post93 = 0 & anykids = 1, select=work)c = colMeans(subset(eitc, post93 = 1 & anykids = 0, select=work)d = colMeans(subset(eitc, post93 = 1 & anykids = 1, select=work)(d-c)-(b-a)Run a simple D-I-D RegressionNow we will run a regression to estimate the conditional difference-in-difference estimate of the effect of the Earned Income Tax Credit on “work”, using all women with children as the treatment group. The regression equation is as follows:Whereis the white noise error term.STATA:gen interaction = post93*anykidsreg work post93 anykids interactionR:12reg1 = lm(work post93 + anykids + post93*anykids, data = eitc)summary(reg1)Include Relevant Demographics in RegressionAdding additional variables is a matter of including them in your coded regression equation, as follows:STATA:gen age2 = age2 /*Create age-squared variable*/gen nonlaborinc = finc - earn /*Non-labor income*/reg work post93 anykids interaction nonwhite age age2 ed finc nonlaborincR:123reg2 = lm(work anykids + post93 + post93*anykids + nonwhite+ age + I(age2) + ed + finc + I(finc-earn), data = eitc)summary(reg2)Create some new variablesWe will create two new interaction variables:1. The state unemployment rate interacted with number of children.2. The treatment term interacted with individuals with one child, or more than one child.STATA:gen interu = urate*anykidsgen onekid = (children=1) gen twokid = (children=2)gen postXone = post93*onekidgen postXtwo = post93*twokidR:123456789101112# The state unemployment rate interacted with number of childreneitc$ = eitc$urate*eitc$anykids# Creating a new treatment term:# First, well create a new dummy variable to distinguish between one child and 2+.eitc$manykids = as.numeric(eitc$c

温馨提示

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

评论

0/150

提交评论