双重差分R与Stata

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Differences Differences--in in--Differences estimation in R and Differences estimation in R and S tata Stata

Stata { a.k.a. Difference { a.k.a. Difference--in in--Difference, Difference Difference, Difference--in in--Differences,DD, DID, D Differences,DD, DID, D--I -D. }D. }

DID estimation uses four data points to deduce the impact of a policy change or some other shock (a.k.a. treatment) on the t other shock (a.k.a. treatment) on the treated population: reated population: the effect of the treatment on the

treated . T he structure of the experiment implies that the treatment group and control group

The structure of the experiment implies that the treatment group and control group have similar characteristics and are trending in the same way over time. T his means that This means that the counterfactual the counterfactual (unobserved scenario) is that had the treated group (unobserved scenario) is that had the treated group not received treatment, its mean value would be the same distance from the control group in the second period. S ee the diagram below; the four data points are the observed mean (average) of See the diagram below; the four data points are the observed mean (average) of each group. T each group. These are the only data points necessary to calculate hese are the only data points necessary to calculate the effect of the treatment

on the treated . T he dotted lines represent the trend that is not observed by the

The dotted lines represent the trend that is not observed by the researcher. N otice that although the means are different, they both have the same time Notice that although the means are different, they both have the same time trend trend (i.e. slope). (i.e. slope). (i.e. slope).

For a more thorough work through of the effect of the Earned Income Tax Credit on female employment, see an earlier post of mine: of mine:

Calculate the D Calculate the D--I -D Estimate of the Treatment Effect D Estimate of the Treatment Effect

We will now use R and Stata to calculate the unconditional difference We will now use R and Stata to calculate the unconditional difference--in in--difference estimates of the effect of the 1993 EITC expansion on employment of single women.estimates of the effect of the 1993 EITC expansion on employment of single women.

R:R:

view source print print??

01# Load the foreign package

n)

require(foreign)

02require(foreig

03

04# Import data from web site

05

06require(foreign)

07

08# update: first download the file eitc.dta from this link:

en?id=0B0iAUHM7ljQ1cUZvRWxjUmpfVXM https:///open?id=0B0iAUHM7ljQ1cUZvRWxjUmpfVXM

09# https:///op

10# Then import from your hard drive:

11eitc = read.dta("C:/link/to/my/download/folder/eitc.dta")

12

13# Create two additional dummy variables to indicate before/after 14# and treatment/control groups.

15

16# the EITC went into effect in the year 1994

17eitc$post93 = as.numeric(eitc$year >= 1994)

18

19# The EITC only affects women with at least one child, so the

相关文档
最新文档