Statalist The Stata Listserver


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

st: return the maximum and its corresponding value of a matrix in Mata


From   "Le Wang" <[email protected]>
To   [email protected]
Subject   st: return the maximum and its corresponding value of a matrix in Mata
Date   Sun, 5 Nov 2006 12:29:03 -0600

Hi there,

I have a question regarding Mata. Suppose I have an imaginary matrix
with two columns as follows,
x                      y
2.9479707       .15
2.926226         .16
2.8994321       .17
2.8691981       .18
2.8368784       .19
2.8035694        .2
2.7701303       .21
2.7372142       .22
2.705299         .23
2.6747184        .24

I want Mata to return the maximum values of column 1 (x) AND its
corresonding values in column 2 (y), in this example, 2.9479707 and
0.15. I understand I can use -rowmax- to find the maximum, but I am
not quite sure how to find the corresponding value.

Thanks.

Le

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Le Wang, Ph.D.
Minnesota Population Center
University of Minnesota
(o) 612-624-5818
*
*   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