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

st: transpose of matrix


From   Christopher F Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: transpose of matrix
Date   Mon, 1 Aug 2005 09:09:28 -0400

Amadou wants to "transpose" a column vector--but what he really means is to reverse the order of its elements.

Elementary row and column operations, my dear Watson. The mirror image of an identity matrix does what he wants.

mat j = J(5,5,0)
forv i = 1/5 {
mat j[`i',5-`i'+1] = 1
}
mat list j
mat list b
mat c = j*b
mat list c


Kit Baum, Boston College Economics baum@bc.edu
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