Dear Statalist community,

I run -ivreg2h- command from SSC with the fe option to implement the estimator proposed by Lewbel (2012, JBES) "Using heteroskedasticity to identify and estimate mismeasured and endogenous regressor models" for a dynamic panel of macroeconomic data with time and country fixed effects. I follow the guide by Baum and Lewbel (2019, The Stata Journal) "Advice on using heteroskedasticity-based identification" when implementing the command.

Baum and Lewbel (2019) suggest to run -ivhettest- after -ivreg2h- in order to test for heteroskedasticity in the residuals of the first stage regression, conditional on the constructed instruments. However, when using -ivhettest-, I get the following error "last estimates not found, r(301)".

I am using Stata/SE 16.0 on Windows 10.

I run the following code where d_L1Y is the endogenous variable to be instrumented. I also include a time fixed effect (i.quarter) which I then partial out. Moreover, z() reports the (assumed exogenous) variables used to build the instruments. These variables are used in the first stage regression. The outcome variable of the second stage regression is fa_Y. I use the xi: option in order to account for time dummies.

Code:
xi: ivreg2h  fa_Y L1d_L1Y L2d_L1Y L1fa_Y L2fa_Y dlrealgdp dstock_prices dgov_bond_yields ///
                   i.quarter (d_L1Y =) if noIRE==1, fe robust bw(2) gmm2s ///
                   z(L1d_L1Y L2d_L1Y L1fa_Y L2fa_Y dlrealgdp dstock_prices dgov_bond_yields) ///
                   partial(i.quarter)
I get the following results:

Code:
IV with Generated Instruments only
Fixed Effects by(CountryCode), 16 groups
Instruments created from Z:
L1d_L1Y L2d_L1Y L1fa_Y L2fa_Y dlrealgdp dstock_prices dgov_bond_yields
Warning - collinearities detected
Vars dropped:       _Iquarter_41 _Iquarter_235
Warning - collinearities detected
Vars dropped:  _Iquarter_41 _Iquarter_235

2-Step GMM estimation
---------------------

Estimates efficient for arbitrary heteroskedasticity and autocorrelation
Statistics robust to heteroskedasticity and autocorrelation
  kernel=Bartlett; bandwidth=2
  time variable (t):  quarter
  group variable (i): CountryCode

                                                      Number of obs =     1389
                                                      F(  8,  1172) =    18.03
                                                      Prob > F      =   0.0000
Total (centered) SS     =  50718.29679                Centered R2   =   0.5192
Total (uncentered) SS   =  50718.29679                Uncentered R2 =   0.5192
Residual SS             =  24387.76391                Root MSE      =    4.215


----------------------------------------------------------------------------------
                 |               Robust
            fa_Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
           d_L1Y |   1.098956   .1145213     9.60   0.000     .8744988    1.323414
         L1d_L1Y |  -.1575488   .0408916    -3.85   0.000    -.2376948   -.0774028
         L2d_L1Y |  -.1898572    .055578    -3.42   0.001    -.2987881   -.0809263
          L1fa_Y |   .0513925   .0330912     1.55   0.120     -.013465      .11625
          L2fa_Y |   .1006611   .0362383     2.78   0.005     .0296354    .1716868
       dlrealgdp |  -.3768432   .2409836    -1.56   0.118    -.8491624     .095476
   dstock_prices |   .0123677   .0375827     0.33   0.742     -.061293    .0860284
dgov_bond_yields |  -.5828282   .4648038    -1.25   0.210    -1.493827    .3281705
----------------------------------------------------------------------------------
Underidentification test (Kleibergen-Paap rk LM statistic):              5.054
                                                   Chi-sq(7) P-val =    0.6534
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):               11.374
                         (Kleibergen-Paap rk Wald F statistic):          1.657
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    19.86
                                         10% maximal IV relative bias    11.29
                                         20% maximal IV relative bias     6.73
                                         30% maximal IV relative bias     5.07
                                         10% maximal IV size             31.50
                                         15% maximal IV size             17.38
                                         20% maximal IV size             12.48
                                         25% maximal IV size              9.93
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):         2.331
                                                   Chi-sq(6) P-val =    0.8869
------------------------------------------------------------------------------
Instrumented:         d_L1Y
Included instruments: L1d_L1Y L2d_L1Y L1fa_Y L2fa_Y dlrealgdp dstock_prices
                      dgov_bond_yields
Excluded instruments: d_L1Y_L1d_L1Y_g d_L1Y_L2d_L1Y_g d_L1Y_L1fa_Y_g
                      d_L1Y_L2fa_Y_g d_L1Y_dlrealgdp_g d_L1Y_dstock_prices_g
                      d_L1Y_dgov_bond_yields_g
Partialled-out:       _Iquarter_42 _Iquarter_43 --  _Iquarter_234
                      nb: total SS, model F and R2s are after partialling-out;
                          any small-sample adjustments include partialled-out
                          variables in regressor count K
Dropped collinear:    _Iquarter_41 -------------- _Iquarter_235
------------------------------------------------------------------------------

Warning: variables have been centered

-----------------------------
    Variable |   GenInst    
-------------+---------------
       d_L1Y |        1.099  
             |         .115  
     L1d_L1Y |       -.1575  
             |        .0409  
     L2d_L1Y |       -.1899  
             |        .0556  
      L1fa_Y |       .05139  
             |        .0331  
      L2fa_Y |        .1007  
             |        .0362  
   dlrealgdp |       -.3768  
             |         .241  
dstock_pri~s |       .01237  
             |        .0376  
dgov_bond_~s |       -.5828  
             |         .465  
-------------+---------------
           N |         1389  
        rmse |         4.21  
           j |         2.33  
         jdf |            6  
          jp |         .887  
-----------------------------
                 legend: b/se
Warning - collinearities detected
Vars dropped:  _Iquarter_41 _Iquarter_235
Then, I run - ivhettest- and get the following error:
Code:
. ivhettest
last estimates not found
r(301);
I use the following versions of -ivreg2h- and of - ivhettest- which should be also the last updates (at the best of my knowledge):
Code:
. which ivreg2h
C:\Users\Giacomo.Rella\ado\plus\i\ivreg2h.ado
*! ivreg2h  1.1.03  07feb2019  cfb/mes
*! cloned from
*! xtivreg2 1.0.13 28Aug2011
*! author mes

. which ivhettest
C:\Users\Giacomo.Rella\ado\plus\i\ivhettest.ado
*! ivhettest 1.1.9  15Aug2013
*! author mes
I hope the information I provided are useful to help me to figure out what I am doing wrong.
Thank you very much in advance.

Giacomo