Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: RE: Error in ivreg2 and ivregress


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: RE: Error in ivreg2 and ivregress
Date   Tue, 26 Jul 2011 09:39:08 +0100

In an earlier contribution to this thread, Mark wrote

> > 1. Tell us which versions of -ivreg2- and -ranktest- you have
> > installed. (Use the -which- command.) You may not have the most
> > up-to-date versions (they should be 3.0.06 and 1.2.03,
> respectively).

As far as I can see, that request still stands.

Nick

On Mon, Jul 25, 2011 at 5:53 PM, B Villena <benjaminvillena@hotmail.com> wrote:
>
>
> Dear Mark,
>
>
> I have run several experiments to try to undersantd what going on.
> The most surprising result is that LIML ivreg2 and ivregress do work when I used my laptop (Windows XP) instead of my server (Windows 7).
>
> Even more surprising to me is the fact that I run a second session of Stata 11.2 in my Windows 7 server, ivreg2 and ivregress work!!! I obtain the same results I got in my laptop.
>
> I investigated further this issue by running 2SLS in my server session 1 and session 2, and in my laptop. I got the same results!!
>
> However, if I try to run ivreg2 in my server session 1 I get the following error message
>
> invsym(): matrix has missing values
> r(504);
>
>
> If I run ivregress in my server session 2 I get the error message
>
> estimates post: matrix has missing values
> r(504);
>
>
> I have to add the fact that this problem happened when I was running 16 Stata 11.2 sessions in my server. Do you think this fact could explain some computer diminished performance?
>
> All this issue looks incredibly odd to me, so I'd really appreciate if you help me understand what's going on
>
> Best,
>
> B
>
>
>
>
> ----------------------------------------
>> Subject: st: RE: RE: Error in ivreg2 and ivregress
>> Date: Sat, 23 Jul 2011 14:25:13 +0100
>> From: M.E.Schaffer@hw.ac.uk
>> To: statalist@hsphsun2.harvard.edu
>>
>> Benjamin,
>>
>> > -----Original Message-----
>> > From: owner-statalist@hsphsun2.harvard.edu
>> > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of B Villena
>> > Sent: 23 July 2011 06:14
>> > To: Statalist
>> > Subject: st: RE: Error in ivreg2 and ivregress
>> >
>> >
>> > Dear Mark,
>> >
>> > Thank you for your prompt answer
>> > I updated my versions of ivreg2 and ranktest as you
>> > suggested. However, I get a different error code
>> > invsym(): matrix has missing values
>> > r(504);
>> > r(504);
>> >
>> > Regarding repeated instruments, I only notice that ivreg2
>> > detects this situation, so I do not believe it is the reason
>> > of the error.
>>
>> Maybe, but you shouldn't do it anyway. It makes no sense.
>>
>> > I suspect this problem arises due to high collinearity among
>> > instruments (R-squared for regressions of one instrument
>> > against the other ones can be as high as 0.9 in my data).
>> > Since this R-squared is quite high, I have dropped one of the
>> > instruments to make ivreg2 work in this case. Given the high
>> > collinearity among instruments, I guess this approach is
>> > losing little information.
>>
>> Impossible to say without seeing more details. For example, you could
>> have very badly scaled data. If the mean of one variable is 000000s of
>> times larger than the other, you can have big numerical problems with
>> matrix inversion.
>>
>> > Nevertheless, I still wonder whether there may be some other
>> > bug in my code or in ivreg2 - ivregress code.
>>
>> The bug is very unlikely to be in the estimators - the two programs are
>> independently written. The problem is in your specification/data.
>>
>> > The
>> > collinearity seems high, but not that high!
>> >
>> > In addition, I follow your suggestion of using ivreg2 to
>> > compute a 2SLS estimator in this case. I do obtain a
>> > meaningful estimation with 2SLS.
>>
>> You should probably be able to tell from the first and second stage
>> output where the problem is. That was the reason I suggested you try
>> 2SLS.
>>
>> > However, I strongly prefer
>> > LIML in this case since the instruments seem somewhat weak.
>>
>> You also should try partialling out the exogenous regressors that aren't
>> of interest (if there are any).
>>
>> Yours,
>> Mark
>>
>> >
>> > Thanks a lot
>> >
>> > B
>> >
>> >
>> >
>> > > Subject: st: RE: Error in ivreg2 and ivregress
>> > > Date: Fri, 22 Jul 2011 23:11:56 +0100
>> > > From: M.E.Schaffer@hw.ac.uk
>> > > To: statalist@hsphsun2.harvard.edu
>> > >
>> > > Benjamin,
>> > >
>> > > A few suggestions/thoughts:
>> > >
>> > > 1. Tell us which versions of -ivreg2- and -ranktest- you have
>> > > installed. (Use the -which- command.) You may not have the most
>> > > up-to-date versions (they should be 3.0.06 and 1.2.03,
>> > respectively).
>> > >
>> > > 2. When you say
>> > >
>> > > > In both cases there is a repeated instrument on the exogenous
>> > > > instruments list, i.e. z2=z3 in the above example
>> > >
>> > > I don't understand what you mean. If z2 and z3 are
>> > identical, then it
>> > > makes no sense to include them both since they are
>> > perfectly collinear.
>> > > But -ivreg2- (and, I think -ivregress-) should catch this
>> > and drop one
>> > > of them.
>> > >
>> > > 3. LIML and 2SLS are very closely related. If this is a data-driven
>> > > problem, it will probably be apparent in the 2SLS output. Also, the
>> > > collinearity in (2) should be reported in the -ivreg2- 2SLS output.
>> > > You can share this output with us if you want.
>> > >
>> > > 4. If it's data related, you might be able to address it by
>> > > partialling-out some of the regressors using the -partial- option.
>> > >
>> > > HTH,
>> > > Mark
>> > >
>> > > > -----Original Message-----
>> > > > From: owner-statalist@hsphsun2.harvard.edu
>> > > > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf
>> > Of B Villena
>> > > > Sent: 22 July 2011 22:42
>> > > > To: Statalist
>> > > > Subject: st: Error in ivreg2 and ivregress
>> > > >
>> > > >
>> > > > Hello,
>> > > >
>> > > > I'm trying to estimate a series of linear IV model by
>> > LIML using the
>> > > > user-written command ivreg2.
>> > > >
>> > > >
>> > > >
>> > > > > ivreg2 y x1 x2 x3 (y1 y2 = z1 z2 z3 z4) if sample==1,
>> > liml first
>> > > > > savefirst
>> > > >
>> > > > I obtain the following error message
>> > > >
>> > > >
>> > > >
>> > > > (** On entry to DSTEIN parameter 6 had an illegal value)
>> > > > _symeigen_la(): 3930 error in LAPACK routine
>> > > > _symeigen_work(): - function returned error
>> > > > _symeigensystem(): - function returned error
>> > > > symeigensystem(): - function returned error
>> > > > rkstat(): - function returned error
>> > > > <istmt>: - function returned error
>> > > > r(3930);
>> > > >
>> > > >
>> > > > As far as I know, it seems that LAPACK cannot compute eigenvalues
>> > > > needed to obtain LIML estimator
>> > > >
>> > > >
>> > > >
>> > > > I have tried using Stata 11 command ivregress.
>> > > >
>> > > > > ivregress liml y x1 x2 x3 (y1 y2 = z1 z2 z3 z4) if sample==1,
>> > > > > first
>> > > >
>> > > >
>> > > >
>> > > > It does not work, either
>> > > >
>> > > >
>> > > >
>> > > > I get the following error message
>> > > >
>> > > >
>> > > >
>> > > > estimates post: matrix has missing values r(504); r(504);
>> > > >
>> > > >
>> > > >
>> > > > In both cases there is a repeated instrument on the exogenous
>> > > > instruments list, i.e. z2=z3 in the above example
>> > > >
>> > > > However, this does not seem to be the problem since I
>> > have made some
>> > > > similar estimations with some repeated
>> > > >
>> > > > instruments and both commands seem to deal with this
>> > issue very well
>> > > > in other cases.
>> > > >
>> > > >
>> > > >
>> > > > Has anyone experienced a similar problem? Is there any way to
>> > > > circumvent this problem?
>> > > >
>> > > > Is it possible that this problem is related to an
>> > unfortunate data
>> > > > configuration?
>> > > >
>> > > >
>> > > >
>> > > > Best regards,
>> > > >
>> > > >
>> > > >
>> > > > Benjamin
>> > > > *
>> > > > * 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/
>> >
>> > *
>> > * 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/
> *
> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index