Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: right shift elements in a matrix


From   "Lei Xuan" <leix@martingale-research.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: right shift elements in a matrix
Date   Thu, 18 May 2006 09:55:37 -0500

Hello,

I have a question regarding shifting elements in a row matrix.

After logistic regression (-logit-), I have a parameter matrix e(b).
Let 
    matrix b=e(b)
    N=e(df_m)+1 (number of independent variables plus 1)
    
 we have 
    b[1,1] b[1,2] ... b[1,N] 

I want to generate a new matrix with the same elements but different order
(shift one element right), that is,

   b[1,N], b[1,1], b[1,2], ..., b[1, N-1]

I tried to use -svmat- to convert matrix into N variables but I don't know
how to combine them into a new matrix when N is not fixed for each run (In
fixed N, the matrix can be generated by -mkmat-). Is there anyone who can
help me with this shift operation? 

Thanks a lot,

Lei



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