comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Definition of Median was(Re: Finding the index of the median)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Definition of Median was(Re: Finding the index of the median) [message #7322] Thu, 31 October 1996 00:00
Jack Saba is currently offline  Jack Saba
Messages: 30
Registered: January 1996
Member
meron@cars3.uchicago.edu wrote:
>
> In article <327771BA.2781@silk.gsfc.nasa.gov>, "Thomas A. McGlynn" <tam@silk.gsfc.nasa.gov> writes:
>> In looking at the get the index of the median
>> value, I noted that the behavior
>> of the IDL median filter is not what I would have expected.
>>
>> E.g.,
>> print, median([1,2,3,10])
>>
>> prints out 3. This is independent of the order of elements
>> in the array. Is there an accepted definition of what
>> the median value is in this case. For example, I might
>> think 2.5 is a more appropriate choice (but one which would
>> have made the previous discussion incorrect).
>>
> No, median must be one of the elements of the set. 2.5 isn't such.
> The definition is, in principle "a value from the original set such
> that there are as many values below it as above it". Which cannot be
> fulfilled strictly if the number of elements is even. So in such case
> you decide arbitrarily (but preferably consistantly) whether to pick
> the one above or below the dividing line.
>
> Mati Meron | "When you argue with a fool,
> meron@cars.uchicago.edu | chances are he is doing just the same"


From CRC std math tables:

"When n is odd, the median is the middle value of the set of ordered
data; when n is even, the median is usually taken as the mean of the two
middle values of the set of ordered data."
Re: Definition of Median was(Re: Finding the index of the median) [message #7334 is a reply to message #7322] Wed, 30 October 1996 00:00 Go to previous message
meron is currently offline  meron
Messages: 51
Registered: July 1995
Member
In article <327771BA.2781@silk.gsfc.nasa.gov>, "Thomas A. McGlynn" <tam@silk.gsfc.nasa.gov> writes:
> In looking at the get the index of the median
> value, I noted that the behavior
> of the IDL median filter is not what I would have expected.
>
> E.g.,
> print, median([1,2,3,10])
>
> prints out 3. This is independent of the order of elements
> in the array. Is there an accepted definition of what
> the median value is in this case. For example, I might
> think 2.5 is a more appropriate choice (but one which would
> have made the previous discussion incorrect).
>
No, median must be one of the elements of the set. 2.5 isn't such.
The definition is, in principle "a value from the original set such
that there are as many values below it as above it". Which cannot be
fulfilled strictly if the number of elements is even. So in such case
you decide arbitrarily (but preferably consistantly) whether to pick
the one above or below the dividing line.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Is there a cheap implementation of IDL
Next Topic: Alarm clock -- ring!

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:42:21 PDT 2025

Total time taken to generate the page: 0.00629 seconds