Announcement

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

  • Is this model only suitable for DiD and not fixed effects model?



    I'm trying to understand if I can estimate a twoways fixed effects model where I am interested in a threeway interaction variable

    y ~ dummy if a policy has been implemented in a state (time invariant) * holiday dummy (time varying) * fuel price + FE

    Can I estimate this as a fixed effects model or is it DID? I only have data for after the policy was implemented in some states.
    Is the model above only suitable for DID? If so, do I simply estimate y ~ holiday dummy (time varying) * fuel price + FE separately for states where the policy has been implemented and where it hasnt been?

  • #2
    George:
    the DID applies the -fe- estimator: therefor I find youe query unclear.
    Im its basic setup, the DID has two groups (treated and control), one treatment (rando or not) and two periods (before and after the treatment).
    You may want to take a look at -didregress- and -xtdidregress- and/or provide an example/excerpt of yiur data via -dataex-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Not sure didregress and xtdidregress handle interactions on the treatment.

      I assume the gas price is your DV. So you'd have a model

      p = BX + post*treat*holiday + StateFE + TimeFE

      with two DID coefficients (one outside holidays, one inside holidays). Price often rise during holidays (due to high demand), but not sure whether there'd be a difference for whatever the policy is (though that is testable).

      There are many studies looking at gas prices. Look them over for proper specifications.

      Comment


      • #4
        I learnt how -xtdidregress- works trying to replace its results with -xtreg,fe-:
        Code:
        . use https://www.stata-press.com/data/r18/hospdd
        (Artificial hospital admission procedure data)
        
        . xtset hospital
        
        . xtdidregress (satis) (procedure), group(hospital) time(month)
        
        Treatment and time information
        
        Time variable: month
        Control:       procedure = 0
        Treatment:     procedure = 1
        -----------------------------------
                     |   Control  Treatment
        -------------+---------------------
        Group        |
            hospital |        28         18
        -------------+---------------------
        Time         |
             Minimum |         1          4
             Maximum |         1          4
        -----------------------------------
        
        Difference-in-differences regression                     Number of obs = 7,368
        Data type: Longitudinal
        
                                       (Std. err. adjusted for 46 clusters in hospital)
        -------------------------------------------------------------------------------
                      |               Robust
                satis | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------+----------------------------------------------------------------
        ATET          |
            procedure |
        (New vs Old)  |   .8479879   .0320138    26.49   0.000     .7835088    .9124669
        -------------------------------------------------------------------------------
        Note: ATET estimate adjusted for panel effects and time effects.
        
        
        . mat list e(b)
        
        e(b)[1,9]
                  ATET:   Controls:   Controls:   Controls:   Controls:   Controls:   Controls:   Controls:   Controls:
                 r1vs0.         1b.          2.          3.          4.          5.          6.          7.            
             procedure       month       month       month       month       month       month       month       _cons
        y1   .84798786           0  -.00960766   .02196858  -.00328387  -.00940274  -.00383754  -.01119415    3.444675
        
        
        *Let's repeat the drill with -xtreg,fe-*
        
        . gen After=0 if month<=3
        
        . replace After=1 if After==.
        
        . xtreg satis c.After#c.procedure i.month, fe vce(cluster hospital)
        
        Fixed-effects (within) regression               Number of obs     =      7,368
        Group variable: hospital                        Number of groups  =         46
        
        R-squared:                                      Obs per group:
             Within  = 0.1232                                         min =         88
             Between = 0.1340                                         avg =      160.2
             Overall = 0.1308                                         max =        232
        
                                                        F(7, 45)          =     139.59
        corr(u_i, Xb) = 0.0597                          Prob > F          =     0.0000
        
                                             (Std. err. adjusted for 46 clusters in hospital)
        -------------------------------------------------------------------------------------
                            |               Robust
                      satis | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------------+----------------------------------------------------------------
        c.After#c.procedure |   .8479879   .0320138    26.49   0.000     .7835088    .9124669
                            |
                      month |
                  February  |  -.0096077   .0183753    -0.52   0.604    -.0466174    .0274021
                     March  |   .0219686   .0181951     1.21   0.234    -.0146782    .0586153
                     April  |  -.0032839   .0220352    -0.15   0.882     -.047665    .0410972
                       May  |  -.0094027   .0231687    -0.41   0.687     -.056067    .0372615
                      June  |  -.0038375    .019005    -0.20   0.841    -.0421156    .0344406
                      July  |  -.0111941   .0229325    -0.49   0.628    -.0573826    .0349943
                            |
                      _cons |   3.444675   .0113193   304.32   0.000     3.421877    3.467473
        --------------------+----------------------------------------------------------------
                    sigma_u |  .66213621
                    sigma_e |  .72384295
                        rho |  .45556595   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------------
        
        .
        Interestingy, the interaction is between continuous predictors and their main conditional effects are not included.
        The variable -After- was generated by hand to create the two periods (before and after the treatment) to make DID work.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Yes. I always try to code Stata's canned stuff into straight regression. A useful learning experience and allows more flexibility.

          Comment


          • #6
            I took this to mean that fuel price acts as a continuous treatment. Without a pre-treatment period, I guess the idea is to see if the effect of the intervention varies by an observable variable.

            Here's how I would do it. Make sure that the holiday dummies and fuel prices interact with everything. Fixed effects at the state level, and time period dummies, are needed, of course.

            But we need more information. It strikes me that these are data not at the state level (otherwise you can't use state as, effectively, the treatment indicator). Are these panel data at a level lower than the state? Are they repeated cross section data?

            It's possible to modify the usual DID regression to allow continuous treatments. I'll have suggestions if I know more about the structure of the data and the intervention. Did the intervention timing vary, or was it the same for each state?

            Comment


            • #7
              Originally posted by Jeff Wooldridge View Post
              I took this to mean that fuel price acts as a continuous treatment. Without a pre-treatment period, I guess the idea is to see if the effect of the intervention varies by an observable variable.

              Here's how I would do it. Make sure that the holiday dummies and fuel prices interact with everything. Fixed effects at the state level, and time period dummies, are needed, of course.

              But we need more information. It strikes me that these are data not at the state level (otherwise you can't use state as, effectively, the treatment indicator). Are these panel data at a level lower than the state? Are they repeated cross section data?

              It's possible to modify the usual DID regression to allow continuous treatments. I'll have suggestions if I know more about the structure of the data and the intervention. Did the intervention timing vary, or was it the same for each state?
              The policy I'm interested is ban on loss leader pricing. In my data, I observe 10 stores belonging to the same chain spread in 3 US states. The same products are observed in all stores weekly for 5 years. In 2 of these states, retailers/supermarkets cannot price products below cost. I only have post ban data. My goal is to see if prices for groceries and household items vary differently during holidays in ban and no-ban states. I include gas prices in the interaction as proxy for cost (pass through of cost to consumer price). Do you think this is doable, Professor? I guess a fixed effects panel regression maybe applicable than DID with fe.
              There is an endogeneity concern too. Crude oil prices can affect both gas and consumer product prices. Since I can't get hold of weekly crude oil prices by PADD region, I'm thinking of using weekly refiner crude oil input by PADD as IV.
              Last edited by George Tim; 26 Mar 2025, 18:17.

              Comment

              Working...
              X