Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: ivreg2 and xtoverid error


From   "Schaffer, Mark E" <M.E.Schaffer@hw.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: ivreg2 and xtoverid error
Date   Sat, 3 Apr 2010 15:56:30 +0100

John,

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of 
> John Antonakis
> Sent: 03 April 2010 14:47
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: RE: ivreg2 and xtoverid error
> 
> Hi Mark
> 
> Thanks for the note.
> 
> I get exactly the same estimates and standard errors with 
> -ivreg- and -ivregress-, with the cluster robust variance 
> estimator.  When using
> -ivreg2- with the  -noid- option it works and I get the same 
> estimates; more importantly, I also get the Hansen J-test,

Looks like it was -ranktest- that was also causing invsym() to choke,
probably for the same reason - the reduced form first-stage matrix is
probably too big and badly behaved for it to cope.

> which is what interests me most (the -ivregress- estimator 
> does not report an overid for cluster-robust vce's):
> 
> Hansen J statistic (overidentification test of all instruments): 
> 402.476, Chi-sq(404) P-val =  0.5121
> 
> Note, my estimates make sense and the regressors I expected 
> to be significant are mostly significant. I guess I can 
> assume that my estimates are consistent--and this because the 
> endogeneity test is significant (from -ivregres-), right?

You can get -ivreg2- to give you an endogeneity test statistic with the
-endog- option.  I think it will agree with the -estat- test.

But -estat endogenous- and -ivreg2,endog()- are testing whether you need
to treat your endogenous regressors x1-x13 as endogenous (and the answer
seems to be yes, you do).  They aren't testing whether your equation is
underidentified or weakly identified, which is what you'd also like to
know.  This is the test that -ranktest- and -ivreg2- are choking on
because the matrix is so big.

I'd be curious to know if Stata's -estat firststage- is able to generate
the Cragg-Donald ("minimum eigenvalue") under/weak-identification
statistic in your case.  You'll need to use the -forcenonrobust- option
to get it if you're using cluster-robust.

Cheers,
Mark

> 
> . estat endogenous
> 
>   Tests of endogeneity
>   Ho: variables are exogenous
> 
>   Robust regression F(13,417)     =  119.753  (p = 0.0000)
>     (Adjusted for 418 clusters in lead_number)
> 
> Best,
> J.
> 
> ____________________________________________________
> 
> Prof. John Antonakis, Associate Dean
> Faculty of Business and Economics
> Department of Organizational Behavior
> University of Lausanne
> Internef #618
> CH-1015 Lausanne-Dorigny
> Switzerland
> 
> Tel ++41 (0)21 692-3438
> Fax ++41 (0)21 692-3305
> 
> Faculty page:
> http://www.hec.unil.ch/people/jantonakis
> 
> Personal page:
> http://www.hec.unil.ch/jantonakis
> ____________________________________________________
> 
> 
> 
> On 03.04.2010 15:16, Schaffer, Mark E wrote:
> > John,
> >
> > You've got a very large number of instruments (almost 500), 
> but also 
> > 13 endogenous regressors.  The under- and weak-id statistics are 
> > calculated by -ranktest-, and it's running of memory 
> because it works 
> > with the reduced form in matrix form (13 first-stage 
> regressions, each 
> > with almost 500 regressors).
> >
> > If you use the -noid- option, it might address that problem problem 
> > (but you won't get the weak id stats).
> >
> > The
> >
> > invsym(): matrix has missing values
> >
> > is different.  -ivreg2- is having problems inverting this huge Z'Z 
> > matrix  and -ivregress- isn't (I think possibly because the latter 
> > uses a different Mata matrix inversion function).  I do 
> wonder whether 
> > the results you're getting actually make sense.
> >
> > Have you tried using the old -ivreg-, which uses -regress-?  It is 
> > numerically very stable and accurate.  Does it give the 
> same results 
> > as -ivregress-?
> >
> > Cheers,
> > Mark
> >
> >   
> >> -----Original Message-----
> >> From: owner-statalist@hsphsun2.harvard.edu
> >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of John 
> >> Antonakis
> >> Sent: 03 April 2010 01:20
> >> To: statalist@hsphsun2.harvard.edu
> >> Subject: st: ivreg2 and xtoverid error
> >>
> >> Hi:
> >>
> >> I am running Stata version 11 and have everything up to date.
> >>
> >> When running a two-stage model with ivreg2, I get the 
> following error:
> >>
> >> . xi: ivreg2 sat (x1-x13=i.lead_n) , cluster(lead_n)
> >> i.lead_number     _Ilead_numb_1-484   (naturally coded; 
> _Ilead_numb_1 
> >> omitted)
> >>              quadcross():  3900  unable to allocate real 
> >> <tmp>[5421,5421]
> >>                 rkstat():     -  function returned error
> >>                  <istmt>:     -  function returned error
> >> r(3900);
> >>
> >> If I remove the vce cluster command I get another error:
> >>
> >> . xi: ivreg2 y (x1-x13=i.lead_n) ,
> >> i.lead_number     _Ilead_numb_1-484   (naturally coded; 
> _Ilead_numb_1 
> >> omitted)
> >>
> >> invsym(): matrix has missing values
> >>
> >> This model is estimated fine with the official -ivregress- 
> command, 
> >> whether I use a cluster-robust or normal variance estimator, e.g.,
> >>
> >> . xi: ivregress 2sls y (x1-x13=i.lead_n) ,cluster(lead_n)
> >> i.lead_number     _Ilead_numb_1-484   (naturally coded; 
> _Ilead_numb_1 
> >> omitted)
> >>
> >> Instrumental variables (2SLS) regression               
> Number of obs 
> >> =     832
> >>                                                        
> Wald chi2(13) 
> >> =
> >> 1020.01
> >>                                                        Prob > 
> >> chi2   =  
> >> 0.0000
> >>                                                        
> >> R-squared     =  
> >> 0.7020
> >>                                                        Root 
> >> MSE      =   
> >> .2955
> >>
> >>                           (Std. Err. adjusted for 418 clusters in
> >> lead_number)
> >> --------------------------------------------------------------
> >> ----------------
> >>              |               Robust
> >>            y |      Coef.   Std. Err.      z    P>|z|     
> [95% Conf. 
> >> Interval]
> >> -------------+------------------------------------------------
> >> ----------
> >> -------------+------
> >>           x1 |   .3849406   .0509433     7.56   0.000     
> .2850935    
> >> .4847877
> >>           x2 |  -.0452167   .0541093    -0.84   0.403    
> -.1512689    
> >> .0608355
> >>           x3 |  -.0214062   .0392473    -0.55   0.585    
> -.0983295    
> >> .0555171
> >>           x4 |   .0743079   .0528296     1.41   0.160    
> >> -.0292363     
> >> .177852
> >>           x5 |   .1559398    .056997     2.74   0.006     
> .0442276    
> >> .2676519
> >>           x6 |    .168241   .0577832     2.91   0.004     
> >> .0549879     
> >> .281494
> >>           x7 |  -.1359489   .0290323    -4.68   0.000    
> -.1928512   
> >> -.0790465
> >>           x8 |   .0485811   .0358857     1.35   0.176    
> -.0217535    
> >> .1189157
> >>           x9 |  -.1772587   .0512706    -3.46   0.001    
> -.2777472   
> >> -.0767701
> >>          x10 |   .1785753   .0570718     3.13   0.002     
> .0667166    
> >> .2904339
> >>          x11 |   .0309138   .0533183     0.58   0.562    
> -.0735883    
> >> .1354158
> >>          x12 |   .2282491   .0554658     4.12   0.000     
> >> .1195381      
> >> .33696
> >>          x13 |  -.0723148   .0486346    -1.49   0.137    
> -.1676369    
> >> .0230072
> >>        _cons |   .4183937   .1616004     2.59   0.010     
> .1016627    
> >> .7351247
> >> --------------------------------------------------------------
> >> ----------------
> >> Instrumented:  x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13
> >> Instruments:   _Ilead_numb_2 _Ilead_numb_3 _Ilead_numb_4 
> _Ilead_numb_5
> >> [output snipped]
> >>
> >>
> >> Interestingly, when I run it with -xtivreg-, the model is 
> estimated 
> >> fine; however, -xtoverid- gives me the following error:
> >>
> >> . xtoverid
> >> invsym(): matrix has missing values
> >> r(504);
> >>
> >> This is the same error that follows ivreg2 estimation.
> >>
> >> I suspect it might have something to do with the fact that 
> I have a 
> >> large number of instruments (fixed-effects, with 483
> >> dummies) and clustering on those fixed-effects.
> >>
> >> Best,
> >> John.
> >>
> >> --
> >> ____________________________________________________
> >>
> >> Prof. John Antonakis, Associate Dean
> >> Faculty of Business and Economics
> >> Department of Organizational Behavior University of 
> Lausanne Internef 
> >> #618
> >> CH-1015 Lausanne-Dorigny
> >> Switzerland
> >>
> >> Tel ++41 (0)21 692-3438
> >> Fax ++41 (0)21 692-3305
> >>
> >> Faculty page:
> >> http://www.hec.unil.ch/people/jantonakis
> >>
> >> Personal page:
> >> http://www.hec.unil.ch/jantonakis
> >> ____________________________________________________
> >>
> >>
> >> *
> >> *   For searches and help try:
> >> *   http://www.stata.com/help.cgi?search
> >> *   http://www.stata.com/support/statalist/faq
> >> *   http://www.ats.ucla.edu/stat/stata/
> >>
> >>     
> >
> >
> >   
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 


-- 
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index