Announcement

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

  • Tests on parameters in the first stage xtivreg

    Dear All,

    suppose that I estimate the following model:

    Code:
    webuse nlswork, clear
    
    xtivreg ln_w age c.age#c.age not_smsa (tenure = union south), first
    
    First-stage G2SLS regression
                                                     Number of obs    =     19,007
                                                     Wald chi(5)      =       4789
                                                     Prob > chi2      =     0.0000
    
    ------------------------------------------------------------------------------
          tenure | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .1357715   .0352866     3.85   0.000     .0666109     .204932
                 |
     c.age#c.age |   .0021357   .0005639     3.79   0.000     .0010305     .003241
                 |
        not_smsa |  -.0178559   .0719943    -0.25   0.804    -.1589621    .1232504
           union |   1.032321   .0646406    15.97   0.000      .905628    1.159015
           south |  -.1311183   .0672238    -1.95   0.051    -.2628745    .0006379
           _cons |   -3.02552   .5391171    -5.61   0.000     -4.08217    -1.96887
    ------------------------------------------------------------------------------
    
    G2SLS random-effects IV regression              Number of obs     =     19,007
    Group variable: idcode                          Number of groups  =      4,134
    
    R-squared:                                      Obs per group:
         Within  = 0.0620                                         min =          1
         Between = 0.1745                                         avg =        4.6
         Overall = 0.1206                                         max =         12
    
                                                    Wald chi2(4)      =     941.52
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          tenure |   .1772948   .0111724    15.87   0.000     .1553972    .1991924
             age |   .0191674   .0066388     2.89   0.004     .0061555    .0321792
                 |
     c.age#c.age |  -.0008496   .0001057    -8.04   0.000    -.0010567   -.0006425
                 |
        not_smsa |  -.2119932   .0130456   -16.25   0.000    -.2375622   -.1864243
           _cons |    1.42761   .1037797    13.76   0.000     1.224205    1.631014
    -------------+----------------------------------------------------------------
         sigma_u |  .33156584
         sigma_e |  .63029359
             rho |  .21674808   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    Instrumented: tenure
     Instruments: age c.age#c.age not_smsa union south
    r; t=0.69 16:59:36
    I would like to run some tests on the first stage of the above regression. I tried to retrieve the results of the first stage, but I was not successful. I also tried to estimate the first stage separetely:

    Code:
    xtreg tenure  union south c.age#c.age not_smsa
    
    Random-effects GLS regression                   Number of obs     =     19,007
    Group variable: idcode                          Number of groups  =      4,134
    
    R-squared:                                      Obs per group:
         Within  = 0.2995                                         min =          1
         Between = 0.0664                                         avg =        4.6
         Overall = 0.1359                                         max =         12
    
                                                    Wald chi2(4)      =    6079.99
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
          tenure | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           union |   .7508115   .0637996    11.77   0.000     .6257666    .8758563
           south |   -.175319   .0792501    -2.21   0.027    -.3306463   -.0199916
                 |
     c.age#c.age |   .0047126   .0000614    76.73   0.000     .0045922     .004833
                 |
        not_smsa |  -.1149192   .0828114    -1.39   0.165    -.2772265    .0473881
           _cons |  -1.448476   .0860632   -16.83   0.000    -1.617156   -1.279795
    -------------+----------------------------------------------------------------
         sigma_u |  2.4452824
         sigma_e |  2.5874158
             rho |  .47178051   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    r; t=0.43 17:02:32
    
    .
    However, as you can see the results are different. Is there any way I can store the results from the first stage, so I can run my tests?

    Thanks in advance

    Dario

  • #2
    The results are different because you forgot to include -age- when you estimated the first stagve separatelyh.

    Comment


    • #3
      Eric de Souza Thanks. I forgot it. But Even if I include age results are still different:

      Code:
      .  xtreg tenure  union south age c.age#c.age not_smsa
      
      Random-effects GLS regression                   Number of obs     =     19,007
      Group variable: idcode                          Number of groups  =      4,134
      
      R-squared:                                      Obs per group:
           Within  = 0.2997                                         min =          1
           Between = 0.0670                                         avg =        4.6
           Overall = 0.1366                                         max =         12
      
                                                      Wald chi2(5)      =    6092.73
      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
            tenure | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
             union |   .7491431   .0637865    11.74   0.000     .6241238    .8741624
             south |   -.176736   .0792176    -2.23   0.026    -.3319997   -.0214724
               age |    .107721   .0327864     3.29   0.001     .0434608    .1719812
                   |
       c.age#c.age |   .0030013   .0005244     5.72   0.000     .0019736     .004029
                   |
          not_smsa |  -.1157893   .0827791    -1.40   0.162    -.2780333    .0464547
             _cons |  -3.073776   .5022193    -6.12   0.000    -4.058108   -2.089444
      -------------+----------------------------------------------------------------
           sigma_u |  2.4435671
           sigma_e |  2.5869529
               rho |  .47151996   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      r; t=0.44 17:13:08

      Comment


      • #4
        You run the first stage regression separately as a random effects model. If I'm not mistaken you should run it as an OLS, thus with the -regress- command, and not -xtreg-. What would that give you?

        Comment


        • #5
          Eric de Souza I got this:

          Code:
          . reg tenure  union south age c.age#c.age not_smsa
          
                Source |       SS           df       MS      Number of obs   =    19,007
          -------------+----------------------------------   F(5, 19001)     =    644.16
                 Model |  46869.1381         5  9373.82761   Prob > F        =    0.0000
              Residual |  276501.655    19,001  14.5519528   R-squared       =    0.1449
          -------------+----------------------------------   Adj R-squared   =    0.1447
                 Total |  323370.793    19,006  17.0141426   Root MSE        =    3.8147
          
          ------------------------------------------------------------------------------
                tenure | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                 union |    1.45793   .0659342    22.11   0.000     1.328693    1.587167
                 south |  -.1623085   .0574846    -2.82   0.005    -.2749835   -.0496336
                   age |   .1858754    .041268     4.50   0.000     .1049866    .2667643
                       |
           c.age#c.age |   .0007105   .0006583     1.08   0.280    -.0005798    .0020008
                       |
              not_smsa |   .1075182   .0624628     1.72   0.085    -.0149145    .2299508
                 _cons |  -2.897401   .6302583    -4.60   0.000    -4.132764   -1.662039
          ------------------------------------------------------------------------------
          still different

          Comment


          • #6
            Unfortunately, I cannot access Stata since a couple of days nor my notes because of a IT issues.

            Comment


            • #7
              A quick look at the online manual for Stata at Stata support gives me the impression that in the case of panel data instrumental variable estimation reproducing the first stage regression will not be so easy If you are interested look at the Methods and Formulas section of the xtivreg command. https://www.stata.com/manuals/xtxtivreg.pdf

              Comment


              • #8
                Eric is correct, you need to do some transformations to the variables if you want to replicate the first stage. There was an earlier thread asking essentially the same question: https://www.statalist.org/forums/for...ivreg-re-first. It should be easier to replicate Baltagi's EC2SLS estimator because it does between and within transformations, but the G2SLS estimator should not be that much difficult to implement. The GLS transformation involves what is referred to as quasi-differencing.

                Comment


                • #9
                  Eric de Souza and Andrew Musau thanks a lot for your help

                  Comment

                  Working...
                  X