Statalist The Stata Listserver


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

st: RE: replicating rows of a matrix


From   "Lucy Morecroft" <[email protected]>
To   <[email protected]>
Subject   st: RE: replicating rows of a matrix
Date   Mon, 20 Feb 2006 14:10:10 +0000

Thank you very much.

Lucy

>>> [email protected] 20/02/2006 13:54:16 >>>
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 
[email protected] 

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/


                                        

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index