Announcement

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

  • Using ivreg for timeseries data

    Hello,

    I wanted to confirm whether it is appropriate to use the basic 'ivreg' / 'ivregress' command once you've set your data as a timeseries. Or must it stricitly be 'xtivreg'.

    Many thanks,
    Amina

  • #2
    xtset only applies to panel-data estimators and has no bearing on other estimators. However, as with other linear estimators, you can estimate an IV fixed-effects panel data model with ivregress by including indicators, but this is usually not efficient with a large \(N\) dimension.

    Code:
    webuse nlswork, clear
    keep in 1/50
    xtset id year
    xtivreg ln_w age c.age#c.age  (tenure = union south), fe
    ivregress 2sls ln_w age c.age#c.age (tenure = union south) i.id, small
    Res.:

    Code:
    . xtset id year
           panel variable:  idcode (unbalanced)
            time variable:  year, 68 to 88, but with gaps
                    delta:  1 unit
    
    .
    . xtivreg ln_w age c.age#c.age  (tenure = union south), fe
    note: south omitted because of collinearity
    
    Fixed-effects (within) IV regression            Number of obs     =         35
    Group variable: idcode                          Number of groups  =          4
    
    R-sq:                                           Obs per group:
         within  =      .                                         min =          7
         between = 0.6044                                         avg =        8.8
         overall = 0.0135                                         max =         10
    
                                                    Wald chi2(3)      =       7.65
    corr(u_i, Xb)  = -0.4440                        Prob > chi2       =     0.1052
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          tenure |    1.73346   5.927447     0.29   0.770    -9.884122    13.35104
             age |  -1.835107   6.776127    -0.27   0.787    -15.11607    11.44586
                 |
     c.age#c.age |   .0253953   .0947635     0.27   0.789    -.1603377    .2111282
                 |
           _cons |   27.56593   95.89455     0.29   0.774    -160.3839    215.5158
    -------------+----------------------------------------------------------------
         sigma_u |  2.3126893
         sigma_e |   3.997827
             rho |  .25073807   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F  test that all u_i=0:     F(3,28) =     0.05            Prob > F    = 0.9844
    ------------------------------------------------------------------------------
    Instrumented:   tenure
    Instruments:    age c.age#c.age union
    ------------------------------------------------------------------------------
    
    . ivregress 2sls ln_w age c.age#c.age (tenure = union south) i.id, small
    note: south omitted because of collinearity
    
    
    Instrumental variables (2SLS) regression
    
          Source |       SS       df       MS         Number of obs   =         35
    -------------+------------------------------      F(  6,    28)   =       0.04
           Model | -442.730417     6 -73.7884028      Prob > F        =     0.9997
        Residual |  447.513381    28  15.9826207      R-squared       =          .
    -------------+------------------------------      Adj R-squared   =          .
           Total |  4.78296402    34  .140675412      Root MSE        =     3.9978
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          tenure |    1.73346   5.927447     0.29   0.772    -10.40836    13.87528
             age |  -1.835107   6.776127    -0.27   0.789    -15.71537    12.04516
                 |
     c.age#c.age |   .0253953   .0947635     0.27   0.791    -.1687189    .2195094
                 |
          idcode |
              2  |  -4.211043    12.7215    -0.33   0.743    -30.26985    21.84776
              3  |  -3.676052   10.36385    -0.35   0.725    -24.90543    17.55333
              4  |   .0875298    2.54935     0.03   0.973    -5.134578    5.309637
                 |
           _cons |   29.67656   101.5921     0.29   0.772    -178.4255    237.7786
    ------------------------------------------------------------------------------
    Instrumented:  tenure
    Instruments:   age c.age#c.age 2.idcode 3.idcode 4.idcode union
    
    .

    Comment

    Working...
    X