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

Re: st: RE: RE: highest scalar of a matrix


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: highest scalar of a matrix
Date   Fri, 06 Jun 2003 11:31:40 -0400

At 03:05 PM 6/6/2003 +0100, Joao Pedro W. de Azevedo  wrote:

> > I'm looking for a function or a routine in Stata7 which would
> > give me the
> > highest scalar of a matrix
Both Nick Winter & Nick Cox replied.

I would just add a warning. In Nick Winter's program,

> if `M'[`r',`c']>`val' {
> scalar `val'=`M'[`r',`c']

will pick up missing values if any are present in `M', which is possible in Stata 8 (even if your program
states version 7).

Unless you want to count a missing as a maximal value, that condition should be
if ~mi(`M'[`r',`c']) & (`M'[`r',`c'] > `val | mi(`val') ) {

Why did I throw in that condition mi(`val') ? Because `val' is pre-loaded with `M'[1,1], so it, too, may be missing, until it is replaced when the first nonmissing value is encountered.

(Now, given this more robust test, you could pre-load `val' with missing, rather than `M'[1,1].)

I am not familiar with the -matmax- program by Jeroen Weesie, so I don't know whether it takes this approach.

-- David


David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404

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