Announcement

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

  • Dynamic Diff-in-Diff panel data regression: any advice?

    In my research, I aim to evaluate the impact of Uber's market entry on various labor market variables in Brazil. My panel data is on a quarterly basis, encompassing labor market information for individuals across several Brazilian capitals. Moreover, I possess the specific dates when Uber commenced operations in these cities (totaling 27).

    I intend to apply a dynamic difference-in-differences methodology, correlating my variable of interest with the interaction of each time period and a dummy variable representing Uber's entry.

    My model also integrates covariates at both individual and city levels—I am open to elaborating on these covariates if needed. For fixed effects, I've incorporated time and city-specific factors. However, when executing the model, it omits multiple time periods preceding Uber's introduction. This issue is significant for my analysis because I rely on the estimators from these pre-entry periods to substantiate the presence of parallel trends.

    Here's the code i used for the regression:

    Code:
    xtreg income i.period##i.entry_uberx_dummy ///
    V2007 V2009 V2010 VD3004 VD3005 V1022 VD4012 /// individuals covariates
    smartphone_density car_quantity_pc unemp_rate traffic_deaths govt_transport_expenditure, fe /// cities covariates
    I seek to confirm whether the general structure of my model is sound and whether the nuanced decisions I've made are effective.

    If needed, i can elaborate further in the code. Thanks in advance, everyone




  • #2
    I really think equation (5.15) in Wooldridge (2021) would be the way to go for you. I strongly encourage you to read this paper; Professor Jeff Wooldridge explains the benefits of the flexible extended TWFE Difference in Difference specification perfectly, and provides code at the end to implement it in Stata.

    Comment


    • #3
      Thanks for the reference Maxence. It was one of the references i gathered along with other DID methods. I'll definitely give it a read and try to implement it.

      Comment


      • #4
        Sorry I am posting one of my doubts here, but it seems it is related.
        I am conducting did estimation but the problem is that in the initial period I have both treatment and control group. For example, I have firm level data from 1998-2020 and some of the firms got treated itself in 1998. Now while running the did, I am getting an error like..
        units in time period 1998 cannot be treated
        The first time period in the estimation sample is 1998. This implies units are either always treated or are switching between treatment and control, which violates the
        model's assumptions. You may look at variable _did_cohort to diagnose this behavior.

        command:
        xthdidregress aipw (pat ip age ) (time ), group(id)

        please help.

        Comment


        • #5
          Hello Hariom,

          First, you need to be sure whether, in your research experiment, it's possible for the firms to move in and out of treatment. If they can, you need to investigate if there are papers which proposes estimation methods that allow for this flexibility.

          Regarding the units that where treated since the beginning of your data period, i think that they're little to no use and that you should drop then. But i might be mistaken. Hope you get the help you need here.

          Comment


          • #6
            Hallo Pedro, I have a similar problem to Hariom, I am using the heterogenous DiD to determine the effect of reforms on countries. My dataset starts in 2010 and some countries carried out reforms at that time. To get around the issue of whether countries are moving in and out of treatment, I got data for 2009 were I assume no country had commenced reforms. Yet, I got the same error. Is the one year pretreatment data too short, do I need to go backward further? or what could be the problem? I would appreciate any insight.

            units in time period 2009 cannot be treated
            The first time period in the estimation sample is 2009. This implies units are either always treated or are
            switching between treatment and control, which violates the model's assumptions. You may look at variable
            _did_cohort to diagnose this behavior.

            Comment

            Working...
            X