> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Salvati, Jean
> Sent: Tuesday, January 11, 2005 2:47 PM
> To: [email protected]
> Subject: st: Variable/vector outer product?
>
> Hello,
>
> I have a series u with N observations, and I want to compute the NxN
> matrix uu'. Do I have to use mkmat to do this, or is there another way?
>
> Thanks a lot.
>
> Jean Salvati
>
-mkmat- would seem to be the easiest, way but you could use two -fovalue-
loops.
For example:
clear
set obs 5
gen u = _n
mkmat u,matrix(U)
matrix uu = U*U'
svmat uu
l uu*
qui {
forv i = 1/5 {
gen c`i' = .
forv j = 1/5 {
replace c`i' = u[`i']*u[`j'] in `j'
}
}
}
l c*
Hope this helps,
Scott
*
* 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/