Statalist


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

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


From   Venable <[email protected]>
To   [email protected]
Subject   Re: st: re: Efficient, foolproof calculation of matrix quadratic form with
Date   Fri, 25 Sep 2009 12:12:55 -0400

Thanks Kit. I agree that creating an NTxNT matrix would be wasteful. I
was just hoping there was a way to avoid doing that while maintaining
something close to the simplicity of the one-line, no-loops Kronecker
way. (In fact, I believe your ISP book points out that matrix ops are
often preferable to long loops. I guess this is an exception!) It seem
that summation is indeed the simplest way, so I will proceed with that
and try to get it right.

Again, many thanks.

On Fri, Sep 25, 2009 at 11:16 AM, Kit Baum <[email protected]> wrote:
> <>
> 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/
>

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