thank you very much david,
martin h
-------------------------------------------
Martin HALLA
Department of Economics
Johannes Kepler University Linz
Altenbergerstr. 69
A-4040 Linz, Austria
[email protected]
Tel.: +43-732-2468-8219
Fax: +43-732-2468-2-8219
http://www.econ.jku.at/
-------------------------------------------
>>> [email protected] 02/01/05 4:01 pm >>>
Martin Halla <[email protected]> wrote that - matrix glsaccum- only
solves
part of the problem. Martin needs to compute
matrix B = inv((z*inv(z'z)*z'x)'*(inv(sigma)#In)*x) * ///
(z*inv(z'z)*z'x)'*(inv(sigma) # In)*y
which is difficult since z is N by p, x is N by k and y is N by 1.
Martin used -matrix accum- to compute
ZZ=z'z
ZX=z'x
yielding
matrix B = inv((z*inv(ZZ)*ZX)'*(inv(sigma)#In)*x) * ///
(z*inv(ZZ)*ZX)'*(inv(sigma) # In)*y
Defining
W = (z*inv(ZZ)*ZX)
cause the problem to become
B = inv(W'*(inv(sigma)#In)x)*W'(inv(sigma)#In)*y
which could computed using -matrix glsaccum-, if we had the variables
that
make up the matrix W.
To obtain W, Martin can let each column of inv(ZZ)*ZX be vector that we
will
call h. Martin can then transpose h, so it is now a row vector, make
the
row names of h equal to names of the variables in z and then use
-matrix
score- to compute a new variable. After doing this for each column of
inv(ZZ)*ZX, he will have created the variables in W
With the W variables in hand, Martin now needs to compute
W'(inv(sigma)#In)x
and
W'(inv(sigma)#In)y
which can be computed using -matrix glsaccum-. (To get
W'(inv(sigma)#In)x
from -matrix glsaccum- include the W and the x variables in the varlist
and
then grab the upper-right block of the resulting matrix.)
-David
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/