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: Which inverter? (was: RE: RE: ivreg2 weak-id statistic and quadratic terms)


From   "Schaffer, Mark E" <M.E.Schaffer@hw.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Which inverter? (was: RE: RE: ivreg2 weak-id statistic and quadratic terms)
Date   Tue, 21 Feb 2012 19:21:13 -0000

Scott,

I think you're right - it's the default tolerance.  I tried setting the tolerance by hand for both svsolve() and qrsolve(), and if set small enough they both replicated -regress- and the scaled data.

So I wasn't quite right.  It's not the solver per se, but the default tolerance that it uses.

Which raises somewhat different but still interesting questions:

- Why is the default tolerance of svsolve() and qrsolve() in this example lax compared to luinv() and invsym()?

- Is it generally the case that with scaling problems, svsolve() and/or qrsolve() will be more lax?  I.e., was it a coincidence that Miroslav's example generated the same behaviour?  Or might luinv() and/or invsym() sometimes be more lax?

- Is there a simple way of checking for these things without adding much in the way of computational overhead?

- Might it make sense to add to a future Mata wish-list an option for these solvers to return the tolerance to the user so that it can be checked?

--Mark

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of 
> Scott Merryman
> Sent: 21 February 2012 17:46
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Which inverter? (was: RE: RE: ivreg2 weak-id 
> statistic and quadratic terms)
> 
> Is it that the tolerance is very large due to the large value 
> of max(S)?  Changing the tolerance does result in values that 
> are close to the scaled data:
> 
> . *max(S)
> 
> . mata: max(svdsv(XX))
>   1.31904e+15
> 
> . *value of tolerance
> 
> . mata: max(svdsv(XX))*max(y)*epsilon(1)
>   7.615041406
> 
> . mata: beta_sv2=svsolve(XX,Xy,.,-max(svdsv(XX))*max(y)*epsilon(1))
> 
> . mata: beta_sv2
>                   1
>     +----------------+
>   1 |    .755934374  |
>   2 |   .0032936694  |
>   3 |  -1.97687e-06  |
>   4 |    .001060688  |
>     +----------------+
> 
> . mata: beta_sv2=svsolve(XX,Xy,.,-epsilon(1))
> 
> . mata: beta_sv2
>                   1
>     +----------------+
>   1 |   .6979560211  |
>   2 |  -.0218987055  |
>   3 |   1.97388e-06  |
>   4 |   41.39947923  |
>     +----------------+
> 
> . *Compare to scaled data
> 
> . mata: beta_sv1=svsolve(XX1,Xy1)
> 
> . mata: beta_sv1
>                   1
>     +----------------+
>   1 |   .6979557583  |
>   2 |  -21.89870042  |
>   3 |   1.973884277  |
>   4 |   41.39947954  |
>     +----------------+
> 
> 
> Scott
> 
> 
> On Mon, Feb 20, 2012 at 6:11 PM, Schaffer, Mark E 
> <M.E.Schaffer@hw.ac.uk> wrote:
> > Hi all.  I have traced the problem to the choice of inverter.  At 
> > least, it's definitely the problem in the auto dataset 
> example below, 
> > and I'll bet it's the source of Miroslav's problem as well.
> 
> *
> *   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.

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-2012



*
*   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