Statalist


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

st: re: Efficient, foolproof calculation of matrix quadratic form with


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: Efficient, foolproof calculation of matrix quadratic form with
Date   Fri, 25 Sep 2009 11:16:17 -0400

<>
Venable said

Alternatively, I know that I could do the sum of the N terms
Xn'*Om_Inv_Block*Xn but I am worried that I would somehow mess this
up. So, another solution, I suppose, would be some idiot-proof way to
do this sum.

This is very similar to the problem of calculating the -sureg- estimator (with the difference that in -sureg- there is no constraint that the X matrices have the same number of columns). The -suregub- routine codes -sureg- in Mata and avoids creating the monster matrix by doing the above sum. It really isn't that hard to set up that loop, and if you think about it, it is incredibly wasteful to be calculating the full matrix (even if memory is not an issue) given the block- diagonal structure implied by the Kronecker. You may find the - suregub- code in the downloadable materials related to ITSP below. That routine implements -sureg- for the special case where T is not necessarily equal, but it also works fine if all equations' T values are the same.

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index