Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Stata matrix to Mata matrix form - Turn lower diagonal matrix


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Stata matrix to Mata matrix form - Turn lower diagonal matrix
Date   Thu, 1 Nov 2012 12:14:37 -0500

On Thu, Nov 1, 2012 at 11:46 AM, Bianca B. <bianca268@yahoo.com> wrote:
>
> mat_S2[1,2] is the name of the matrix.
>
>   mat_S2
>
>    1   2
>    +---------+
>  1 |  0      |
>    |  1   0
>    |
> > >+---------+
> I found this old post
> http://www.stata.com/statalist/archive/2007-02/msg00156.html
>
> where there is exactly my same question that is to turn my lower-triangular matrix, named mat_S2, into a symmetrical matrix by reflecting the lower triangular elements across the diagonal.
>
It already is - the upper triangle is not displayed but it does exist.

For example:

mata
a = 0,1 \ 1,0
a
a[1,2]
a[2,1]
vec(a)
end

 Scott
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index