Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: cholesky vs matpowersym for FGLS transformation in Mata

 From Bert Lloyd To statalist Subject st: cholesky vs matpowersym for FGLS transformation in Mata Date Tue, 24 Apr 2012 21:50:22 -0400

```Dear Statalist,

I have an application for which I need to conduct FGLS estimation "by
hand", that is, transform both the y and X variables so that their
regression cross-products are weighted by an FGLS weighting matrix
Omega^(-1).

That is, my ultimate goal is a regression of the form

(X'*(Omega^-1)*X)^-1*(X'*(Omega^-1)*y)

but for various reasons I need to compute this as a regression of
tilde_y on tilde_X, where either

tilde_X = Omega^(-1/2)*X
and
tilde_y = Omega^(-1/2)*X

or

tilde_X = L'*X
and
tilde_y = L'*y
where
L*L' = Omega^(-1), i.e L is the cholesky decomposition of Omega^(-1).

So, it seems that I could do either of the following
tilde_X = matpowersym(invsym(Omega),0.5)
or
tilde_X = cholesky(invsym(Omega))'*X
and similarly for y, and the ultimate result ought to be the same.

Is there any reason to prefer one method over the other? Are there

Given that a google search for
stata matpowersym
returns 107 hits, while a search for
stata cholesky
returns 12,500 hits, I am inclined to use the Cholesky method, but

Many thanks,

BL

PS - I am aware of the matrix glsaccum function in Stata, however this
is not suitable for my context, essentially because the weighting
matrix is not constant across groups.
*
*   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/
```