Median Number Function

From GM-RKB
(Redirected from median measure)
Jump to: navigation, search

A Median Number Function is a statistic function that returns the value (the median value) of a middle member (in the Middle an ordered numeric multiset).



References

2009

  • (WordNet, 2009) ⇒ http://wordnetweb.princeton.edu/perl/webwn?s=median
    • S: (n) median, median value (the value below which 50% of the cases fall)
    • S: (adj) median, average (relating to or constituting the middle value of an ordered set of values (or the average of the middle two in a set with an even number of values)) "the median value of 17, 20, and 36 is 20"; "the median income for the year was $15,000"
    • S: (adj) medial, median (dividing an animal into right and left halves)
    • S: (adj) median, medial (relating to or situated in or extending toward the middle)
  • http://en.wikipedia.org/wiki/Median
    • In probability theory and statistics, a 'median is described as the numeric value separating the higher half of a sample, a population, or a probability distribution, from the lower half. The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one. If there is an even number of observations, then there is no single middle value, so one often takes the mean of the two middle values.
    • In a sample of data, or a finite population, there may be no member of the sample whose value is identical to the median (in the case of an even sample size) and, if there is such a member, there may be more than one so that the median may not uniquely identify a sample member. Nonetheless the value of the median is uniquely determined with the usual definition,
    • At most half the population have values less than the median and at most half have values greater than the median. If both groups contain less than half the population, then some of the population is exactly equal to the median. For example, if a < b < c, then the median of the list {a, b, c} is [math]b[/math], and if a < b < c < d, then the median of the list {a, b, c, d} is the mean of [math]b[/math] and [math]c[/math], i.e. it is (b + c)/2.
    • The median can be used as a measure of location when a distribution is skewed, when end values are not known, or when one requires reduced importance to be attached to outliers, e.g. because they may be measurement errors. A disadvantage of the median is the difficulty of handling it theoretically.
    • The median of some variable [math]x[/math] is denoted either as [math]\tilde{x}[/math] or as [math]\mu_{1/2}(x)\,\!.[/math][1]

2007

#!/usr/bin/perl

   @data = sort { $a <=> $b } @data;
   my $median = @data % 2    ?    $data[(@data-1)/2]   : ($data[@data/2-1]+$data[@data/2])/2 ;