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: Guidance on matrix inversion for OLS in mata


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Guidance on matrix inversion for OLS in mata
Date   Tue, 27 Apr 2010 11:23:59 -0400

Thomas Jacobs <thomasjacobs@gmail.com>:
Zero is not a problem, but you should expunge the missings first;
however you seem to be trying to rewrite -regress- as you go, which is
far from a good idea. Why *not* export your vectors to Stata and run
-regress- and let Stata handle the sample selection and matrix
inversion for you?

Maybe if you give us a simple example with real numbers, the problem
will be clearer and you can get better guidance...

On Tue, Apr 27, 2010 at 12:45 AM, Thomas Jacobs <thomasjacobs@gmail.com> wrote:
> Hi,
>
> I am trying to perform a lengthy series of simulations to examine some
> event study methodologies.  I have moved to mata for the bulk of the
> work but find that for those cases where I wish to use a market model
> approach requiring an OLS regression to establish abnormal returns I
> am unable to generate an inverse for x'x in seeking to solve for beta
> hat.  I am typically working with vectors that have 1. missing values,
> 2. zero values, and 3. very small values close to zero (within a
> couple of decimal places such as -.01 or .005).  I have tried mata's
> cholinv, invsym, pinv, luinv, and qrinv (I realize that some of these
> are probably inappropriate for my problem but I am no expert) and
> generally get an inverse matrix of missing values or bizarre results
> like a single populated row.
>
> I would prefer not to go back and forth between stata and mata to use
> the stata regress function unless that is the only way to accomplish
> this effort.
>
> Can anyone offer general guidance on how to proceed here?  Thanks.
>
> Tom

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