Monday, February 20, 2006

st: RE: replicating rows of a matrix

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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?