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

st: transpose of matrix


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: transpose of matrix
Date   Mon, 1 Aug 2005 12:36:59 -0400

Al wondered how to get a permutation matrix in Mata. Try help permutation.

: c
1
+------+
1 | .1 |
2 | .3 |
3 | .5 |
4 | .7 |
5 | .9 |
+------+

: p
1 2 3 4 5
+---------------------+
1 | 5 4 3 2 1 |
+---------------------+

: d=c[p,.]

: d
1
+------+
1 | .9 |
2 | .7 |
3 | .5 |
4 | .3 |
5 | .1 |
+------+



Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


*
* 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/




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