Announcement

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

  • Different results from simple DID model and generalized DID model

    Dear Statalist users,


    Hi.

    I am PhD student and trying to estimate the policy impact by using the DID model.


    1. Here is my situation

    - Treatment is happend one time.

    1) So I think my model should use DID model, that is, using interaction term between treatment variable and time variable.

    2) But to test parellel assumption, I employed the generalized TWFE DID model--xtdidregress--which stata 17.0 provided.

    Howerver, I found that the two model provided different results.
    1) xtreg y i.treatment##i.time , fe robust cluster(id)
    here, treatment is assigned 1 for the area of treated, before and after the treatment, 0 for the other area untreated.

    2) xtdidregress
    xtdidregress (y)(Tr), group(id) time(time)
    here, Tr is assigned 1 for the area of treated, after the treatment , 0 for otherwise


    2. Here is my question.

    1) in this situation, must I use 1-1) simple tratditional DID model? (when treatment is happend one time, not the staggered situation)

    2) why those two results of 1-1) and 1-2) provide different estimates?

    3) if I picked 1-2) generalized TWFE DID, is there any problem or consideration I should take care of ?


    Thank you a lot in advance.
    Your answer would be very helpful for me.


    Best regards,

  • #2
    Dear Yeonwoo,
    you are obtaining different results because you are estimating two different models. The command xtdidregress does exactly the same as xtreg (for simple cases like this one). It is not the command that makes the difference but what you are trying to estimate.

    Here is an example with a dataset from the xtdidregress examples. As you can see, the results of the ATET are the same.

    Code:
    . clear
    
    . use https://www.stata-press.com/data/r17/parallelt
    (Simulated data to test parallel-trends assumption)
    
    . xtset id1 t1
    
    Panel variable: id1 (unbalanced)
     Time variable: t1, 1 to 10
             Delta: 1 unit
    
    . xtdidregress (y1 c.x1##c.x2) (treated1), group(id1) time(t1)
    
    Number of groups and treatment time
    
    Time variable: t1
    Control:       treated1 = 0
    Treatment:     treated1 = 1
    -----------------------------------
                 |   Control  Treatment
    -------------+---------------------
    Group        |
             id1 |       102         98
    -------------+---------------------
    Time         |
         Minimum |         1          6
         Maximum |         1          6
    -----------------------------------
    
    Difference-in-differences regression                     Number of obs = 2,000
    Data type: Longitudinal
    
                                                 (Std. err. adjusted for 200 clusters in id1)
    -----------------------------------------------------------------------------------------
                            |               Robust
                         y1 | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    ------------------------+----------------------------------------------------------------
    ATET                    |
                   treated1 |
    (Treated vs Untreated)  |   .5069426   .0220218    23.02   0.000     .4635166    .5503686
    -----------------------------------------------------------------------------------------
    Note: ATET estimate adjusted for covariates, panel effects, and time effects.
    
    . 
    . xtreg y1 treated1 c.x1##c.x2 i.t1, fe
    
    Fixed-effects (within) regression               Number of obs     =      2,000
    Group variable: id1                             Number of groups  =        200
    
    R-squared:                                      Obs per group:
         Within  = 0.6203                                         min =         10
         Between = 0.5186                                         avg =       10.0
         Overall = 0.5603                                         max =         10
    
                                                    F(13,1787)        =     224.56
    corr(u_i, Xb) = 0.1447                          Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
              y1 | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
        treated1 |   .5069426    .023924    21.19   0.000     .4600206    .5538646
              x1 |   .7112104   .0444209    16.01   0.000     .6240881    .7983327
              x2 |  -.1094206    .043306    -2.53   0.012    -.1943564   -.0244848
                 |
       c.x1#c.x2 |   .0149095   .0767333     0.19   0.846     -.135587     .165406
                 |
              t1 |
              2  |  -.1541339   .0267358    -5.77   0.000    -.2065707   -.1016971
              3  |  -.2044108   .0267177    -7.65   0.000     -.256812   -.1520096
              4  |  -.3763776   .0267226   -14.08   0.000    -.4287885   -.3239667
              5  |  -.5067202    .026735   -18.95   0.000    -.5591553    -.454285
              6  |  -.8435519   .0291788   -28.91   0.000      -.90078   -.7863237
              7  |  -.8102568   .0291663   -27.78   0.000    -.8674606   -.7530531
              8  |  -.8658662   .0291897   -29.66   0.000    -.9231158   -.8086166
              9  |  -.9197486   .0291731   -31.53   0.000    -.9769655   -.8625317
             10  |  -.9411258   .0291658   -32.27   0.000    -.9983286   -.8839231
                 |
           _cons |   7.544493   .0310743   242.79   0.000     7.483547    7.605439
    -------------+----------------------------------------------------------------
         sigma_u |  .23212931
         sigma_e |  .26703495
             rho |  .43041211   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(199, 1787) = 6.82                   Prob > F = 0.0000
    
    . 
    end of do-file
    To answer 3, I would use both "basic DiD" as the above and TWFE-DiD to show why parallel trends assumption hold (if it does).

    Hope this helps

    Comment

    Working...
    X