median

09132014, 06:11 PM
(This post was last modified: 09132014 06:15 PM by Helge Gabert.)
Post: #1




median
I was a little surprised to see that median, for an even number of elements in a list, both in Home and CAS, returns the smaller element of the two middle elements of the ordered list, e.g.,
median({1,2,3,4}) returns 2. But, as far as I know, the statistical convention is to return the arithmetic mean of the ordered, two middle elements, so what should be returned for the above example is 2.5 in Home, and 5/2 in CAS. 

09132014, 06:44 PM
Post: #2




RE: median
The two conventions exist. I prefer to return an element of the sequence, because it applies to any ordered sequence without requiring to be able to add two elements and divide an element by 2. It is also easier to implement.


09132014, 08:25 PM
Post: #3




RE: median
Hi,
I am a math teacher. I know the fact that median can be found by arranging all the observations from lowest value to highest value and picking the middle one. So the first group is <= median and median < the second group.. So the Prime is OK but... why don't take the usually convention! I will have to say at my students "Don't take your Prime to do the median" this is sad. Marcel 

09132014, 09:46 PM
Post: #4




RE: median
In math classrooms in the United States, there is only one convention: the median of a dataset is the middle value if there is an odd number of values. If there is an even number of values, the median is the average of the two middle values.


09142014, 02:24 AM
Post: #5




RE: median
I'm not aware of any other computer program, language, or calculator that defaults to the lower element. I just tested Mathematica, Matlab, R and Excel and they all return the average of the two central elements. In 10 minutes of googling I couldn't find one example where the author didn't just average the two central elements... I'm not saying you're wrong per se; but this will probably bork many things; silently and without error. Like spreadsheets.


09142014, 03:41 AM
Post: #6




RE: median
I too am not aware of any software package that follow this method. Anyone ever encountered it?
TW Although I work for the HP calculator group, the views and opinions I post here are my own. 

09142014, 04:21 AM
Post: #7




RE: median
(09132014 08:25 PM)Marcel Wrote: Hi, Or simply have them type this once into the Define window via [Shift] [x t θ n]: Name: med Function: (median(M1)+median(tail(M1)))/2 From then on, they can use med() instead of median(), and get the expected answer. <0ɸ0> Joe 

09142014, 04:35 AM
(This post was last modified: 09142014 06:04 AM by Helge Gabert.)
Post: #8




RE: median
Yes, this will do nicely (if the array or list is already sorted).
Otherwise: (median(M1)+median(tail(SORT(M1))))/2. 

09142014, 06:34 AM
Post: #9




RE: median
Wikipedia (French) tells
"Pour une liste ordonnée de 2N éléments, toute valeur comprise entre l'élément N et l'élément N+1 est une médiane;" (evey value between element N and N+1 is a median if the list has 2N elements). Wikipedia (English) "If there is an even number of observations, then there is no single middle value; the median is then usually defined to be the mean of the two middle values", observe the word "usually". If you are using median to describe a statistical serie, using one definition or another is not important. Those who insist on the arithmetic mean definition are using medians for a different purpose, not related to statistics. 

09142014, 07:17 AM
Post: #10




RE: median
(09142014 04:35 AM)Helge Gabert Wrote: Yes, this will do nicely (if the array or list is already sorted). Yikes, I forgot that it might not be presorted. Good catch! <0ɸ0> Joe 

09142014, 09:37 AM
Post: #11




RE: median
BTW, I can easily add code to return the arit mean for the Prime (like I did for geogebra) but this will not extend to quartiles.


09142014, 09:51 AM
Post: #12




RE: median
(09142014 09:37 AM)parisse Wrote: BTW, I can easily add code to return the arit mean for the Prime (like I did for geogebra) but this will not extend to quartiles. Weighted mean of adjacent elements? I've never seen a median of an even number of items defined as the smaller of them. Are you using the linear time algorithm for the median and quartiles?  Pauli 

09142014, 10:11 AM
Post: #13




RE: median
Much nicer to guarantee the median returning an element from the set for several applications I came across. OTOH, the algorithm given is clearly biased towards "lower" values .


09142014, 11:56 AM
Post: #14




RE: median  
« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)