Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: -estimates post- question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: -estimates post- question
Date   Tue, 19 Aug 2003 23:41:33 +0100

Mark Schaffer 
 
> I've just discovered that -estimates post- 
> in version 7 
> seems to behave inconsistently when the covariance matrix 
> being posted is 
> not positive definite.  Sometimes it posts the matrix 
> without complaint; 
> other times it bombs out with error 506, "matrix not 
> positive definite".  A 
> demonsration is below.
> 
> Any ideas about why -est post- might accept some non-pd 
> matrices and not 
> others?
> 
> --Mark
> 
> * This covariance matrix is not positive definite,
> * and -est post- will refuse to post it.
> 
> . mat list Vsave
> 
> symmetric Vsave[4,4]
>                                         L.            
>                 p           w           p       _cons
>     p   .00649023
>     w  -.00412379     .001033
>   L.p  -.00480518   .00311278   .00541914
> _cons   .15565638  -.03696101  -.14100874    1.592022
> 
> . mat list bsave
> 
> bsave[1,4]
>                                   L.           
>             p          w          p      _cons
> y1  .19293435  .79621877  .08988469  16.236603
> 
> . matsqrt Vsave
> matrix is not poisitive definite
> r(504);
> 
> . est post bsave Vsave
> matrix not positive definite
> r(506);
> 
> * This matrix covariance matrix is also not positive definite,
> * but -estimates post- will post it anyway.
> 
> . mat list Vsave2
> 
> symmetric Vsave2[4,4]
>                                         L.            
>                 p           w           p       _cons
>     p   .02953177
>     w   -.0035374   .00122606
>   L.p  -.02182449   .00140922   .01935147
> _cons  -.01117901  -.02100185    .0169305   1.0082315
> 
> . mat list bsave2
> 
> bsave2[1,4]
>                                   L.           
>             p          w          p      _cons
> y1  .01730217  .81018271  .21623384  16.554759
> 
> . matsqrt Vsave
> matrix is not poisitive definite
> r(504);
> 
> . est post bsave2 Vsave2
> 
> . mat list e(V)
> 
> symmetric e(V)[4,4]
>                                         L.            
>                 p           w           p       _cons
>     p   .02953177
>     w   -.0035374   .00122606
>   L.p  -.02182449   .00140922   .01935147
> _cons  -.01117901  -.02100185    .0169305   1.0082315
> 

Here's a guess: this is a replay, with details changed, 
of the "when is a matrix (deemed to be) symmetric?" debate
(see e.g. Vince Wiggins' 10 June posting on that, also 
to Mark). 

In principle, a matrix is positive definite or not, 
period, as every pure mathematician will (presumably) insist.
Write a program to do it, using finite precision arithmetic
etc., and things are not quite so straightforward, 
as every numerical analyst will (presumably) insist. 

Mark is using -matsqrt-, as a test, but is this 
doing ___exactly____ the same thing? 

Nick
n.j.cox@durham.ac.uk
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index