Example: tourism industry

Differences in Differences (using Stata)

Differences in Differences (using stata )(work in progress)Oscar Torres 2015 Difference in Differences (DID)Estimation step by step* Getting sample " ", clear* Create a dummy variable to indicate the time when the treatment started. Lets assume that treatment started in 1994. In this case, years before 1994 will have a value of 0 and 1994+ a 1. If you already have this skip this time = (year>=1994) & !missing(year)* Create a dummy variable to identify the group exposed to the treatment. In this example lets assumed that countries with code 5,6, and 7 were treated (=1). Countries 1-4 were not treated (=0). If you already have this skip this treated = (country>4) & !missing(country)* Create an interaction between time and treated. We will call this interaction did gen did = time*treatedOTR2 Difference in Differences (DID)Estimation step by step* Estimating the DID estimatorreg y time treated did, r* The coefficient for did is the Differences -in- Differences estimator.

References Introduction to econometrics, James H. Stock, Mark W. Watson. 2nd ed., Boston: Pearson Addison Wesley, 2007. “Difference‐in‐Differences Estimation ...

Tags:

  Introduction, Stata

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Differences in Differences (using Stata)

1 Differences in Differences (using stata )(work in progress)Oscar Torres 2015 Difference in Differences (DID)Estimation step by step* Getting sample " ", clear* Create a dummy variable to indicate the time when the treatment started. Lets assume that treatment started in 1994. In this case, years before 1994 will have a value of 0 and 1994+ a 1. If you already have this skip this time = (year>=1994) & !missing(year)* Create a dummy variable to identify the group exposed to the treatment. In this example lets assumed that countries with code 5,6, and 7 were treated (=1). Countries 1-4 were not treated (=0). If you already have this skip this treated = (country>4) & !missing(country)* Create an interaction between time and treated. We will call this interaction did gen did = time*treatedOTR2 Difference in Differences (DID)Estimation step by step* Estimating the DID estimatorreg y time treated did, r* The coefficient for did is the Differences -in- Differences estimator.

2 The effect is significant at 10% with the treatment having a negative effect. _cons +08 +08 +09 +09 did +09 +09 +09 +08 treated +09 +09 +08 +09 time +09 +08 +08 +09 y Coef. Std. Err. t P>|t| [95% Conf. Interval] Robust Root MSE = +09 R-squared = Prob > F = F(3, 66) = regression Number of obs = 70.

3 Reg y time treated did, rOTR3 _cons +08 +08 +09 +09 1 1 +09 +09 +09 +08time#treated +09 +09 +08 +09 +09 +08 +08 +09 y Coef. Std. Err. t P>|t| [95% Conf. Interval] Robust Root MSE = +09 R-squared = Prob > F = F(3, 66) = regression Number of obs = 70.

4 Reg y time##treated, rDifference in Differences (DID)Estimation step by step* Estimating the DID estimator (using the hashtag method, no need to generate the interaction)reg y time##treated, r* The coefficient for time#treated is the Differences -in- Differences estimator ( did in the previous example). The effect is significant at 10% with the treatment having a negative in Differences (DID)Using the command diff**Inference: ** p< ; ** p< ; * p< * Means and Standard Errors are estimated by linear regression P>|t| *t +08 +08 +09 +09 Error +08 +08 +09 +08 +08 +08 +09y +08 +09 +09 +09 +09 +08 +09 Outcome Variable Control Treated Diff(BL) Control Treated Diff(FU)

5 DIFF-IN-DIFF BASE LINE FOLLOW UP DIFFERENCE IN Differences ESTIMATIONR-square: 28 42 Treated: 12 18 30 Control: 16 24 40 Baseline Follow-upNumber of observations in the DIFF-IN-DIFF: 70. diff y, t(treated) p(time)The command diff is user defined for stata . To install typessc install diffp value for the treatment effect, or DID for treatment and time, see previous slideType help diff for more details/optionsOTR5 ReferencesIntroduction to econometrics, James H. Stock, Mark W. Watson. 2nd ed., Boston: Pearson Addison Wesley, 2007. Difference in Differences Estimation , Imbens/Wooldridge, Lecture Notes 10, summer Lecture 3: Differences in Differences , Fabian


Related search queries