Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: versions of xtivreg2 and clustering


From   "Schaffer, Mark E" <[email protected]>
To   <[email protected]>
Subject   st: RE: versions of xtivreg2 and clustering
Date   Fri, 20 Apr 2007 19:42:01 +0100

Alejandro,

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Alejandro Molnar
> Sent: 20 April 2007 18:18
> To: [email protected]
> Subject: st: versions of xtivreg2 and clustering
> 
> Hi,
> 
> (This email is intended mostly for Mark Schaffer and/or the 
> ivreg2 crew.
> It's on xtivreg2 and (I'm guessing here) involves version 
> issues when clustering at the unit level)
> 
> I've gone back to using xtivreg2 after making some changes to 
> data that required re-running robustness checks. I have found 
> that a couple of things that were working previously aren't 
> working now. Specifically, I get this error:
> Error: estimated variance-covariance matrix not 
> positive-definite r(506); Which looking at the source code 
> seems to me to come from some check that "ereturn post" makes 
> on the VC matrix. Why should it care, though? The VC could 
> also be positive semidefinite, which is likely to be the case here.

-ereturn- won't save a vcv that isn't positive definite.  It's a
built-in Stata command.

> More strangely, however, when I run the estimation on a newly 
> opened Stata session, it goes through fine. If I then run 
> exactly the same estimation on the unchanged data, I get the 
> error (I've pasted the output below). Why does this happen 
> and how can I prevent it (since I need to run many 
> estimations in succession)?
> 
> It seems that this may be related to another minor issue. My 
> robustness-checking code read off xtivreg2 estimation results 
> under different specifications, and it seems to me that the 
> name for one changed (that, or I'm making a mistake so I 
> would appreciate it if you could correct me). Specifically, 
> instrumented variables were listed under
> e(instd1) and now appear to be listed under e(instd).

The problem is probably a combination of two things.  First, you have
more regressors than clusters, and this can cause problems as described
in the error message.

Second, since variables are being saved in either e(instd1) or e(instd),
some of estimations have collinearity problems and collinear variables
are being dropped.  There are two variable lists because one includes
these dropped variables and the other doesn't.

I suggest using the -fwl- option, as suggested in the error message, to
partial out the _I* variables and reduce the number of regressors to
something < #clusters.  Just that might do the trick.

--Mark

> Many thanks, best regards,
> Alejandro
> 
> 
> -------- STATA OUTPUT FOLLOWS ---------
> 
> . use standalone_103_selfconsistent.dta
> 
> . xtivreg2 ntb (b = dlnrer) oneterm_6 _Iy* _IcX* if s==0, 
> robust fe savefirst cluster(wbcode)
> Error: 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)  option may address problem.
> Error: 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)  option may address problem.
> Error: 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)  option may address problem.
> 
> FIXED EFFECTS ESTIMATION
> ------------------------
> Number of groups =        43                    Obs per 
> group: min =      
>  12
>                                                               
>  avg =     
> 14.9
>                                                               
>  max =      
>  15
> 
> Stored estimation results
> -------------------------
> --------------------------------------------------------------
> ----------
> model        | command      depvar       npar  title
> -------------+------------------------------------------------
> ----------
>  _xtivreg2_b | xtivreg2     b              58  First-stage 
> regression: b
> --------------------------------------------------------------
> ----------
> 
> IV (2SLS) estimation
> --------------------
> 
> Statistics robust to heteroskedasticity and clustering on wbcode
> 
> Number of clusters (wbcode) = 43                      Number 
> of obs =     
> 640
>                                                       F( 15,  
>   42) =   
> 84.76
>                                                       Prob > 
> F      =  
> 0.0000
> Total (centered) SS     =  1.033348527                
> Centered R2   =  
> 0.4963
> Total (uncentered) SS   =  1.033348527                
> Uncentered R2 =  
> 0.4963
> Residual SS             =  .5205082799                Root 
> MSE      =  
> .02953
> 
> --------------------------------------------------------------
> ----------------
>              |               Robust
>          ntb |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+------------------------------------------------
> ----------
> -------------+------
>            b |   -.367912   .0965671    -3.81   0.000      -.55718   
> -.178644
>    oneterm_6 |   .0175285   .0716672     0.24   0.807    -.1229366   
> .1579937
>    _Iyear_90 |   .0162655   .0106625     1.53   0.127    -.0046325   
> .0371636
>    _Iyear_91 |  -.0467473   .0226776    -2.06   0.039    -.0911945  
> -.0023001
>    _Iyear_92 |  -.0539769   .0284245    -1.90   0.058    -.1096879   
> .0017341
>    _Iyear_93 |  -.0309447   .0257732    -1.20   0.230    -.0814592   
> .0195698
>    _Iyear_94 |  -.0736298   .0413919    -1.78   0.075    -.1547565   
> .0074969
>    _Iyear_95 |  -.0759106   .0501515    -1.51   0.130    -.1742058   
> .0223845
>    _Iyear_96 |  -.0153082   .0418933    -0.37   0.715    -.0974176   
> .0668011
>    _Iyear_97 |  -.0110986   .0400109    -0.28   0.781    -.0895185   
> .0673213
>    _Iyear_98 |  -.0012123   .0377555    -0.03   0.974    -.0752117   
> .0727871
>    _Iyear_99 |   .0123629   .0373155     0.33   0.740    
> -.0607742      
> .0855
>   _Iyear_100 |   .0138581   .0391245     0.35   0.723    -.0628245   
> .0905406
>   _Iyear_101 |  -.0033312   .0416415    -0.08   0.936     -.084947   
> .0782846
>   _Iyear_102 |   .0013299     .04211     0.03   0.975    -.0812042   
> .0838641
>   _Iyear_103 |  -.0548514   .0636972    -0.86   0.389    -.1796957   
> .0699929
> _IcXt_117100 |   .0074609   .0023617     3.16   0.002     .0028321   
> .0120897
> _IcXt_135040 |   .0126354    .004207     3.00   0.003     .0043898    
> .020881
> _IcXt_211240 |  -.0019309   .0002025    -9.54   0.000    -.0023278  
> -.0015341
> _IcXt_330320 |   .0047067   .0027271     1.73   0.084    -.0006383   
> .0100516
> _IcXt_330760 |   .0012098   .0025234     0.48   0.632    -.0037359   
> .0061556
> _IcXt_331520 |    .012424    .003758     3.31   0.001     .0050584   
> .0197896
> _IcXt_331700 |   .0025849    .002078     1.24   0.214     -.001488   
> .0066578
> _IcXt_334840 |   .0039573   .0018401     2.15   0.032     .0003508   
> .0075638
> _IcXt_413760 |   .0034269    .000596     5.75   0.000     .0022587   
> .0045951
> _IcXt_413920 |  -.0020423   .0006556    -3.12   0.002    -.0033272  
> -.0007574
> _IcXt_447920 |   .0046809    .002383     1.96   0.049     .0000103   
> .0093514
> _IcXt_453440 |  -.0063212   .0009474    -6.67   0.000    -.0081781  
> -.0044642
> _IcXt_453560 |    .002812   .0025258     1.11   0.266    -.0021386   
> .0077625
> _IcXt_453600 |   .0142047    .002179     6.52   0.000      .009934   
> .0184755
> _IcXt_454100 |   .0054642   .0012962     4.22   0.000     .0029237   
> .0080047
> _IcXt_454580 |   .0264069   .0013525    19.52   0.000      .023756   
> .0290578
> _IcXt_455860 |   .0112221   .0031381     3.58   0.000     .0050715   
> .0173727
> _IcXt_456080 |   .0194414   .0024606     7.90   0.000     .0146187   
> .0242641
> _IcXt_457020 |   .0231821   .0010898    21.27   0.000     .0210461   
> .0253182
> _IcXt_457640 |    .011538   .0013347     8.64   0.000      .008922    
> .014154
> _IcXt_458960 |  -.0013467   .0012096    -1.11   0.266    -.0037175    
> .001024
> _IcXt_481560 |   .0029838   .0010614     2.81   0.005     .0009034   
> .0050641
> _IcXt_530560 |   .0048061   .0017423     2.76   0.006     .0013913   
> .0082209
> _IcXt_532080 |  -.0008884   .0008387    -1.06   0.289    -.0025322   
> .0007554
> _IcXt_532500 |  -.0012039   .0007496    -1.61   0.108    -.0026732   
> .0002654
> _IcXt_532800 |  -.0020482   .0006869    -2.98   0.003    -.0033944   
> -.000702
> _IcXt_533000 |   .0063873   .0030968     2.06   0.039     .0003177    
> .012457
> _IcXt_533720 |    .026435   .0020209    13.08   0.000     .0224741   
> .0303959
> _IcXt_533800 |    .000037   .0009586     0.04   0.969    -.0018417   
> .0019158
> _IcXt_535280 |   .0046971   .0013944     3.37   0.001     
> .0019642     
> .00743
> _IcXt_536200 |   .0046457   .0021723     2.14   0.032     .0003881   
> .0089033
> _IcXt_537240 |  -.0014407   .0008646    -1.67   0.096    -.0031353   
> .0002538
> _IcXt_538260 |  -.0015107   .0009619    -1.57   0.116    -.0033961   
> .0003747
> _IcXt_550400 |   .0007252   .0007233     1.00   0.316    -.0006925   
> .0021428
> _IcXt_552460 |   .0057257   .0007561     7.57   0.000     .0042437   
> .0072077
> _IcXt_555780 |   .0053056   .0018763     2.83   0.005     .0016281    
> .008983
> _IcXt_557520 |  -.0002951   .0006292    -0.47   0.639    -.0015283   
> .0009382
> _IcXt_583480 |    .013283   .0042137     3.15   0.002     .0050242   
> .0215418
> _IcXt_586160 |   .0046381   .0034726     1.34   0.182    -.0021682   
> .0114443
> _IcXt_586420 |   .0085547   .0053622     1.60   0.111    -.0019551   
> .0190645
> _IcXt_710360 |   -.006145   .0005625   -10.93   0.000    -.0072474  
> -.0050426
> _IcXt_715540 |  -.0056993   .0006519    -8.74   0.000    -.0069771  
> -.0044216
> --------------------------------------------------------------
> ----------------
> Anderson canon. corr. LR statistic (underidentification 
> test):         
> 55.768
>                                                    Chi-sq(1) 
> P-val =   
> 0.0000
> Test statistic(s) not robust
> --------------------------------------------------------------
> ----------------
> Cragg-Donald F statistic (weak identification test):          
>          
> 52.777
> 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
> Test statistic(s) not robust
> Source: Stock-Yogo (2005).  Reproduced by permission.
> --------------------------------------------------------------
> ----------------
> Error: 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) fwl option may address problem.
> --------------------------------------------------------------
> ----------------
> Instrumented:         b
> Included instruments: oneterm_6 _Iyear_90 _Iyear_91 _Iyear_92 
> _Iyear_93
>                       _Iyear_94 _Iyear_95 _Iyear_96 _Iyear_97 
> _Iyear_98
>                       _Iyear_99 _Iyear_100 _Iyear_101 
> _Iyear_102 _Iyear_103
>                       _IcXt_117100 _IcXt_135040 _IcXt_211240 
> _IcXt_330320
>                       _IcXt_330760 _IcXt_331520 _IcXt_331700 
> _IcXt_334840
>                       _IcXt_413760 _IcXt_413920 _IcXt_447920 
> _IcXt_453440
>                       _IcXt_453560 _IcXt_453600 _IcXt_454100 
> _IcXt_454580
>                       _IcXt_455860 _IcXt_456080 _IcXt_457020 
> _IcXt_457640
>                       _IcXt_458960 _IcXt_481560 _IcXt_530560 
> _IcXt_532080
>                       _IcXt_532500 _IcXt_532800 _IcXt_533000 
> _IcXt_533720
>                       _IcXt_533800 _IcXt_535280 _IcXt_536200 
> _IcXt_537240
>                       _IcXt_538260 _IcXt_550400 _IcXt_552460 
> _IcXt_555780
>                       _IcXt_557520 _IcXt_583480 _IcXt_586160 
> _IcXt_586420
>                       _IcXt_710360 _IcXt_715540 Excluded 
> instruments: dlnrer
> --------------------------------------------------------------
> ----------------
> 
> . xtivreg2 ntb (b = dlnrer) oneterm_6 _Iy* _IcX* if s==0, 
> robust fe savefirst cluster(wbcode)
> Error: 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)  option may address problem.
> Error: estimated variance-covariance matrix not 
> positive-definite r(506);
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index