Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: absolute values of matrix elements [stata 8]


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: absolute values of matrix elements [stata 8]
Date   Fri, 11 Nov 2005 17:36:10 -0000

I think you are looking at the wrong package. -matewmf- will
do this. It is more entertaining to write your own
as a couple of -forval- loops. 

STB-56  dm79  . . . . . . . . . . . . . . . . . . Yet more new matrix commands
        (help matcorr, matewmf, matvsort, svmat2 if installed)  . .  N. J. Cox
        7/00    pp.4--8; STB Reprints Vol 10, pp.17--23
        commands to produce a correlation matrix, elementwise monadic
        function of another matrix, selected subsets of matrix rows
        and columns, vec or vech of a matrix, elements sorted within
        a vector, matrix from a vector, and commands to save matrices

. mat a = (1,2,-2,-1) 

. matewmf a b, f(abs)

. mat li b

b[1,4]
    c1  c2  c3  c4
r1   1   2   2   1

Nick 
[email protected] 

R.E. De Hoyos
 
> I am trying to transform a matrix A into matrix B where B's 
> elements are the abolute values of A's.
> 
> B[i,j] =  | A[i,j] |
> 
> I found Nick's -matodd- but it seems not to have an -abs- elementwise 
> option.

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