Announcement

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

  • Generalized difference in differences with panel data

    Hi, I am relatively new to Stata so any help would be greatly appreciated!

    Q: How do I do a generalized difference-in-differences regression with panel data in Stata?

    Background: I am working on my senior thesis and I want to use a generalized difference-in-differences regression to explore the impact of college sexual assault scandals on application rates. I have a panel dataset with 100 groups (i.e., colleges) and 19 time periods (i.e., years 2001-2019).

    - My dependent variable is number of college applications.
    - The “treatment” is represented by a Scandal dummy variable to indicate if there was a scandal the previous year (i.e., if there was a college scandal in 2002, then the scandal dummy variable would be equal to 1 in 2003 in order to explore the effects on the 2003 college application rates).
    - My control variables include: in-state and out-of-state tuition, common app member (dummy variable), institutional SAT percentile scores, and USNWR Rank for each college every year.

    I hope that makes sense.

    I have struggled to find examples of how to do a generalized difference-in-differences regression in Stata. Also, I would like to learn how to include "college-fixed effects" with my control variables.

    I would really appreciate any help and/or examples, thank you!

  • #2
    https://www.annualreviews.org/doi/pd...-040617-013507 is a good reference on generalized diff-in-diff.

    It will not help you with the specifics of implementing this in Stata however.

    It's not clear to me whether a generalized diff-in-diff is really appropriate here, though. Do you imagine that a scandal in 2002 would still have an effect on applications in, say, 2020? If not, how long do you think the effect actually lasts? In the usual generalized DID model, the assumption is that once the intervention takes place its effects persist indefinitely into the future. Anyway, you need to decide how long you expect the effect to last before you can proceed. In particular, your variable scandal, as currently defined, is only suitable to test the impact in 2003 of a 2002 scandal. Once you decide how long you expect the effect to last, you can modify the scandal variable accordingly.

    Meanwhile, you can run -help xtset- to learn how to tell Stata that you have panel data. That will then enable you to use the -xt- suite of regression commands to estimate your model (once you decide just what model to use). You will also need to decide whether you think the effect is that of skimming a fixed number (same at all affected universities) off the top, or whether you think it is reduction by some fixed proportion. The former would argue for using -xtreg-, but the latter would be more compatible with -xtpoisson-. Specifying the fixed effects is simple: just using the -fe- option in your regression command will automatically deal with the college fixed effects. The time fixed effects are included by specifying i.year (or i.whatever_the_name_of_your_year_variable_is) among the regression predictor variables. Similarly the covariates ("control" variables) are just included in the list of predictor variables in the regression command. For those which are discrete, prefixing them with i. will cause Stata to deal with them appropriately. At least that's the first approximation. Before you do this, you should look at some scatter plots or other graphs to see if a linear relationship between the outcome and covariate looks sensible: you may want to use more complicated specifications of these covariates if the relationships look highly non-linear.\

    Finally, I suggest you search this very Forum for difference-in-differences. It is one of the most frequent topics discussed here and there are probably hundreds if not thousands of threads on the topic, many of which contain worked examples that might serve as a model for you.

    Comment


    • #3
      Hi Dr. Schechter, thank you so much for your help.

      Originally posted by Clyde Schechter View Post

      Do you imagine that a scandal in 2002 would still have an effect on applications in, say, 2020? If not, how long do you think the effect actually lasts?
      .
      In response to your question--- My thesis is modelled after the paper The Impact of Highly Publicized Campus Scandals on College Outcomes by Patrick Rooney and Jonathan Smith. Rooney and Smith’s research included four categories of scandals (sexual assaults, murders, cheating scandals, and hazing scandals), but my paper will focus on media coverage of sexual assault scandals exclusively. I will also introduce gender as a subset of the college application outcome in order to analyze the impact of sexual assault scandals on female application volume versus male application volume. Rooney and Smith found that the impact of a scandal persisted for two years (they figured this out by “leading” the scandal variables by one and two years). Therefore, I expect that a scandal will have an effect for one or two years following the scandal, and not indefinitely into the future.

      Thanks for your advice, I will dig deeper into this forum and see what else I can find.


      Comment


      • #4
        Thanks for explaining. So it sounds like you need your scandal variable to be set to 1 in both the year after the event and in the second year after the event, and 0 in all other years. And it looks like you will want to interact it with the variable giving the sex of the applicant.

        Comment


        • #5
          Hi, I am still working on this paper and I am now beginning to analyze my data. Does this Stata code look correct for a two-way fixed effects regression?

          Code:
           xtreg Y, D, X1, X2,..., Xn, i.year, fe cluster(collegeID)


          Where Y is my dependent variable (i.e., number of applicants), D is my treatment dummy variable, X1...Xn are my control variables, i.year creates the time-fixed effects, fe and creates the college-fixed effects.

          Thank you in advance for your feedback.

          Comment


          • #6
            It is a correct-ish pseudocode. The actual command will not allow any of the commas except for the one separating i.year from fe.

            Comment


            • #7
              Great, thank you!

              Comment

              Working...
              X