《双向固定效应和双重差分资料讲解》由会员分享,可在线阅读,更多相关《双向固定效应和双重差分资料讲解(115页珍藏版)》请在金锄头文库上搜索。
1、双向固定效应和双重差分双向固定效应和双重差分Two-way fixed effectsBalanced panelsi=1,2,3.N groupst=1,2,3.T observations/groupEasiest to think of data as varying across states/timeWrite model as single observationYit= + Xit + ui + vt +itXit is (1 x k) vector2Three-part error structureui group fixed-effects. Control for per
2、manent differences between groupsvt time fixed effects. Impacts common to all groups but vary by yearit - idiosyncratic error3Excises taxes on poor healthAlcohol and cigarettes are taxed at the federal, state and local levelSome states sell liquor rather than tax it (VA, PA, etc.)Most of these taxes
3、 are excise taxes - the tax is per unitRates differ by type of alcohol, alcohol contentNearly all cigarettes taxed the same4Current excise tax ratesCigarettesLow: SC($0.07), MO ($0.17), VA($0.30)High: RI ($3.46), NY ($2.75); NJ($2.70)Average of $1.32 across statesAverage in tobacco producing states:
4、 $0.40Average in non-tobacco states, $1.44Average price per pack is $5.12BeerLow (WY, $0.02/gallon)High (SC, $0.77/gallon)56Federal taxesCigarettes, $1.01/packWine$0.21/750ml bottle for 14% alcohol or less$0.31/750ml bottle for 14 21% alcoholBeer, $0.02 a canLiquor, $13.50 per 100 proof gallon (50%
5、alcohol), or, $2.14/750 ml bottle of 80 proof liquorTotal taxes on cigarettes are such that in NYC, you spend more in taxes buying one case of cigarettes than if you buy 33 cases of wine. 7Do taxes reduce consumption?Law of demandFundamental result of micro economic theoryConsumption should fall as
6、prices riseGenerated from a theoretical model of consumer choiceThought by economists to be fairly universal in application Medical/psychological view certain goods not subject to these laws 8Starting in 1970s, several authors began to examine link between cigarette prices and consumptionSimple rese
7、arch designPrices typically changed due to state/federal tax hikesStates with changes are treatmentStates without changes are control9Near universal agreement in results10% increase in price reduces demand by 4%Change in smoking evenly split betweenReductions in number of smokersReductions in cigs/d
8、ay among remaining smokersResults have been replicatedin other countries/time periods, variety of statistical models, subgroupsFor other addictive goods: alcohol, cocaine, marijuana, heroin, gambling10Taxes now an integral part of antismoking campaignsKey component of Master SettlementSurgeon Genera
9、ls report“raising tobacco excise taxes is widely regarded as one of the most effective tobacco prevention and control strategies.”Tax hikes are now designed to reduce smoking1112131415Current excise tax rateshttp:/www.taxfoundation.org/publications/show/245.htmlState taxes:Low: KY ($0.30/pack), VA (
10、$0.30), SC($0.07)High: RI ($2.46), NJ ($2.58)Average of $1.07 across statesFederal taxes:39 cents/pack 16CautionIn balanced panel, two-way fixed-effects equivalent to subtractingWithin group meansWithin time meansAdding sample meanOnly true in balanced panelsIf unbalanced, need to do the following17
11、Can subtract off means on one dimension (i or t)But need to add the dummies for the other dimension18*generaterealtaxesgens_f_rtax=(state_tax+federal_tax)/cpilabelvars_f_rtaxstate+federalrealtaxoncigs,cents/pack*realpercapitaincomegenln_pcir=ln(pci/cpi)labelvarln_pcirlnofrealrealpercapitaincome*gene
12、ratelnpacks_pcgenln_packs_pc=ln(packs_pc)*constructstateandyeareffectsxii.statei.year19*runtwowayfixedeffectmodelbybruteforce*covariatesarerealtaxandlnpercapitaincomeregln_packs_pc_I*ln_pcirs_f_rtax*nowbemoreeleganttakeoutthestateeffectsbyaregaregln_packs_pc_Iyear*ln_pcirs_f_rtax,absorb(state)*forsi
13、mplicity,redefinevariablesasyx1(ln_pcir)*x2(s-f_rtax)geny=ln_packs_pcgenx1=ln_pcirgenx2=s_f_rtax20*sortdatabystate,thengetmeansofwithinstatevariablessortstatebystate:egeny_state=mean(y)bystate:egenx1_state=mean(x1)bystate:egenx2_state=mean(x2)*sortdatabystate,thengetmeansofwithinstatevariablessortye
14、arbyyear:egeny_year=mean(y)byyear:egenx1_year=mean(x1)byyear:egenx2_year=mean(x2)21*getsamplemeansegeny_sample=mean(y)egenx1_sample=mean(x1)egenx2_sample=mean(x2)*generatethedevaitionsfrommeansgeny_tilda=y-y_state-y_year+y_samplegenx1_tilda=x1-x1_state-x1_year+x1_samplegenx2_tilda=x2-x2_state-x2_yea
15、r+x2_sample*themeansshouldbemachingzerosumy_tildax1_tildax2_tilda22*runtheregressionondifferencedvalues*sincemeansarezero,youshouldhavenoconstant*noticethatthestandarderrorsareincorrect*becausethemodelisnotcountingthe51statedummies*and19yeardummies.TherecordedDOFare*1020-2=1018butitshouldbe1020-2-51
16、-19=948*multiplythestandarderrorsbysqrt(1018/948)=1.036262regy_tildax1_tildax2_tilda,noconstant23.*runtwowayfixedeffectmodelbybruteforce.*covariatesarerealtaxandlnpercapitaincome.regln_packs_pc_I*ln_pcirs_f_rtaxSource|SSdfMSNumberofobs=1020-+-F(71,948)=226.24Model|73.7119499711.03819648ProbF=0.0000R
17、esidual|4.35024662948.004588868R-squared=0.9443-+-AdjR-squared=0.9401Total|78.06219651019.07660667RootMSE=.06774-ln_packs_pc|Coef.Std.Err.tP|t|95%Conf.Interval-+-_Istate_2|.0926469.03211222.890.004.0296277.155666_Istate_3|.245017.03424147.160.000.1778192.3122147Deleteresults_Iyear_1998|-.3249588.022
18、6916-14.320.000-.3694904-.2804272_Iyear_1999|-.3664177.0232861-15.740.000-.412116-.3207194_Iyear_2000|-.373204.0255011-14.630.000-.4232492-.3231589ln_pcir|.2818674.05857994.810.000.1669061.3968287s_f_rtax|-.0062409.0002227-28.030.000-.0066779-.0058039_cons|2.294338.59667983.850.0001.1233723.465304-2
19、4Source|SSdfMSNumberofobs=1020-+-F(2,1018)=466.93Model|3.9907057521.99535287ProbF=0.0000Residual|4.350246621018.004273327R-squared=0.4784-+-AdjR-squared=0.4774Total|8.340952371020.008177404RootMSE=.06537-y_tilda|Coef.Std.Err.tP|t|95%Conf.Interval-+-x1_tilda|.2818674.056534.990.000.1709387.3927961x2_
20、tilda|-.0062409.0002149-29.040.000-.0066626-.0058193-SE on X1 0.05653*1.036262 = 0.05858SE on X2 0.0002149*1.036262 = 0.000222725Difference in difference modelsMaybe the most popular identification strategy in applied work todayAttempts to mimic random assignment with treatment and “comparison” samp
21、leApplication of two-way fixed effects model 26Problem set upCross-sectional and time series dataOne group is treated with interventionHave pre-post data for group receiving interventionCan examine time-series changes but, unsure how much of the change is due to secular changes27timeYt1t2YaYbYt1Yt2T
22、rue effect = Yt2-Yt1Estimated effect = Yb-Yati28Intervention occurs at time period t1True effect of lawYa YbOnly have data at t1 and t2If using time series, estimate Yt1 Yt2Solution?29Difference in difference modelsBasic two-way fixed effects modelCross section and time fixed effectsUse time series
23、of untreated group to establish what would have occurred in the absence of the interventionKey concept: can control for the fact that the intervention is more likely in some types of states30Three different presentationsTabularGraphicalRegression equation31Difference in DifferenceBeforeChangeAfterCh
24、angeDifferenceGroup 1(Treat)Yt1Yt2Yt = Yt2-Yt1Group 2(Control)Yc1Yc2Yc=Yc2-Yc1DifferenceYYt Yc32timeYt1t2Yt1Yt2treatmentcontrolYc1Yc2Treatment effect=(Yt2-Yt1) (Yc2-Yc1)33Key AssumptionControl group identifies the time path of outcomes that would have happened in the absence of the treatmentIn this
25、example, Y falls by Yc2-Yc1 even without the interventionNote that underlying levels of outcomes are not important (return to this in the regression equation)34timeYt1t2Yt1Yt2treatmentcontrolYc1Yc2Treatment effect=(Yt2-Yt1) (Yc2-Yc1)TreatmentEffect35In contrast, what is key is that the time trends i
26、n the absence of the intervention are the same in both groups If the intervention occurs in an area with a different trend, will under/over state the treatment effectIn this example, suppose intervention occurs in area with faster falling Y36timeYt1t2Yt1Yt2treatmentcontrolYc1Yc2True treatment effect
27、Estimated treatmentTrueTreatmentEffect37Basic Econometric ModelData varies by state (i)time (t)Outcome is YitOnly two periodsIntervention will occur in a group of observations (e.g. states, firms, etc.)38Three key variablesTit =1 if obs i belongs in the state that will eventually be treatedAit =1 in
28、 the periods when treatment occursTitAit - interaction term, treatment states after the interventionYit = 0 + 1Tit + 2Ait + 3TitAit + it39Yit = 0 + 1Tit + 2Ait + 3TitAit + itBeforeChangeAfterChangeDifferenceGroup 1(Treat)0+ 10+ 1+ 2+ 3Yt = 2+ 3Group 2(Control)00+ 2Yc= 2DifferenceY = 340More general
29、modelData varies by state (i)time (t)Outcome is YitMany periodsIntervention will occur in a group of states but at a variety of times41ui is a state effectvt is a complete set of year (time) effectsAnalysis of covariance modelYit = 0 + 3 TitAit + ui + vt + it42What is nice about the modelSuppose int
30、erventions are not random but systematicOccur in states with higher or lower average YOccur in time periods with different YsThis is captured by the inclusion of the state/time effects allows covariance between ui and TitAitvt and TitAit43Group effects Capture differences across groups that are cons
31、tant over timeYear effectsCapture differences over time that are common to all groups44Meyer et al.Workers compensationState run insurance programCompensate workers for medical expenses and lost work due to on the job accidentPremiumsPaid by firmsFunction of previous claims and wages paidBenefits -
32、% of income w/ cap45Typical benefits scheduleMin( pY,C)P=percent replacementY = earningsC = cape.g., 65% of earnings up to $400/month46Concern: Moral hazard. Benefits will discourage return to workEmpirical question: duration/benefits gradientPrevious estimatesRegress duration (y) on replaced wages
33、(x)Problem: given progressive nature of benefits, replaced wages reveal a lot about the workersReplacement rates higher in higher wage states47Yi = Xi + Ri + iY (duration)R (replacement rate)Expect 0Expect Cov(Ri, i) Higher wage workers have lower R and higher duration (understate)Higher wage states
34、 have longer duration and longer R (overstate)48SolutionQuasi experiment in KY and MIIncreased the earnings capIncreased benefit for high-wage workers (Treatment)Did nothing to those already below original cap (comparison)Compare change in duration of spell before and after change for these two grou
35、ps 495051ModelYit = duration of spell on WCAit = period after benefits hikeHit = high earnings group (IncomeE3)Yit = 0 + 1Hit + 2Ait + 3AitHit + 4Xit + itDiff-in-diff estimate is 35253Questions to ask?What parameter is identified by the quasi-experiment? Is this an economically meaningful parameter?
36、What assumptions must be true in order for the model to provide and unbiased estimate of 3?Do the authors provide any evidence supporting these assumptions?54More general modelMany within group estimators that do not have the nice discrete treatments outlined above are also called difference in diff
37、erence modelsCook and Tauchen. Examine impact of alcohol taxes on heavy drinkingStates tax alcoholExamine impact on consumption and results of heavy consumption death due to liver cirrhosis 55Yit = 0 + 1 INCit + 2 INCit-1 + 1 TAXit + 2 TAXit-1 + ui + vt + iti is state, t is yearYit is per capita alc
38、ohol consumptionINC is per capita incomeTAX is tax paid per gallon of alcohol56Some KeysModel requires that untreated groups provide estimate of baseline trend would have been in the absence of interventionKey find adequate comparisonsIf trends are not aligned, cov(TitAit,it) 0Omitted variables bias
39、How do you know you have adequate comparison sample?57Do the pre-treatment samples look similarTricky. D-in-D model does not require means match only trends.If means match, no guarantee trends willHowever, if means differ, arent you suspicious that trends will as well? 58Develop tests that can falsi
40、fy modelYit = 0 + 3 TitAit + ui + vt + itWill provide unbiased estimate so long as cov(TitAit, it)=0Concern: suppose that the intervention is more likely in a state with a different trendIf true, coefficient may show up prior to the intervention59Add “leads” to the model for the treatmentInterventio
41、n should not change outcomes before it appearsIf it does, then suspicious that covariance between trends and intervention60Yit = 0 + 3 TitAit + 1TitAit+1 + 2 TitAit+2 + 3TitAit+3 + ui + vt + itThree “leads”Test null: Ho: 1=2=3=061Pick control groups that have similar pre-treatment trendsMost studies
42、 pick all untreated data as controlsExample: Some states raise cigarette taxes. Use states that do not change taxes as controlsExample: Some states adopt welfare reform prior to TANF. Use all non-reform states as controlsIntuitive but not likely correct 62Can use econometric procedure to pick contro
43、lsAppealing if interventions are discrete and few in numberEasy to identify pre-post 63Card and SullivanExamine the impact of job trainingSome men are treated with job skills, others are notMost are low skill men, high unemployment, frequent movement in and out of workEight quarters of pre-treatment
44、 data for treatment and controls64Let Yit =1 if “i” worked in time tThere is then an eight digit sequence of outcomes“11110000” or “10100111”Men with same 8 digit pre-treatment sequence will form control for the treatedPeople with same pre-treatment time series are matched65Intuitively appealing and
45、 simple procedureDoes not guarantee that post treatment trends would be the same but, this is the best you have.66More systematic modelData varies by individual (i), state (s), timeIntervention is in a particular stateYist = 0 + Xist 2+ 3 TstAst + us + vt + istMany states available to be controlsHow
46、 do you pick them?67Restrict sample to pre-treatment periodState 1 is the treated stateState k is a potential controlRun data with only these two statesEstimate separate year effects for the treatment stateIf you cannot reject null that the year effects are the same, use as control68Unrestricted mod
47、el Pretreatment years so TstAst not in modelM pre-treatment yearsLet Wt=1 if obs from year tYist = 0 + Xist 2+ t=2tWt + t=2 t TiWt + us + istHo: 2= 3= m=069Tyler et al.Impact of GED on wagesGeneral education development degreeEarn a HS degree by passing an examExam pass rates vary by stateIntroduced
48、 in 1942 as a way for veterans to earn a HS degree Has expanded to the general public 70In 1996, 760K dropouts attempted the examLittle human capital generated by studying for the examReally measures stock of knowledgeHowever, passing may signal something about ability71Identification strategyUse va
49、riation across states in pass rates to identify benefit of a GEDHigh scoring people would have passed the exam regardless of what state they lived inLow scoring people are similar across states, but on is granted a GED and the other is not72NYCTABDCEFIncreasing scoresPassing Scores CTPassing score N
50、Y73Groups A and B pass in either stateGroup D passes in CT but not in NYGroup C looks similar to D except it does not pass74What is impact of passing the GEDYis=earnings of person i in state sLis = earned a low scoreCTis = 1 if live in a state with a generous passing scoreYis = 0 + Lis1 + CT2 + LisC
51、Tis 3 + is75Difference in DifferenceCTNYDifferenceTest score is lowDC(D-C)Test score is highBA(B-A)Difference(D-C) (B-A)76How do you get the dataFrom ETS (testing agency) get social security numbers (SSN) of test takes, some demographic data, state, and test scoreGive Social Security Admin. a list o
52、f SSNs by group (low score in CT, high score in NY)SSN gives you back mean, std.dev. # obs per cell777879Acemoglu and Angristada_jpe.doada_jpe.log80Americans with Disability ActRequires that employers accommodate disabled workersOutlaws discrimination based on disabilitiesPasses in July 1990, effect
53、ive July 1992May discourage employment of disabledCosts of accommodationsMaybe more difficult to fire disabled81Econometric modelDifference in differenceHave data before/after law goes into effectTreated group disabled Control non-disabledTreatment variable is interactionDiabled * 1992 and after82Yi
54、t = Xit + Di + Yeartt + Yeart Ditt + itYit = labor market outcome, person i year tXit vector of individual characteristics Dit =1 if disableldYeart = year effectYeart Dit = complete set of year x disability interactions 83Coef on is should be zero before the lawMay be non zero for years=1992848586Da
55、taMarch CPSAsks all participants employment/income data for the previous yearEarnings, weeks worked, usual hours/weekData from 1988-1997 March CPSData for calendar years 1987-1996Men and women, aged 21-58Generate results for various subsamples87Constructs sets of dummiesFor year, region and ageGener
56、ate year x Disabilityinteractions88Table 2ADA not in effectEffective years of ADA89Model with few controlsAfter adding extensive listOf controls, results change little90reg wkswork1 _Iy* disabled d_y*;Include all variablesthat begin with_lyInclude all variablesthat begin with d_y91Need to delete one
57、 year effectSince constant is in modelDisability main effectDisability law interactions# obs close to what is Reported in paper92Run different modelOne treatment variable: Disabled x after 1991. gen ada=yearw=1992;. gen treatment=ada*disabled;Add year effects to model, disabled, them ADA x disabled
58、interaction93ADA reduced work by almost 2 weeks/yearRegression statement94Should you cluster?Intervention varies by year/disabilityShould be within-year correlation in errorsPeople are in the sample two years in a row so there should be some correlation over time Cannot cluster on years since # grou
59、ps too small95Need larger set that makes senseTwo options (many more)Cluster on stateCluster on state/disability96. gen disabled_state=100*disabled+statefip;reg wkswork1 _Ia* _Iy* _Ir* white black hispanic lths hsgrad somecol disabled treatment, cluster(statefip);.reg wkswork1 _Ia* _Iy* _Ir* white b
60、lack hispanic lths hsgrad somecol disabled treatment, cluster(disabled_state);97Summary of results for clusterCoefficient on treatment (standard error)Regular OLS -1.998 (0.315)Cluster by state:-1.998 (0.487)Cluster by state/disab.-1.998 (0.532)98Linden and RockoffMegan Kanka7 year old girlsRaped an
61、d murdered by neighbor who was convicted sex offender in 1981Attack on 5 year oldAttempted assault on s7-year oldLead to passage of “Megans Law”99Megans LawSexual Offender (Jacob Wetterling) Act of 1994Sexual offenders required to notify state of change of addressTime limits vary across states (10 y
62、ears after conviction or life)Required of all child sex offenders, some states require of all offenders100Megans Law1996 Amendment to original law required states to publicly announce location and type of offense of sex offendersIndiana sitehttp:/ questionCrime negatively impacts property valuesProb
63、lem: crime is not random and neither are home purchasesTherefore, getting an estimate of the impact of crime on housing prices is toughMegans lawSex offenders will most likely live in poorer areasHow to separate the impact from their 102MethodologyCompare house sales in neighborhoods before and afte
64、r arrival of sex offenderImpact should be “local” so comparison sample is those on the same neighborhood but not near the offender103NC registryBetween 1/1/1996 3/9/2003A total of 8287 released offenders required to register1007 left the stateOf the remaining, 103 (1.4 percent) failed to register104
65、DataLocation/timing of sex offenders addressMatched to home sales data Charlotte/Mecklenburg county1994-2004Detailed characteristics of home sales170,000 homes9,000 within 1/3 miles of a sex offender105106107108109Pijt = price of home i, neighborhood j, time tX = vector of home characteristicsjt = t
66、ime-varying neighborhood effectPostit =1 if sale happens after sex offender arrival in the neighborhoodD3/10 and D1/10 are dummies for whether the home is 0.1-0.3 and 0.1 miles from a sex offender110Questions:How is identification achieved?What is the key assumption necessary for identification?Why might the estimates be an under-estimate?111Sample: homes within of 0.3 of where a sex offender will eventually move 112113114结束结束