Re: Finding the index of the median [message #7344 is a reply to message #7268] |
Wed, 30 October 1996 00:00   |
Joseph M Zawodny
Messages: 24 Registered: March 1996
|
Junior Member |
|
|
David Fanning wrote:
>
> David Foster <foster@bial1.ucsd.edu> writes in this ever
> lengthening thread:
>
>> The MEDIAN() function isn't returning "one" of those locations.
>> The very fact that it's the median of the array means that it's
>> likely that there are many indices with that value. It doesn't
>> make sense to expect to find THE index. If there are 5 indices
>> with the median value, there's no way to distinguish between
>> them.
>
> Perhaps we are all missing Dean's point. Take a hypothetical
> situation. Suppose I have a scheme to steal some money from
> the bank. But my scheme requires that there be *exactly* one
> million dollars in the account I steal from. And suppose I have
> a function like the WHERE function that can tell me, out of all
> the accounts in the bank, which ones have exactly one million
> dollars.
>
> Most of the posters to this thread seem to be arguing that it
> doesn't make one bit of difference which account I steal the
> money from, one would appear to be just as good as the other.
>
> But of course, it probably does matter. In fact, given the choice,
> I would rather steal from an account that had little activity since
> this would give me more time to reach the South Islands
> without my little scheme being discovered.
>
> I seem to remember that in Dean's original question he had a
> parallel array that contained some kind of noise estimate.
Dave,
This was exactly my point in my original response. He
needed to add some additional selection criteria to allow the
selection of only one of the possible array elements which were
equal to the median value. Until he fully understands his own
requirements in this respect neither he nor anyone else can come
up with the required code. Maybe he has already sorted the data
in some meaningful way and he simply wants the "middle median"
(still an illposed question if there are an even number of elements
which equal the median value), but he must acknowledge the existance
of the need for additional selectivity. Simply stating that "I want
the element that IDL selects as representative of the median value"
assumes that the median function actually does distinguish between
otherwise equivalent elements, which I doubt it does. Even your
own example becomes ambiguous if there were two accounts with
exactly $1M and the same number of transactions in the last month
(in which case I'd decide to steal $2M ;-).
--
Work: Dr. Joseph M. Zawodny Play: Joe Zawodny
NASA Langley Research Center KO4LW@amsat.org
E-mail: J.M.Zawodny@LaRC.NASA.gov zawodny@exis.net
(757) 864-2681 (757) 864-2671 FAX
|
|
|