Announcement

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

  • Fixed effects with three time periods with panel data

    I am doing fixed effects with 3 time periods with panel data. Can I keep my data in long format, add 2 dummy variables d1, d2 for two years and then add fe at the end?
    For example: xtreg Y1 X1...Xt d1 d2, fe. The second option would be to take the differences between periods, leaving actually two time periods. Or something third?
    Anyways, thanks

  • #2
    This is typically preferred. Probably dummies for period two and three. And use vce(cluster id).

    Comment


    • #3
      or reghdfe and absorb both fixed effects, unless you are interested in the time coefficients.

      Comment


      • #4
        Thanks to both of you guys.

        Comment


        • #5
          Ivan:
          why creating N-1 dummies for -i.year- when you can have the T of your panel dataset in one variable only if you adopt the highly recommended -long- format?
          Code:
          use https://www.stata-press.com/data/r19/nlswork.dta
          . xtreg ln_wage i.year c.age##c.age if year<=70, fe vce(cluster idcode)
          
          Fixed-effects (within) regression               Number of obs     =      4,284
          Group variable: idcode                          Number of groups  =      2,230
          
          R-squared:                                      Obs per group:
               Within  = 0.0986                                         min =          1
               Between = 0.0935                                         avg =        1.9
               Overall = 0.0943                                         max =          3
          
                                                          F(4, 2229)        =      42.46
          corr(u_i, Xb) = 0.0558                          Prob > F          =     0.0000
          
                                       (Std. err. adjusted for 2,230 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
               ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                  year |
                   69  |   .0642213   .0256044     2.51   0.012     .0140104    .1144322
                   70  |   .0543866   .0518297     1.05   0.294     -.047253    .1560261
                       |
                   age |   .1968173   .0584201     3.37   0.001     .0822539    .3113808
                       |
           c.age#c.age |  -.0036788    .001181    -3.12   0.002    -.0059948   -.0013629
                       |
                 _cons |  -1.055726    .778866    -1.36   0.175    -2.583105    .4716529
          -------------+----------------------------------------------------------------
               sigma_u |  .36753152
               sigma_e |   .2050529
                   rho |   .7626172   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Grazie mille Carlo. I did my undergraduate studies at Bocconi. Now writing my masters thesis at another university.

            Comment


            • #7
              Grazie a Te, Ivan:
              we share the same alma mater and we both move to another university for different purposes.
              Perfect Italian, by the way.
              Best of luck for what lies ahead.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X