[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 <>
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 <> 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   |
>                              An Introduction to Stata Programming  |
>   An Introduction to Modern Econometrics Using Stata  |
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index