Statalist The Stata Listserver


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

st: RE: matsum - matrix sums of rows


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: matsum - matrix sums of rows
Date   Thu, 24 Aug 2006 14:14:53 +0100

A third alternative to your search is to look at the program 
itself. It is just more Stata. 

After your command you have a new matrix -r- in memory, 
so its elements are 

r[1,1], r[2,1], .... 

In the help, 

matsum A [, row(mat_name) column(mat_name) all(mat_name) display format(fmt)]

    Computes and/or displays the row-wise, column-wise and over-all maximum,
    minimum, and sum over the elements of a matrix. More than one operator may
    be specified simultaneously. These commands default to the column-wise
    operators.

the implication is that you are naming a new matrix with whatever you 
supply as mat_name. 

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

Fabrizio Gilardi Ph.D. 
 
> I've been using the -matsum- command written by Jeroen Weesie. I  
> would like to access the results (notably the sums of rows) to use  
> them in further operations: how can I do this? I've perused the help  
> and Statalist's archives, but I couldn't find a solution.
> 
> Example:
> 
> . matrix A=(1,2,3 \ 4,5,6)
> 
> . matrix list A
> 
> A[2,3]
>      c1  c2  c3
> r1   1   2   3
> r2   4   5   6
> 
> . matsum A, r(r) d
> 
> row-wise sums of matrix A[2,3]
> 
>      c1
> r1   6
> r2  15
> 
> 
> How can I access the sum of the first row of A (i.e. 6) and that of  
> the second row of A  (i.e. 15)?
> 
> I'm still using Stata 7, but I should receive Stata 9 soon.

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