Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: RE: st: kronecker product - matsize

From   "David M. Drukker, StataCorp" <>
Subject   RE: RE: st: kronecker product - matsize
Date   Tue, 01 Feb 2005 09:01:17 -0600

Martin Halla <> 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



	matrix B = inv((z*inv(ZZ)*ZX)'*(inv(sigma)#In)*x) *	///
		(z*inv(ZZ)*ZX)'*(inv(sigma) # In)*y


	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



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.)


*   For searches and help try:

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