Thanks to both of you. This command (within mata) has saved me a lot of time.
Rachel
On 2/5/07, William Gould, Stata <[email protected]> wrote:
Kam Kup <[email protected]> wrote,
> I'm looking for a function that can turn a
> lower-triangular matrix into a symmetrical matrix by
> reflecting the lower triangular elements across the
> diagonal (without disturbing the original elements.)
and Maarten buis <[email protected]> replied
> -help mata makesymmetric()-
Good answer if Kam is using Mata. If he's using Stata's old matrix
language, here's how Kam could use Maarten's answer to implement a
solution:
program makesymmetric
version 9
syntax name
qui mat list `namelist' // to make sure exists
mata: st_replacematrix("`namelist'", ///
makesymmetric(st_matrix("`namelist'")))
end
-- Bill
[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/