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" <>
To   <>
Subject   st: right shift elements in a matrix
Date   Thu, 18 May 2006 09:55:37 -0500


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

After logistic regression (-logit-), I have a parameter matrix e(b).
    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,


*   For searches and help try:

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