Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running a Difference-in-Difference Regression on STATA

    Good Afternoon,

    I'm doing research on the effects of the economic crisis on mortality rates in several provinces and so I have panel data on mortality rates and unemployment rates for different provinces for 14 years by quarter. My dependent variable is mortalityrate and my main independent variable is unemploymentrate. I'm trying to do a difference in difference regression to see the difference in pre-crisis and post-crisis mortality rates. The only STATA work I've done for difference in difference has been for impact evaluation where there was a treatment and control group so I wasn't sure how to apply DID to this particular research.

    I've generated a precrisis variable: year<=2008
    and a postcrisis variable: year>2009

    I then made interaction terms Unemploymentrate*precrisis and Unemploymentrate*postcrisis

    My first question is should I make two interaction terms one for precrisis and one for post or if only one time period is necessary?

    2nd- do I need to create a dummy treatment variable or can I interact with the original unemploymentrate variable?

    My 3rd question is can someone recommend a good method for DID?
    I've seen "xtreg" with DID for controlling for fixed effects (In my regression I want to control for fixed effects for year and province)
    I've also seen some examples with "xi: reg" and others that just use a regular regression.

    Does this regression look okay?
    xtreg mortalityrate unemploymentrate unemploymentrate*precrisis unemploymentrate*postcrisis dummyyear* dummyquarter* dummyprovince*, cluster(province)
    My knowledge of STATA is basic so I'm not familiar with the nuances in the different commands.

    Thank you in advance for any assistance!



  • #2
    Your research question is not spelled out clearly enough for me to understand it. You do not, in any case, have a difference-in-differences design here because there are no treatment and control groups. And it is unclear to me what role you want the unemployment rate to play in your analysis.

    Is your goal to determine whether the relationship between unemployment and mortality rates is different between the pre- and post-crisis eras? If so, that is an interaction model that would look more or less like:

    Code:
    gen byte era = (year > 2008) if !missing(year)
    label define era 0 "Pre-Crisis" 1 "Post-Crisis"
    label values era era
    xtset province quarterly_date
    xtreg mortality_rate i.era##c.unemployment_rate i.year, fe // AND PERHAPS INCLUDE OTHER COVARIATES
    margins era, dydx(unemployment_rate)
    Note that there is no reason to have two separate variables for pre- and post-crisis. You use a single variable that is 0 in one era and 1 in the other. That's all.

    Forget you ever knew about -xi:-. It's obsolete, with its functions having been taken over by factor-variable notation. You definitely should learn factor-variable notation. It's pretty simple. Just read -help fvvarlist-, and then get a little more detail from the linked manual section. The major reason for using factor-variable notation is that then you can use the -margins- command. The -margins- command greatly simplifies the interpretation of models with interaction terms. -margins- is a very powerful, and complicated command. But you can easily learn the basics of it from Richard Williams' excellent Stata Journal Article at http://www.stata-journal.com/sjpdf.h...iclenum=st0260. Once you've gotten used to using it, you can then learn its more advanced features by reading the manual chapter on it, which is well-written and has many clear worked examples.

    Moreover, when you use -xi:- it nullifies the factor-variable notation so that you cannot then correctly make use of -margins-. So it does you no good, and it definitely gets in the way. Yes, there are a few situations where it is still needed. But most of those are archaic commands whose functions have been superseded by more modern commands that do support factor-variable notation. In any case, there is very little role for -xi:- any more, and it is unlikely you will stumble on a situation where you really do need it. The time to break the -xi- habit is now!

    If your research question is not to determine whether the financial crisis modified the relationship between unemployment and mortality rates, then I don't know what your goal is and I can't recommend anything more. I proposed that as your research question because it seems the most sensible thing to do with the data as you describe it.

    Comment


    • #3
      Hi Clyde,

      Thank you so much for your thorough response, it was very helpful! I have started reading the Williams reference you recommended and it is very informative and I will definitely look more into factor-variable notation.

      My research question is whether the relationship between unemployment and mortality rates changed during or after the crisis. Previous research has demonstrated that when unemployment rates rise, mortality rates decrease; mortality rates tend to move in a countercyclical manner. I'm studying whether this trend holds true to the Great Recession in a particular country and studying how this relationship differs between different provinces within that country.

      Your answer confirmed what I had expected, which is that diff-in-diff is not the appropriate method since there isn't a control group. I believe there was a miscommunication between my advisor and I.

      Thank you again for your help! You're a real lifesaver!

      Michelle

      Comment


      • #4
        Michelle,

        Have you looked at using a regression discontinuity design? It sounds like it may be appropriate for your research question and data.

        Bob
        Robert Fitzgerald Senior Research Associate RTI International Berkeley,CA 94702 [email protected]

        Comment


        • #5
          Hey Bob,

          I hadn't, but now that you mention it, I think it would be a good idea to see if there is a jump around the crisis threshold.


          Thank you for your input,

          Lindsey

          Comment

          Working...
          X