[Limdep Nlogit List] Read matrix / sample statistics of matrix columns

Steven Yen syen at utk.edu
Fri Nov 5 10:31:05 EST 2010


Thanks Prof Greene. I will try that. I do have a real matrix with 
multiple columns. The random matrix was simply a quick way to get a 
matrix together to demonstrate what I need.
Steven Yen

At 07:10 PM 11/4/2010, you wrote:
>Steven. Your matrix is already a matrix.  The page you mention in
>the manual shows how to read a data set from the editor into a matrix.
>The ;MATRIX=Longly says that the data read will be placed in a matrix
>named longley.  Your READ command below takes data that are already
>a matrix and tries to read them into another matrix, though
>unfortunately, it tries to put MYX into itself.  There are a couple
>ways to get the means and standard deviations of a matrix.  You
>can move the matrix to the data area, such as
>Create ; MYX1=-999;MYX2=-999;MYX3=-999$
>Namelist ; MYXV=MYX1,MYX2,MYX3$
>Create ; MYXV=MYX$
>Sample;1-5$
>Now you can use DSTAT to describe the data.  On the other hand, it
>seems it would be much easier just to create the random data as
>variables to begin with.
>/B. Greene
>
>
>----- Original Message -----
>From: "Steven Yen" <syen at utk.edu>
>To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
>Sent: Thursday, November 4, 2010 4:01:14 PM GMT -05:00 Colombia
>Subject: [Limdep Nlogit List] Read matrix / sample statistics of 
>matrix columns
>
>Dear
>
>Page R12-44 of the Reference Guide suggests a way to read a matrix as
>a data file. I could not read a matrix properly; see error message below.
>
>What I need is to calculate sample means and standard deviations for
>each column of a matrix. Is there a convenient way to do this? Thanks.
>
>----
>
>--> calc   ;nr=5 ;nc=3 $
>--> matrix ;list ;myx=rndm(nr,nc) $
>
>Matrix MYX      has  5 rows and  3 columns.
>                 1             2             3
>          +-------------+-------------+-------------+
>         1|    -.10830       .97037       .22962
>         2|    -.71564       .95221     -1.13377
>         3|    -.49604      -.24165      -.27317
>         4|     .50904      -.98409     -2.31595
>         5|    -.14872     -1.35394      1.01877
>          +-------------+-------------+-------------+
>--> read   ;rows=10 ;cols=5 ;matrix=myx $
>    Error     9: READ - error or end of file occurs while reading data set.
>    Error   327: Closing command file to prevent reading data as command
>
>
>
>Steven T. Yen
>http://web.utk.edu/~syen/
>Check out our postdoc opening at:
>http://web.utk.edu/~syen/postdoc.html
>_______________________________________________
>Limdep site list
>Limdep at limdep.itls.usyd.edu.au
>http://limdep.itls.usyd.edu.au
>_______________________________________________
>Limdep site list
>Limdep at limdep.itls.usyd.edu.au
>http://limdep.itls.usyd.edu.au


Steven T. Yen
http://web.utk.edu/~syen/
Check out our postdoc opening at:
http://web.utk.edu/~syen/postdoc.html


More information about the Limdep mailing list