Statalist The Stata Listserver


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

st: RE: replicating rows of a matrix


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: replicating rows of a matrix
Date   Mon, 20 Feb 2006 13:54:16 -0000

You must evaluate, not copy. 

local k = rowsof(c)

Alternatively, 

matrix A = (1600,6400,7000,7000,7000)
 
forval i = 1/`= rowsof(C)' { 
 	mat B = nullmat(B) \ A 
}

Nick 
n.j.cox@durham.ac.uk 

Lucy Morecroft
 
> I have a 1 x 5 matrix (A) and I am trying to create another matrix B,
> which is basically the rows of A replicated k times (so 
> dimensions for B
> are k x 5). I am trying to use the nullmat function, which i found
> quoted in a message in your archive "st: RE: Filling a 
> matrix", my code
> follows:
> 
> local k rowsof(C)
> 
> matrix A = (1600,6400,7000,7000,7000)
> 
> forval i = 1/`k' { 
> 	mat B = nullmat(B) \ A 
> }
> 
> Using the above i get an invalid syntax error. Does anyone see what
> mistake I am making? Can I use local values with nullmat?

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