五月天婷亚洲天久久综合网,婷婷丁香五月激情亚洲综合,久久男人精品女人,麻豆91在线播放

  • <center id="8gusu"></center><rt id="8gusu"></rt>
    <menu id="8gusu"><small id="8gusu"></small></menu>
  • <dd id="8gusu"><s id="8gusu"></s></dd>
    樓主: spss1010
    18795 7

    [程序分享] 雙重差分DID-difference in difference 在R中的實現(xiàn) [推廣有獎]

    • 9關(guān)注
    • 17粉絲

    Messi

    學(xué)科帶頭人

    33%

    還不是VIP/貴賓

    -

    威望
    0
    論壇幣
    5588 個
    通用積分
    27.7197
    學(xué)術(shù)水平
    97 點
    熱心指數(shù)
    100 點
    信用等級
    83 點
    經(jīng)驗
    2525 點
    帖子
    735
    精華
    0
    在線時間
    3482 小時
    注冊時間
    2011-2-22
    最后登錄
    2024-12-16

    樓主
    spss1010 發(fā)表于 2014-12-24 21:48:21 |只看作者 |壇友微信交流群|倒序 |AI寫論文
    相似文件 換一批

    +2 論壇幣
    k人 參與回答

    經(jīng)管之家送您一份

    應(yīng)屆畢業(yè)生專屬福利!

    求職就業(yè)群
    趙安豆老師微信:zhaoandou666

    經(jīng)管之家聯(lián)合CDA

    送您一個全額獎學(xué)金名額~ !

    感謝您參與論壇問題回答

    經(jīng)管之家送您兩個論壇幣!

    +2 論壇幣
    這是網(wǎng)上搜到的雙重差分的R語言和STATA程序,因為國內(nèi)比較少,分享給大家,一起學(xué)習(xí),共同進步。網(wǎng)址為http://thetarzan.wordpress.com/2011/06/20/differences-in-differences-estimation-in-r-and-stata/Differences-in-Differences estimation in R and Stata{ a.k.a. Difference-in-Difference, Difference-in-Differences,DD, DID, D-I-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 treated population: the effect of the treatment on the treated.  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.  This means that the counterfactual (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.  See the diagram below; the four data points are the observed mean (average) of each group. These are the only data points necessary to calculate the effect of the treatment on the treated.  The dotted lines represent the trend that is not observed by the researcher.  Notice that although the means are different, they both have the same time trend (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:
    DID
    Calculate the D-I-D Estimate of the Treatment EffectWe will now use R and Stata to calculate the unconditional difference-in-difference estimates of the effect of the 1993 EITC expansion on employment of single women.
    R:# Load the foreign packagerequire(foreign)# Import data from web siterequire(foreign)# update: first download the file eitc.dta from this link:# https://docs.google.com/open?id=0B0iAUHM7ljQ1cUZvRWxjUmpfVXM# Then import from your hard drive:eitc = read.dta("C:/link/to/my/download/folder/eitc.dta")# Create two additional dummy variables to indicate before/after# and treatment/control groups.# the EITC went into effect in the year 1994eitc$post93 = as.numeric(eitc$year >= 1994)# The EITC only affects women with at least one child, so the# treatment group will be all women with children.eitc$anykids = as.numeric(eitc$children >= 1)# Compute the four data points needed in the DID calculation:a = sapply(subset(eitc, post93 == 0 & anykids == 0, select=work), mean)b = sapply(subset(eitc, post93 == 0 & anykids == 1, select=work), mean)c = sapply(subset(eitc, post93 == 1 & anykids == 0, select=work), mean)d = sapply(subset(eitc, post93 == 1 & anykids == 1, select=work), mean)# Compute the effect of the EITC on the employment of women with children:(d-c)-(b-a)The result is the width of the “shift” shown in the diagram above.
    STATA:cd "C:\DATA\Econ 562\homework"use eitc, cleargen anykids = (children >= 1)gen post93 = (year >= 1994)mean work if post93==0 & anykids==0     /* value 1 */mean work if post93==0 & anykids==1     /* value 2 */mean work if post93==1 & anykids==0     /* value 3 */mean work if post93==1 & anykids==1     /* value 4 */Then you must do the calculation by hand (shown on the last line of the R code).
    (value 4 – value 3) – (value 2 – value 1)




    二維碼

    掃碼加我 拉你入群

    請注明:姓名-公司-職位

    以便審核進群資格,未注明則拒絕

    關(guān)鍵詞:difference erence DIFFER Diff 雙重差分 difference

    本帖被以下文庫推薦

    Messi is unbeatable ! ! !
    沙發(fā)
    藍色 發(fā)表于 2014-12-24 21:50:35 |只看作者 |壇友微信交流群
    did的stata程序有
    就是一般的回歸模型而已
    也有專門的diff命令
    藤椅
    pengyululu 發(fā)表于 2015-11-28 16:25:21 |只看作者 |壇友微信交流群
    藍色 發(fā)表于 2014-12-24 21:50
    did的stata程序有
    就是一般的回歸模型而已
    也有專門的diff命令
    可是用diff做出來的結(jié)果好像不豐富啊,也不知道怎么解讀,還請大神點撥一下
    板凳
    gusu800829 發(fā)表于 2015-11-30 22:18:24 |只看作者 |壇友微信交流群
    學(xué)習(xí)一下
    報紙
    宴會盤發(fā) 發(fā)表于 2015-12-8 13:50:56 |只看作者 |壇友微信交流群
    樓主能不能發(fā)給我,愿意出50論壇幣。。。因為連接打不開,急求 ,,1034169026@qq.com 非常感謝,
    地板
    支支 發(fā)表于 2015-12-9 20:32:18 |只看作者 |壇友微信交流群
    藍色 發(fā)表于 2014-12-24 21:50
    did的stata程序有
    就是一般的回歸模型而已
    也有專門的diff命令
    請問你那還有stata的DID命令嗎?要是有的話能否傳閱學(xué)習(xí)下,非常感謝。郵箱:274732712@qq.com
    7
    藍色 發(fā)表于 2015-12-10 08:10:08 |只看作者 |壇友微信交流群
    8
    蘿蔔thr 學(xué)生認(rèn)證  發(fā)表于 2017-11-25 11:02:33 |只看作者 |壇友微信交流群
    謝謝樓主
    您需要登錄后才可以回帖 登錄 | 我要注冊

    本版微信群
    加好友,備注cda
    拉您進交流群

    京ICP備16021002-2號 京B2-20170662號 京公網(wǎng)安備 11010802022788號 論壇法律顧問:王進律師 知識產(chǎn)權(quán)保護聲明   免責(zé)及隱私聲明

    GMT+8, 2025-1-1 14:55