Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: re: how to form a vector for each line


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: re: how to form a vector for each line
Date   Thu, 15 Oct 2009 18:20:03 +0100

I agree with everything you say, except that a variable is an ordered
array with a single subscript too, even though that won't help you much
in calculating an outer product.... Also, Mata lets you think it has the
concept of a vector.... 

Nick 
[email protected] 

Christopher Baum

To be pedantic, Stata (as opposed to Mata) does not and never has had  
vectors. Vectors are ordered arrays with a *single* subscript. There  
is no way to create such an object in Stata. You can have matrices  
with one row or one column (or both) that look like vectors, but to  
use them you must include both a row subscript and a column subscript  
in the notation. In that annoying way, Stata's old matrix language  
does not allow vectors at all. Mata has the concept of a vector, and  
allows you to reference an element as nj[42] rather than nj[42,1] or  
nj[1,42]. IMHO this is a good reason to avoid the old matrix language  
when you can, as it unnecessarily complicates working with 'real'  
vectors such as e(b).

Nick said

Some readers may find Martin's opening sentence a little puzzling,  
however. In Stata, as compared with Mata, there is no difficulty in  
setting up row or column vectors, which are just matrices with one row  
or column. In this sense, Stata has had the idea of vector for several  
versions now.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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