Announcement

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

  • First stage difference xtivreg vs. xtivreg2

    Hi all,

    I discovered that -xtivreg- and -xtivreg2- produces different results with clustered SE, at least in the first stage. Here is what I do:

    xtset pcode year

    xtivreg, fe vce(robust) first

    Code:
    xtivreg growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe vce(robust) first
    note: year1 omitted because of collinearity.
    note: year18 omitted because of collinearity.
     
    First-stage within regression
     
    Fixed-effects (within) regression               Number of obs     =      9,360
    Group variable: pcode                           Number of groups  =        585
     
    R-squared:                                      Obs per group:
         Within  = 0.2537                                         min =         16
         Between = 0.3202                                         avg =       16.0
         Overall = 0.1966                                         max =         16
     
                                                    F(17,584)         =      24.34
    corr(u_i, Xb) = 0.3450                          Prob > F          =     0.0000
     
                                    (Std. err. adjusted for 585 clusters in pcode)
    ------------------------------------------------------------------------------
                 |               Robust
    HIV_mean_p~v | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
      GDP_PPP_pc |
             L1. |  -2.00e-09   1.07e-09    -1.87   0.062    -4.11e-09    9.87e-11
                 |
           year1 |          0  (omitted)
           year2 |          0  (omitted)
           year3 |   .0156359   .0010809    14.47   0.000      .013513    .0177588
           year4 |   .0147043   .0009866    14.90   0.000     .0127666    .0166421
           year5 |   .0134187   .0009156    14.66   0.000     .0116205    .0152169
           year6 |   .0121423   .0008431    14.40   0.000     .0104864    .0137983
           year7 |   .0108118   .0007856    13.76   0.000     .0092687    .0123548
           year8 |   .0092799   .0007266    12.77   0.000     .0078529    .0107069
           year9 |   .0076829    .000642    11.97   0.000     .0064219    .0089438
          year10 |   .0060961   .0005786    10.54   0.000     .0049597    .0072324
          year11 |   .0050247   .0005304     9.47   0.000      .003983    .0060663
          year12 |   .0042346   .0004855     8.72   0.000     .0032811    .0051881
          year13 |   .0033211   .0004152     8.00   0.000     .0025057    .0041365
          year14 |   .0026812   .0003021     8.87   0.000     .0020878    .0032746
          year15 |   .0020689   .0002121     9.75   0.000     .0016523    .0024856
          year16 |   .0013933   .0001395     9.99   0.000     .0011193    .0016672
          year17 |   .0006147   .0000793     7.76   0.000      .000459    .0007704
          year18 |          0  (omitted)
    MC_mean_prev |  -.0144539    .008176    -1.77   0.078    -.0305119    .0016042
           _cons |   .0605409   .0061373     9.86   0.000     .0484871    .0725948
    -------------+----------------------------------------------------------------
         sigma_u |  .05936565
         sigma_e |   .0096826
             rho |  .97408738   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
     
    Fixed-effects (within) IV regression            Number of obs     =      9,945
    Group variable: pcode                           Number of groups  =        585
     
    R-squared:                                      Obs per group:
         Within  =      .                                         min =         17
         Between = 0.0001                                         avg =       17.0
         Overall = 0.0001                                         max =         17
     
     
                                                    Wald chi2(18)     =    5296.46
    corr(u_i, Xb) = -0.9752                         Prob > chi2       =     0.0000
     
                                     (Std. err. adjusted for 585 clusters in pcode)
    -------------------------------------------------------------------------------
                  |               Robust
    growth_GDP_~c | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    --------------+----------------------------------------------------------------
    HIV_mean_prev |   3.078041    2.36532     1.30   0.193      -1.5579    7.713982
                  |
       GDP_PPP_pc |
              L1. |  -1.53e-10   1.10e-08    -0.01   0.989    -2.16e-08    2.13e-08
                  |
            year1 |          0  (omitted)
            year2 |  -.0445854   .0410674    -1.09   0.278    -.1250761    .0359053
            year3 |  -.0452986   .0397318    -1.14   0.254    -.1231716    .0325743
            year4 |  -.0404836   .0376005    -1.08   0.282    -.1141792     .033212
            year5 |   .0070452    .034956     0.20   0.840    -.0614673    .0755577
            year6 |  -.0123261   .0313743    -0.39   0.694    -.0738186    .0491664
            year7 |  -.0105576   .0279587    -0.38   0.706    -.0653557    .0442405
            year8 |  -.0025755   .0244086    -0.11   0.916    -.0504155    .0452645
            year9 |  -.0131919   .0207124    -0.64   0.524    -.0537875    .0274037
           year10 |  -.0174418   .0165816    -1.05   0.293    -.0499411    .0150576
           year11 |   .0102819   .0141217     0.73   0.467    -.0173961    .0379599
           year12 |   .0012855   .0120502     0.11   0.915    -.0223324    .0249033
           year13 |   .0033463   .0097785     0.34   0.732    -.0158191    .0225118
           year14 |  -.0055607   .0089031    -0.62   0.532    -.0230104    .0118891
           year15 |   .0062522   .0058038     1.08   0.281     -.005123    .0176273
           year16 |  -.0022079   .0035557    -0.62   0.535     -.009177    .0047611
           year17 |  -.0008809   .0016808    -0.52   0.600    -.0041751    .0024134
           year18 |          0  (omitted)
            _cons |  -.1473728   .1170858    -1.26   0.208    -.3768568    .0821111
    --------------+----------------------------------------------------------------
          sigma_u |  .19291119
          sigma_e |  .06111003
              rho |  .90880311   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------
    Instrumented: HIV_mean_prev
     Instruments: L.GDP_PPP_pc year2 year3 year4 year5 year6 year7 year8 year9
                  year10 year11 year12 year13 year14 year15 year16 year17
                  MC_mean_prev
    r; t=0.89 15:05:03
    xtivreg2, fe cluster(pcode) first

    Code:
     
    xtivreg2 growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe cluster(pcode) first
    Warning - collinearities detected
    Vars dropped:       year1 year18
     
    FIXED EFFECTS ESTIMATION
    ------------------------
    Number of groups =       585                    Obs per group: min =        17
                                                                   avg =      17.0
                                                                   max =        17
    Warning - collinearities detected
    Vars dropped:  year1 year18
     
    First-stage regressions
    -----------------------
     
     
    FIXED EFFECTS ESTIMATION
    ------------------------
    Number of groups =       585                    Obs per group: min =        17
                                                                   avg =      17.0
                                                                   max =        17
     
    First-stage regression of HIV_mean_prev:
     
    Statistics robust to heteroskedasticity and clustering on pcode
    Number of obs =                   9945
    Number of clusters (pcode) =       585
    ------------------------------------------------------------------------------
                 |               Robust
    HIV_mean_p~v | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    MC_mean_prev |  -.0129952   .0089758    -1.45   0.148    -.0305899    .0045994
                 |
      GDP_PPP_pc |
             L1. |  -2.99e-09   1.15e-09    -2.61   0.009    -5.23e-09   -7.43e-10
                 |
           year1 |          0  (omitted)
           year2 |     .01637   .0011976    13.67   0.000     .0140224    .0187175
           year3 |   .0157388   .0011052    14.24   0.000     .0135723    .0179052
           year4 |   .0148042   .0010155    14.58   0.000     .0128135    .0167948
           year5 |   .0135153   .0009475    14.26   0.000      .011658    .0153726
           year6 |   .0122371   .0008779    13.94   0.000     .0105163    .0139579
           year7 |   .0109056    .000823    13.25   0.000     .0092923    .0125188
           year8 |   .0093755    .000767    12.22   0.000      .007872     .010879
           year9 |   .0077759   .0006847    11.36   0.000     .0064338     .009118
          year10 |    .006185   .0006211     9.96   0.000     .0049675    .0074026
          year11 |   .0051064   .0005723     8.92   0.000     .0039846    .0062282
          year12 |   .0043111   .0005246     8.22   0.000     .0032829    .0053394
          year13 |   .0033855   .0004471     7.57   0.000     .0025091    .0042618
          year14 |   .0027209   .0003192     8.52   0.000     .0020952    .0033467
          year15 |   .0020889   .0002173     9.61   0.000      .001663    .0025148
          year16 |   .0014029   .0001406     9.97   0.000     .0011272    .0016786
          year17 |   .0006228   .0000811     7.68   0.000     .0004638    .0007819
          year18 |          0  (omitted)
    ------------------------------------------------------------------------------
    F test of excluded instruments:
      F(  1,   584) =     2.10
      Prob > F      =   0.1482
    Sanderson-Windmeijer multivariate F test of excluded instruments:
      F(  1,   584) =     2.10
      Prob > F      =   0.1482
     
     
     
    Summary results for first-stage regressions
    -------------------------------------------
     
                                               (Underid)            (Weak id)
    Variable     | F(  1,   584)  P-val | SW Chi-sq(  1) P-val | SW F(  1,   584)
    HIV_mean_pre |       2.10    0.1482 |        2.10   0.1470 |        2.10
     
    NB: first-stage test statistics cluster-robust
     
    Stock-Yogo weak ID F test critical values for single endogenous regressor:
                                       10% maximal IV size             16.38
                                       15% maximal IV size              8.96
                                       20% maximal IV size              6.66
                                       25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for i.i.d. errors only.
     
    Underidentification test
    Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
    Ha: matrix has rank=K1 (identified)
    Kleibergen-Paap rk LM statistic          Chi-sq(1)=2.04     P-val=0.1528
     
    Weak identification test
    Ho: equation is weakly identified
    Cragg-Donald Wald F statistic                                      22.54
    Kleibergen-Paap Wald rk F statistic                                 2.10
     
    Stock-Yogo weak ID test critical values for K1=1 and L1=1:
                                       10% maximal IV size             16.38
                                       15% maximal IV size              8.96
                                       20% maximal IV size              6.66
                                       25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
     
    Weak-instrument-robust inference
    Tests of joint significance of endogenous regressors B1 in main equation
    Ho: B1=0 and orthogonality conditions are valid
    Anderson-Rubin Wald test           F(1,584)=      13.11     P-val=0.0003
    Anderson-Rubin Wald test           Chi-sq(1)=     13.16     P-val=0.0003
    Stock-Wright LM S statistic        Chi-sq(1)=     24.96     P-val=0.0000
     
    NB: Underidentification, weak identification and weak-identification-robust
        test statistics cluster-robust
     
    Number of clusters             N_clust  =        585
    Number of observations               N  =       9945
    Number of regressors                 K  =         18
    Number of endogenous regressors      K1 =          1
    Number of instruments                L  =         18
    Number of excluded instruments       L1 =          1
     
    IV (2SLS) estimation
    --------------------
     
    Estimates efficient for homoskedasticity only
    Statistics robust to heteroskedasticity and clustering on pcode
     
    Number of clusters (pcode) =       585                Number of obs =     9945
                                                          F( 18,   584) =    38.11
                                                          Prob > F      =   0.0000
    Total (centered) SS     =  24.53840383                Centered R2   =  -0.4217
    Total (uncentered) SS   =  24.53840383                Uncentered R2 =  -0.4217
    Residual SS             =   34.8871044                Root MSE      =   .06105
     
    -------------------------------------------------------------------------------
                  |               Robust
    growth_GDP_~c | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    --------------+----------------------------------------------------------------
    HIV_mean_prev |   3.078041   2.361157     1.30   0.192    -1.549742    7.705824
                  |
       GDP_PPP_pc |
              L1. |  -1.53e-10   1.09e-08    -0.01   0.989    -2.16e-08    2.13e-08
                  |
            year1 |          0  (omitted)
            year2 |  -.0445854   .0409952    -1.09   0.277    -.1249344    .0357637
            year3 |  -.0452986   .0396619    -1.14   0.253    -.1230345    .0324373
            year4 |  -.0404836   .0375343    -1.08   0.281    -.1140495    .0330823
            year5 |   .0070452   .0348945     0.20   0.840    -.0613467    .0754371
            year6 |  -.0123261   .0313191    -0.39   0.694    -.0737104    .0490582
            year7 |  -.0105576   .0279095    -0.38   0.705    -.0652593    .0441441
            year8 |  -.0025755   .0243657    -0.11   0.916    -.0503313    .0451803
            year9 |  -.0131919    .020676    -0.64   0.523    -.0537161    .0273323
           year10 |  -.0174418   .0165524    -1.05   0.292    -.0498839    .0150004
           year11 |   .0102819   .0140968     0.73   0.466    -.0173474    .0379111
           year12 |   .0012855   .0120289     0.11   0.915    -.0222908    .0248618
           year13 |   .0033463   .0097613     0.34   0.732    -.0157854     .022478
           year14 |  -.0055607   .0088874    -0.63   0.532    -.0229797    .0118584
           year15 |   .0062522   .0057935     1.08   0.281     -.005103    .0176073
           year16 |  -.0022079   .0035494    -0.62   0.534    -.0091647    .0047488
           year17 |  -.0008809   .0016778    -0.53   0.600    -.0041693    .0024076
           year18 |          0  (omitted)
    -------------------------------------------------------------------------------
    Underidentification test (Kleibergen-Paap rk LM statistic):              2.044
                                                       Chi-sq(1) P-val =    0.1528
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):               22.541
                             (Kleibergen-Paap rk Wald F statistic):          2.096
    Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                             15% maximal IV size              8.96
                                             20% maximal IV size              6.66
                                             25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
    ------------------------------------------------------------------------------
    Hansen J statistic (overidentification test of all instruments):         0.000
                                                     (equation exactly identified)
    ------------------------------------------------------------------------------
    Instrumented:         HIV_mean_prev
    Included instruments: L.GDP_PPP_pc year2 year3 year4 year5 year6 year7 year8
                          year9 year10 year11 year12 year13 year14 year15 year16
                          year17
    Excluded instruments: MC_mean_prev
    Dropped collinear:    year1 year18
    ------------------------------------------------------------------------------
    r; t=0.70 15:08:52
    As it was suggested in previous posts on statalist I could add -small- to -xtivreg2-. This gives me:

    xtivreg2, fe cluster(pcode) first small

    Code:
     
    xtivreg2 growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe cluster(pcode) first small
    Warning - collinearities detected
    Vars dropped:       year1 year18
     
    FIXED EFFECTS ESTIMATION
    ------------------------
    Number of groups =       585                    Obs per group: min =        17
                                                                   avg =      17.0
                                                                   max =        17
    Warning - collinearities detected
    Vars dropped:  year1 year18
     
    First-stage regressions
    -----------------------
     
     
    FIXED EFFECTS ESTIMATION
    ------------------------
    Number of groups =       585                    Obs per group: min =        17
                                                                   avg =      17.0
                                                                   max =        17
     
    First-stage regression of HIV_mean_prev:
     
    Statistics robust to heteroskedasticity and clustering on pcode
    Number of obs =                   9945
    Number of clusters (pcode) =       585
    ------------------------------------------------------------------------------
                 |               Robust
    HIV_mean_p~v | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
    MC_mean_prev |  -.0129952   .0089758    -1.45   0.148    -.0305899    .0045994
                 |
      GDP_PPP_pc |
             L1. |  -2.99e-09   1.15e-09    -2.61   0.009    -5.23e-09   -7.43e-10
                 |
           year1 |          0  (omitted)
           year2 |     .01637   .0011976    13.67   0.000     .0140224    .0187175
           year3 |   .0157388   .0011052    14.24   0.000     .0135723    .0179052
           year4 |   .0148042   .0010155    14.58   0.000     .0128135    .0167948
           year5 |   .0135153   .0009475    14.26   0.000      .011658    .0153726
           year6 |   .0122371   .0008779    13.94   0.000     .0105163    .0139579
           year7 |   .0109056    .000823    13.25   0.000     .0092923    .0125188
           year8 |   .0093755    .000767    12.22   0.000      .007872     .010879
           year9 |   .0077759   .0006847    11.36   0.000     .0064338     .009118
          year10 |    .006185   .0006211     9.96   0.000     .0049675    .0074026
          year11 |   .0051064   .0005723     8.92   0.000     .0039846    .0062282
          year12 |   .0043111   .0005246     8.22   0.000     .0032829    .0053394
          year13 |   .0033855   .0004471     7.57   0.000     .0025091    .0042618
          year14 |   .0027209   .0003192     8.52   0.000     .0020952    .0033467
          year15 |   .0020889   .0002173     9.61   0.000      .001663    .0025148
          year16 |   .0014029   .0001406     9.97   0.000     .0011272    .0016786
          year17 |   .0006228   .0000811     7.68   0.000     .0004638    .0007819
          year18 |          0  (omitted)
    ------------------------------------------------------------------------------
    F test of excluded instruments:
      F(  1,   584) =     2.10
      Prob > F      =   0.1482
    Sanderson-Windmeijer multivariate F test of excluded instruments:
      F(  1,   584) =     2.10
      Prob > F      =   0.1482
     
     
     
    Summary results for first-stage regressions
    -------------------------------------------
     
                                               (Underid)            (Weak id)
    Variable     | F(  1,   584)  P-val | SW Chi-sq(  1) P-val | SW F(  1,   584)
    HIV_mean_pre |       2.10    0.1482 |        2.10   0.1470 |        2.10
     
    NB: first-stage test statistics cluster-robust
     
    Stock-Yogo weak ID F test critical values for single endogenous regressor:
                                       10% maximal IV size             16.38
                                       15% maximal IV size              8.96
                                       20% maximal IV size              6.66
                                       25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for i.i.d. errors only.
     
    Underidentification test
    Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
    Ha: matrix has rank=K1 (identified)
    Kleibergen-Paap rk LM statistic          Chi-sq(1)=2.04     P-val=0.1528
     
    Weak identification test
    Ho: equation is weakly identified
    Cragg-Donald Wald F statistic                                      22.54
    Kleibergen-Paap Wald rk F statistic                                 2.10
     
    Stock-Yogo weak ID test critical values for K1=1 and L1=1:
                                       10% maximal IV size             16.38
                                       15% maximal IV size              8.96
                                       20% maximal IV size              6.66
                                       25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
     
    Weak-instrument-robust inference
    Tests of joint significance of endogenous regressors B1 in main equation
    Ho: B1=0 and orthogonality conditions are valid
    Anderson-Rubin Wald test           F(1,584)=      13.11     P-val=0.0003
    Anderson-Rubin Wald test           Chi-sq(1)=     13.16     P-val=0.0003
    Stock-Wright LM S statistic        Chi-sq(1)=     24.96     P-val=0.0000
     
    NB: Underidentification, weak identification and weak-identification-robust
        test statistics cluster-robust
     
    Number of clusters             N_clust  =        585
    Number of observations               N  =       9945
    Number of regressors                 K  =         18
    Number of endogenous regressors      K1 =          1
    Number of instruments                L  =         18
    Number of excluded instruments       L1 =          1
     
    IV (2SLS) estimation
    --------------------
     
    Estimates efficient for homoskedasticity only
    Statistics robust to heteroskedasticity and clustering on pcode
     
    Number of clusters (pcode) =       585                Number of obs =     9945
                                                          F( 18,   584) =    38.11
                                                          Prob > F      =   0.0000
    Total (centered) SS     =  24.53840383                Centered R2   =  -0.4217
    Total (uncentered) SS   =  24.53840383                Uncentered R2 =  -0.4217
    Residual SS             =   34.8871044                Root MSE      =   .06111
     
    -------------------------------------------------------------------------------
                  |               Robust
    growth_GDP_~c | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
    HIV_mean_prev |   3.078041     2.3652     1.30   0.194    -1.567294    7.723376
                  |
       GDP_PPP_pc |
              L1. |  -1.53e-10   1.10e-08    -0.01   0.989    -2.17e-08    2.14e-08
                  |
            year1 |          0  (omitted)
            year2 |  -.0445854   .0410654    -1.09   0.278    -.1252391    .0360684
            year3 |  -.0452986   .0397298    -1.14   0.255    -.1233294    .0327321
            year4 |  -.0404836   .0375986    -1.08   0.282    -.1143285    .0333613
            year5 |   .0070452   .0349542     0.20   0.840    -.0616061    .0756965
            year6 |  -.0123261   .0313727    -0.39   0.695    -.0739432     .049291
            year7 |  -.0105576   .0279573    -0.38   0.706    -.0654667    .0443515
            year8 |  -.0025755   .0244074    -0.11   0.916    -.0505124    .0453614
            year9 |  -.0131919   .0207114    -0.64   0.524    -.0538698     .027486
           year10 |  -.0174418   .0165808    -1.05   0.293    -.0500069    .0151234
           year11 |   .0102819    .014121     0.73   0.467    -.0174522    .0380159
           year12 |   .0012855   .0120495     0.11   0.915    -.0223803    .0249512
           year13 |   .0033463    .009778     0.34   0.732     -.015858    .0225506
           year14 |  -.0055607   .0089026    -0.62   0.532    -.0230457    .0119244
           year15 |   .0062522   .0058035     1.08   0.282     -.005146    .0176504
           year16 |  -.0022079   .0035555    -0.62   0.535    -.0091911    .0047752
           year17 |  -.0008809   .0016807    -0.52   0.600    -.0041818      .00242
           year18 |          0  (omitted)
    -------------------------------------------------------------------------------
    Underidentification test (Kleibergen-Paap rk LM statistic):              2.044
                                                       Chi-sq(1) P-val =    0.1528
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):               22.541
                             (Kleibergen-Paap rk Wald F statistic):          2.096
    Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                             15% maximal IV size              8.96
                                             20% maximal IV size              6.66
                                             25% maximal IV size              5.53
    Source: Stock-Yogo (2005).  Reproduced by permission.
    NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
    ------------------------------------------------------------------------------
    Hansen J statistic (overidentification test of all instruments):         0.000
                                                     (equation exactly identified)
    ------------------------------------------------------------------------------
    Instrumented:         HIV_mean_prev
    Included instruments: L.GDP_PPP_pc year2 year3 year4 year5 year6 year7 year8
                          year9 year10 year11 year12 year13 year14 year15 year16
                          year17
    Excluded instruments: MC_mean_prev
    Dropped collinear:    year1 year18
    ------------------------------------------------------------------------------
    r; t=0.66 15:11:40
    Can someone explain me why at least the first stage is significantly different and thus the relevance of my instrument is totally different?

  • #2
    xtivreg2 is from SSC, as you are asked to explain (FAQ Advice #12). You should provide a reproducible example. Those first stage regressions are not equivalent. If you look at the number of observations in xtivreg's first stage, it is 9360 compared to 9945 for xtivreg2's first stage. You will normally want to use the same sample in the first and second stage as xtivreg2 does, so it may be a bug in xtivreg. You need a reproducible example to document it.

    Comment


    • #3
      Andrew Musau Thank you! Here is a reproducible example:

      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input float(growth_GDP_PPP_pc GDP_PPP_pc) double(HIV_mean_prev MC_mean_prev) byte(year1 year2 year3 year4 year5 year6 year7 year8 year9 year10 year11 year12 year13 year14 year15 year16 year17 year18) float(year pcode)
                 .  6833.586  .009391321464879853  .874858446015513 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 11
        .065409355  7280.567  .010551745858990144 .8882725118842353 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 11
         -.0510628  6908.801  .011614275863107404 .8989287794950727 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 11
         .07137197  7401.896  .012688413908386263 .9093764177339891 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 11
         .12782831  8348.067   .01332622815010693 .9207094649630526 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 11
         .20275557 10040.685  .013409183981135634 .9300142549876839 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 11
           .204221 12091.203   .01390926253078818 .9391515190886699 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 11
         .22216024 14777.388  .014479589038941403 .9468483830665041 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 11
          .1340643 16758.508  .015268043919438909 .9537642038793109 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 11
        .019763516 17089.715  .015508624518019482 .9590509581896545 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 11
        .028940905 17584.307  .015607664117869449 .9633054620073891 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 11
      -.0007541792 17571.045  .015496642564496788 .9678465560344831 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 11
         .01161579 17775.146  .015328731367208541 .9708436201970425 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 11
        .024825085 18216.416  .015214403489090759 .9739637299876844 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 11
        .009984556 18398.299   .01591842509966729  .976787445258622 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 11
       -.006766081 18273.814  .016190094392164036 .9793984546798032 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 11
       -.006423553 18156.432  .016184303744952996 .9842327139162554 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 11
       -.006106651 18045.557  .015725322049386394 .9853705811162887 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 11
                 .  5603.201  .005378663071760066 .8244465899051402 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 12
         .05011557  5884.009  .006095451145050286 .8360699947646738 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 12
         -.0650277  5501.385  .006981089430165518 .8501499220518246 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 12
         .05520209  5805.073  .007988266687043496 .8619590320465341 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 12
          .1103648  6445.749  .009091002163573381 .8745047025383393 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 12
         .18364127  7629.455  .010366657063021837 .8858756469063971 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 12
          .2078017  9214.868  .011385867183695074 .8966687141723947 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 12
         .22580376  11295.62  .012622666238551261 .9059945566895828 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 12
         .13745415  12848.25   .01357129606915773 .9134907837123196 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 12
        .022820244  13141.45  .014793703333036397 .9205730870438915 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 12
         .03203381  13562.42  .015241338952275387 .9276793374405083 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 12
         .03842044 14083.495  .015550171011785718 .9343819989423587 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 12
         .05012392 14789.415  .015946984491737478 .9405230260179795 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 12
        .012813944 14978.926  .016403963430386418 .9470865868323658 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 12
         .04595095 15667.222   .01586490968718549 .9521253695399271 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 12
        .027682135 16100.924  .015224267573324127  .958218850449497 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 12
        .027169807 16538.383  .015239616436908458  .971725254944475 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 12
         .02668107 16979.645  .015207947335857256 .9743931975899267 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 12
                 . 10231.248 .0053579459659802795 .8477491841230431 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 13
         .08185945 11068.772   .00610771525478817 .8596572050203141 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 13
        -.03563569  10674.33  .007212398098500632 .8715866559199094 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 13
         .08974355  11632.28  .008368264599441098 .8842979902495656 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 13
         .14826533 13356.945   .00972102690816198 .8956824537724906 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 13
          .2258328 16373.382  .011062183202116237 .9076131478816003 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 13
         .24431905  20373.71   .01286353321706326 .9184203784677883 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 13
         .26434293  25759.36  .015083519097047875 .9280267872896119 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 13
         .17468932  30259.24  .016622429230648786 .9346627101276833 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 13
         .05773101  32006.14  .018557102440246144 .9399498089669179 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 13
         .06881657  34208.69  .020675375221164177 .9457677234184559 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 13
         .06981379  36596.93  .022730767563930256 .9510100616076619 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 13
         .08313336  39639.36   .02446623672787976 .9561014218804393 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 13
         .10105586  43645.14    .0261302774492165 .9620655884793992 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 13
          .0814095  47198.27  .026687361430257853 .9666301069936155 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 13
           .064066  50222.08  .027227779871714423 .9709495481137532 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 13
         .06520881     53497   .02544559363586027 .9672400532211274 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 13
         .06652096  57055.67  .025062884862447676 .9712222922491737 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 13
                 . 19735.164    .0158507426063955 .9088661339347817 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 14
         -.0953218 17853.973  .017563566012084586 .9212442178247737 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 14
         -.1770627   14692.7    .0210045430010179 .9327386120845921 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 14
        -.06157534 13787.992  .025167927764963887 .9431070927492452 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 14
      -.0024372996 13754.387   .02732744144438977 .9531785818731122 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 14
         .07188154 14743.073  .027765859514925054  .961212710271903 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 14
        .034295037 15248.688   .02668508274924473 .9686173658610276 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 14
         .06888759 16299.133    .0261502855336378 .9755644166163139 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 14
       .0084982235 16437.646  .026555359881269967 .9846690691842898 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 14
        -.08117697 15103.288   .02556999056428401 .9904222782477345 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 14
        -.06390372 14138.132  .023941940152483045  .991399269184291 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 14
        -.10997305 12583.318   .02231318695510082 .9926917870090635 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 14
         -.0826145 11543.754   .01894537352441931 .9916409081570994 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 14
        -.10236596 10362.066  .015905482173978924 .9906466851963744 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 14
         -.0596228  9744.251  .014709798996182006 .9899813072507547 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 14
        -.06737326  9087.749  .013288223125558244 .9901024740181263 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 14
        -.06044485  8538.441  .013347139182497728 .9926799619335359 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 14
        -.05462177  8072.057  .012906610170868858 .9928491021931352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 14
                 .  2750.393  .018801156639609844  .838788111184522 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 15
         .07501148  2956.704   .02316286753288652  .854237033716491 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 15
       -.033410236   2857.92  .029025099882279935 .8668547395793825 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 15
         .08392139   3097.76  .032881023081441974 .8787375764752527 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 15
         .14311618    3541.1   .03714578186987525 .8888767138195899 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 15
          .2084594 4279.2754   .03990454076155636 .8983239109484562 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 15
         .23020905  5264.403   .04131915732474206 .9087265082278356 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 15
          .2491253  6575.899  .044030783905350056 .9182325202216437 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 15
         .16273306  7646.016  .044003059103624106 .9256053751597919 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 15
          .0504075  8031.432   .04732585450980006 .9329395385762861 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 15
         .06284044  8536.131  .049391370331004415 .9401638024329884 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 15
         .06401706  9082.589   .05066468884880395 .9456142115566992 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 15
         .07623564  9775.006   .05608837323820161 .9503570950927802 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 15
          .0930572  10684.64   .05887464340309269 .9542986098453653 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 15
          .0746351  11482.09    .0587530201356666 .9584097115463882 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 15
         .05735087 12140.598   .05789915029209146 .9621552758865981 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 15
         .05783475 12842.746    .0563306781812811 .9642798777113373 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 15
         .05842024 13593.022   .05524786703518986 .9695802650224302 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 15
                 .  7219.191  .007577533332232794 .9082650669682574 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 16
          .0952809  7907.042  .008516541805653689 .9212861749999998 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 16
       -.022636257  7728.056  .009513770641476021 .9313484075971735 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 16
         .10576286  8545.397  .010659253766082306  .940787364045936 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 16
         .16674684  9970.315  .011575857055613726 .9498460453180192 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 16
         .24753077 12438.275  .011834293735532794 .9581848642226142 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 16
         .25947002 15665.635  .012520292862190802 .9654517273851576 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 16
         .28106532   20068.7   .01314457409765058 .9717857459363946 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 16
          .1916271  23914.41  .013776092365542066 .9766917868374545 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 16
          .0744237 25694.207  .013797905227801246 .9802507946113072 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 16
      end
      with xtset pcode year


      PS: It seems that this problem occurs mainly due to clustered standard errors
      Last edited by Michael Schuster; 03 Feb 2022, 09:42.

      Comment


      • #4
        Thanks for the data example. I think it is an oversight from the Stata developers as it relates to reproducing the first stage results. I would send a report to Technical Services for them to look into it. Otherwise, I would put more weight on xtivreg2's first stage results or reproduce xtivreg's first stage using xtreg as below:


        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input float(growth_GDP_PPP_pc GDP_PPP_pc) double(HIV_mean_prev MC_mean_prev) byte(year1 year2 year3 year4 year5 year6 year7 year8 year9 year10 year11 year12 year13 year14 year15 year16 year17 year18) float(year pcode sample)
                   .  6833.586  .009391321464879853  .874858446015513 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 11 0
          .065409355  7280.567  .010551745858990144 .8882725118842353 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 11 1
           -.0510628  6908.801  .011614275863107404 .8989287794950727 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 11 1
           .07137197  7401.896  .012688413908386263 .9093764177339891 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 11 1
           .12782831  8348.067   .01332622815010693 .9207094649630526 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 11 1
           .20275557 10040.685  .013409183981135634 .9300142549876839 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 11 1
             .204221 12091.203   .01390926253078818 .9391515190886699 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 11 1
           .22216024 14777.388  .014479589038941403 .9468483830665041 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 11 1
            .1340643 16758.508  .015268043919438909 .9537642038793109 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 11 1
          .019763516 17089.715  .015508624518019482 .9590509581896545 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 11 1
          .028940905 17584.307  .015607664117869449 .9633054620073891 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 11 1
        -.0007541792 17571.045  .015496642564496788 .9678465560344831 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 11 1
           .01161579 17775.146  .015328731367208541 .9708436201970425 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 11 1
          .024825085 18216.416  .015214403489090759 .9739637299876844 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 11 1
          .009984556 18398.299   .01591842509966729  .976787445258622 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 11 1
         -.006766081 18273.814  .016190094392164036 .9793984546798032 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 11 1
         -.006423553 18156.432  .016184303744952996 .9842327139162554 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 11 1
         -.006106651 18045.557  .015725322049386394 .9853705811162887 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 11 1
                   .  5603.201  .005378663071760066 .8244465899051402 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 12 0
           .05011557  5884.009  .006095451145050286 .8360699947646738 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 12 1
           -.0650277  5501.385  .006981089430165518 .8501499220518246 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 12 1
           .05520209  5805.073  .007988266687043496 .8619590320465341 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 12 1
            .1103648  6445.749  .009091002163573381 .8745047025383393 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 12 1
           .18364127  7629.455  .010366657063021837 .8858756469063971 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 12 1
            .2078017  9214.868  .011385867183695074 .8966687141723947 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 12 1
           .22580376  11295.62  .012622666238551261 .9059945566895828 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 12 1
           .13745415  12848.25   .01357129606915773 .9134907837123196 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 12 1
          .022820244  13141.45  .014793703333036397 .9205730870438915 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 12 1
           .03203381  13562.42  .015241338952275387 .9276793374405083 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 12 1
           .03842044 14083.495  .015550171011785718 .9343819989423587 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 12 1
           .05012392 14789.415  .015946984491737478 .9405230260179795 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 12 1
          .012813944 14978.926  .016403963430386418 .9470865868323658 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 12 1
           .04595095 15667.222   .01586490968718549 .9521253695399271 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 12 1
          .027682135 16100.924  .015224267573324127  .958218850449497 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 12 1
          .027169807 16538.383  .015239616436908458  .971725254944475 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 12 1
           .02668107 16979.645  .015207947335857256 .9743931975899267 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 12 1
                   . 10231.248 .0053579459659802795 .8477491841230431 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 13 0
           .08185945 11068.772   .00610771525478817 .8596572050203141 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 13 1
          -.03563569  10674.33  .007212398098500632 .8715866559199094 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 13 1
           .08974355  11632.28  .008368264599441098 .8842979902495656 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 13 1
           .14826533 13356.945   .00972102690816198 .8956824537724906 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 13 1
            .2258328 16373.382  .011062183202116237 .9076131478816003 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 13 1
           .24431905  20373.71   .01286353321706326 .9184203784677883 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 13 1
           .26434293  25759.36  .015083519097047875 .9280267872896119 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 13 1
           .17468932  30259.24  .016622429230648786 .9346627101276833 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 13 1
           .05773101  32006.14  .018557102440246144 .9399498089669179 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 13 1
           .06881657  34208.69  .020675375221164177 .9457677234184559 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 13 1
           .06981379  36596.93  .022730767563930256 .9510100616076619 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 13 1
           .08313336  39639.36   .02446623672787976 .9561014218804393 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 13 1
           .10105586  43645.14    .0261302774492165 .9620655884793992 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 13 1
            .0814095  47198.27  .026687361430257853 .9666301069936155 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 13 1
             .064066  50222.08  .027227779871714423 .9709495481137532 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 13 1
           .06520881     53497   .02544559363586027 .9672400532211274 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 13 1
           .06652096  57055.67  .025062884862447676 .9712222922491737 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 13 1
                   . 19735.164    .0158507426063955 .9088661339347817 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 14 0
           -.0953218 17853.973  .017563566012084586 .9212442178247737 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 14 1
           -.1770627   14692.7    .0210045430010179 .9327386120845921 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 14 1
          -.06157534 13787.992  .025167927764963887 .9431070927492452 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 14 1
        -.0024372996 13754.387   .02732744144438977 .9531785818731122 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 14 1
           .07188154 14743.073  .027765859514925054  .961212710271903 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 14 1
          .034295037 15248.688   .02668508274924473 .9686173658610276 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 14 1
           .06888759 16299.133    .0261502855336378 .9755644166163139 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 14 1
         .0084982235 16437.646  .026555359881269967 .9846690691842898 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 14 1
          -.08117697 15103.288   .02556999056428401 .9904222782477345 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 14 1
          -.06390372 14138.132  .023941940152483045  .991399269184291 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 14 1
          -.10997305 12583.318   .02231318695510082 .9926917870090635 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 14 1
           -.0826145 11543.754   .01894537352441931 .9916409081570994 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 14 1
          -.10236596 10362.066  .015905482173978924 .9906466851963744 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 14 1
           -.0596228  9744.251  .014709798996182006 .9899813072507547 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 14 1
          -.06737326  9087.749  .013288223125558244 .9901024740181263 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 14 1
          -.06044485  8538.441  .013347139182497728 .9926799619335359 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 14 1
          -.05462177  8072.057  .012906610170868858 .9928491021931352 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 14 1
                   .  2750.393  .018801156639609844  .838788111184522 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 15 0
           .07501148  2956.704   .02316286753288652  .854237033716491 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 15 1
         -.033410236   2857.92  .029025099882279935 .8668547395793825 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 15 1
           .08392139   3097.76  .032881023081441974 .8787375764752527 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 15 1
           .14311618    3541.1   .03714578186987525 .8888767138195899 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 15 1
            .2084594 4279.2754   .03990454076155636 .8983239109484562 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 15 1
           .23020905  5264.403   .04131915732474206 .9087265082278356 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 15 1
            .2491253  6575.899  .044030783905350056 .9182325202216437 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 15 1
           .16273306  7646.016  .044003059103624106 .9256053751597919 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 15 1
            .0504075  8031.432   .04732585450980006 .9329395385762861 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 15 1
           .06284044  8536.131  .049391370331004415 .9401638024329884 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 2010 15 1
           .06401706  9082.589   .05066468884880395 .9456142115566992 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 2011 15 1
           .07623564  9775.006   .05608837323820161 .9503570950927802 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 2012 15 1
            .0930572  10684.64   .05887464340309269 .9542986098453653 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 2013 15 1
            .0746351  11482.09    .0587530201356666 .9584097115463882 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2014 15 1
           .05735087 12140.598   .05789915029209146 .9621552758865981 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2015 15 1
           .05783475 12842.746    .0563306781812811 .9642798777113373 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2016 15 1
           .05842024 13593.022   .05524786703518986 .9695802650224302 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2017 15 1
                   .  7219.191  .007577533332232794 .9082650669682574 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2000 16 0
            .0952809  7907.042  .008516541805653689 .9212861749999998 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2001 16 1
         -.022636257  7728.056  .009513770641476021 .9313484075971735 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2002 16 1
           .10576286  8545.397  .010659253766082306  .940787364045936 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2003 16 1
           .16674684  9970.315  .011575857055613726 .9498460453180192 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2004 16 1
           .24753077 12438.275  .011834293735532794 .9581848642226142 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 2005 16 1
           .25947002 15665.635  .012520292862190802 .9654517273851576 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2006 16 1
           .28106532   20068.7   .01314457409765058 .9717857459363946 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2007 16 1
            .1916271  23914.41  .013776092365542066 .9766917868374545 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 2008 16 1
            .0744237 25694.207  .013797905227801246 .9802507946113072 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2009 16 1
        end
        
        xtset pcode year
        xtivreg2 growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe cluster(pcode) first
        xtivreg growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe vce(robust) first
        xtreg HIV_mean_prev MC_mean_prev L.GDP_PPP_pc i.year if e(sample), fe robust
        Res.:

        Code:
        . xtivreg2 growth_GDP_PPP_pc L1.GDP_PPP_pc (HIV_mean_prev= MC_mean_prev) year1-year18, fe cluster(pcode) first
        Warning - collinearities detected
        Vars dropped:       year1 year18
        
        FIXED EFFECTS ESTIMATION
        ------------------------
        Number of groups =         6                    Obs per group: min =         9
                                                                       avg =      15.7
                                                                       max =        17
        Warning - collinearities detected
        Vars dropped:  year1 year18
        
        First-stage regressions
        -----------------------
        
        
        FIXED EFFECTS ESTIMATION
        ------------------------
        Number of groups =         6                    Obs per group: min =         9
                                                                       avg =      15.7
                                                                       max =        17
        
        First-stage regression of HIV_mean_prev:
        
        Statistics robust to heteroskedasticity and clustering on pcode
        Number of obs =                     94
        Number of clusters (pcode) =         6
        ------------------------------------------------------------------------------
                     |               Robust
        HIV_mean_p~v |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        MC_mean_prev |   .3595118   .2454461     1.46   0.147    -.1300151    .8490387
                     |
          GDP_PPP_pc |
                 L1. |   2.96e-07   1.96e-07     1.51   0.136    -9.53e-08    6.88e-07
                     |
               year1 |          0  (omitted)
               year2 |    .030363   .0188799     1.61   0.112    -.0072917    .0680178
               year3 |   .0283154   .0167781     1.69   0.096    -.0051474    .0617782
               year4 |    .026615    .014507     1.83   0.071    -.0023182    .0555482
               year5 |   .0243931   .0124666     1.96   0.054    -.0004707    .0492569
               year6 |   .0216639   .0104902     2.07   0.043     .0007418     .042586
               year7 |   .0185447   .0085187     2.18   0.033     .0015548    .0355347
               year8 |   .0161114   .0069469     2.32   0.023     .0022563    .0299665
               year9 |   .0134473   .0055728     2.41   0.018     .0023326     .024562
              year10 |   .0117047   .0046143     2.54   0.013     .0025018    .0209077
              year11 |   .0105712   .0032613     3.24   0.002     .0040668    .0170757
              year12 |    .009123   .0024539     3.72   0.000     .0042289    .0140171
              year13 |   .0085265   .0024539     3.47   0.001     .0036324    .0134207
              year14 |   .0073264   .0023793     3.08   0.003      .002581    .0120718
              year15 |   .0058073   .0018499     3.14   0.002     .0021177    .0094968
              year16 |   .0038991   .0013054     2.99   0.004     .0012956    .0065026
              year17 |   .0016548   .0009002     1.84   0.070    -.0001405    .0034501
              year18 |          0  (omitted)
        ------------------------------------------------------------------------------
        F test of excluded instruments:
          F(  1,     5) =     2.15
          Prob > F      =   0.2029
        Sanderson-Windmeijer multivariate F test of excluded instruments:
          F(  1,     5) =     2.15
          Prob > F      =   0.2029
        
        
        
        Summary results for first-stage regressions
        -------------------------------------------
        
                                                   (Underid)            (Weak id)
        Variable     | F(  1,     5)  P-val | SW Chi-sq(  1) P-val | SW F(  1,     5)
        HIV_mean_pre |       2.15    0.2029 |        3.15   0.0759 |        2.15
        
        NB: first-stage test statistics cluster-robust
        
        Stock-Yogo weak ID F test critical values for single endogenous regressor:
                                           10% maximal IV size             16.38
                                           15% maximal IV size              8.96
                                           20% maximal IV size              6.66
                                           25% maximal IV size              5.53
        Source: Stock-Yogo (2005).  Reproduced by permission.
        NB: Critical values are for i.i.d. errors only.
        
        Underidentification test
        Ho: matrix of reduced form coefficients has rank=K1-1 (underidentified)
        Ha: matrix has rank=K1 (identified)
        Kleibergen-Paap rk LM statistic          Chi-sq(1)=3.16     P-val=0.0752
        
        Weak identification test
        Ho: equation is weakly identified
        Cragg-Donald Wald F statistic                                      32.24
        Kleibergen-Paap Wald rk F statistic                                 2.15
        
        Stock-Yogo weak ID test critical values for K1=1 and L1=1:
                                           10% maximal IV size             16.38
                                           15% maximal IV size              8.96
                                           20% maximal IV size              6.66
                                           25% maximal IV size              5.53
        Source: Stock-Yogo (2005).  Reproduced by permission.
        NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
        
        Weak-instrument-robust inference
        Tests of joint significance of endogenous regressors B1 in main equation
        Ho: B1=0 and orthogonality conditions are valid
        Anderson-Rubin Wald test           F(1,5)=         0.27     P-val=0.6281
        Anderson-Rubin Wald test           Chi-sq(1)=      0.39     P-val=0.5321
        Stock-Wright LM S statistic        Chi-sq(1)=         .     P-val=     .
        
        NB: Underidentification, weak identification and weak-identification-robust
            test statistics cluster-robust
        
        Number of clusters             N_clust  =          6
        Number of observations               N  =         94
        Number of regressors                 K  =         18
        Number of endogenous regressors      K1 =          1
        Number of instruments                L  =         18
        Number of excluded instruments       L1 =          1
        
        IV (2SLS) estimation
        --------------------
        
        Estimates efficient for homoskedasticity only
        Statistics robust to heteroskedasticity and clustering on pcode
        
        Number of clusters (pcode) =         6                Number of obs =       94
                                                              F( 18,     5) =   434.26
                                                              Prob > F      =   0.0000
        Total (centered) SS     =  .5454066095                Centered R2   =   0.9667
        Total (uncentered) SS   =  .5454066095                Uncentered R2 =   0.9667
        Residual SS             =  .0181448336                Root MSE      =   .01436
        
        -------------------------------------------------------------------------------
                      |               Robust
        growth_GDP_~c |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        --------------+----------------------------------------------------------------
        HIV_mean_prev |  -.5903933   .9577088    -0.62   0.538    -2.467468    1.286681
                      |
           GDP_PPP_pc |
                  L1. |  -1.08e-07   5.31e-07    -0.20   0.839    -1.15e-06    9.33e-07
                      |
                year1 |          0  (omitted)
                year2 |   .0082763   .0223056     0.37   0.711    -.0354419    .0519944
                year3 |  -.0999311   .0162518    -6.15   0.000    -.1317841   -.0680781
                year4 |   .0227503   .0152115     1.50   0.135    -.0070636    .0525642
                year5 |   .0820543   .0134599     6.10   0.000     .0556734    .1084351
                year6 |   .1571221   .0133681    11.75   0.000     .1309212    .1833231
                year7 |   .1644332   .0180202     9.12   0.000     .1291143    .1997521
                year8 |   .1871723   .0151091    12.39   0.000     .1575591    .2167855
                year9 |   .1041786   .0109532     9.51   0.000     .0827107    .1256464
               year10 |   -.005869   .0077553    -0.76   0.449    -.0210692    .0093312
               year11 |   .0071277   .0053965     1.32   0.187    -.0034493    .0177046
               year12 |  -.0060316   .0097924    -0.62   0.538    -.0252245    .0131612
               year13 |   .0098779   .0073248     1.35   0.177    -.0044785    .0242342
               year14 |   .0083411   .0133941     0.62   0.533    -.0179108     .034593
               year15 |   .0129593   .0033855     3.83   0.000     .0063238    .0195948
               year16 |  -.0026692   .0018893    -1.41   0.158    -.0063721    .0010336
               year17 |  -.0013077   .0008296    -1.58   0.115    -.0029337    .0003183
               year18 |          0  (omitted)
        -------------------------------------------------------------------------------
        Underidentification test (Kleibergen-Paap rk LM statistic):              3.165
                                                           Chi-sq(1) P-val =    0.0752
        ------------------------------------------------------------------------------
        Weak identification test (Cragg-Donald Wald F statistic):               32.239
                                 (Kleibergen-Paap rk Wald F statistic):          2.145
        Stock-Yogo weak ID test critical values: 10% maximal IV size             16.38
                                                 15% maximal IV size              8.96
                                                 20% maximal IV size              6.66
                                                 25% maximal IV size              5.53
        Source: Stock-Yogo (2005).  Reproduced by permission.
        NB: Critical values are for Cragg-Donald F statistic and i.i.d. errors.
        ------------------------------------------------------------------------------
        Warning: estimated covariance matrix of moment conditions not of full rank.
                 overidentification statistic not reported, and standard errors and
                 model tests should be interpreted with caution.
        Possible causes:
                 number of clusters insufficient to calculate robust covariance matrix
                 singleton dummy variable (dummy with one 1 and N-1 0s or vice versa)
        partial option may address problem.
        ------------------------------------------------------------------------------
        Instrumented:         HIV_mean_prev
        Included instruments: L.GDP_PPP_pc year2 year3 year4 year5 year6 year7 year8
                              year9 year10 year11 year12 year13 year14 year15 year16
                              year17
        Excluded instruments: MC_mean_prev
        Dropped collinear:    year1 year18
        ------------------------------------------------------------------------------
        
        
        
        .
        . xtreg HIV_mean_prev MC_mean_prev L.GDP_PPP_pc i.year if e(sample), fe robust
        
        Fixed-effects (within) regression               Number of obs     =         94
        Group variable: pcode                           Number of groups  =          6
        
        R-sq:                                           Obs per group:
             within  = 0.7090                                         min =          9
             between = 0.1592                                         avg =       15.7
             overall = 0.0039                                         max =         17
        
                                                        F(5,5)            =          .
        corr(u_i, Xb)  = -0.6370                        Prob > F          =          .
        
                                          (Std. Err. adjusted for 6 clusters in pcode)
        ------------------------------------------------------------------------------
                     |               Robust
        HIV_mean_p~v |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        MC_mean_prev |   .3595118    .247077     1.46   0.205    -.2756199    .9946435
                     |
          GDP_PPP_pc |
                 L1. |   2.96e-07   1.98e-07     1.50   0.194    -2.12e-07    8.05e-07
                     |
                year |
               2002  |  -.0020477   .0021716    -0.94   0.389    -.0076299    .0035345
               2003  |  -.0037481   .0046281    -0.81   0.455     -.015645    .0081489
               2004  |    -.00597   .0067246    -0.89   0.415     -.023256    .0113161
               2005  |  -.0086992   .0087366    -1.00   0.365    -.0311572    .0137589
               2006  |  -.0118183   .0106498    -1.11   0.318    -.0391946     .015558
               2007  |  -.0142516   .0121855    -1.17   0.295    -.0455753    .0170721
               2008  |  -.0169158   .0135221    -1.25   0.266    -.0516754    .0178439
               2009  |  -.0186583   .0144458    -1.29   0.253    -.0557924    .0184758
               2010  |  -.0197918   .0158215    -1.25   0.266    -.0604623    .0208787
               2011  |    -.02124   .0166797    -1.27   0.259    -.0641165    .0216365
               2012  |  -.0218365   .0169666    -1.29   0.254    -.0654506    .0217776
               2013  |  -.0230367   .0174418    -1.32   0.244    -.0678721    .0217988
               2014  |  -.0245558   .0177958    -1.38   0.226    -.0703014    .0211898
               2015  |   -.026464    .018185    -1.46   0.205      -.07321     .020282
               2016  |  -.0287082    .018337    -1.57   0.178    -.0758449    .0184284
               2017  |   -.030363   .0190053    -1.60   0.171    -.0792178    .0184917
                     |
               _cons |  -.3053648   .2178495    -1.40   0.220    -.8653649    .2546352
        -------------+----------------------------------------------------------------
             sigma_u |  .01877582
             sigma_e |  .00386111
                 rho |  .95942689   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------

        Comment

        Working...
        X