# .

# Median

In statistics and probability theory, median is described as the numerical 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; the median is then usually defined to be the mean of the two middle values.[1][2]

A median is only defined on one-dimensional data, and is independent of any distance metric. A geometric median, on the other hand, is defined in any number of dimensions.

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. A related concept, in which the outcome is forced to correspond to a member of the sample, is the medoid.

At most, half the population have values strictly less than the median, and, at most, half have values strictly greater than the median. If each group contains 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 b. If a <> b <> c as well, then only a is strictly less than the median, and only c is strictly greater than the median. Since each group is less than half (one-third, in fact), the leftover b is strictly equal to the median (a truism).

Likewise, if a < b < c < d, then the median of the list {a, b, c, d} is the mean of b and c; 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.

In terms of notation, some authors represent the median of a variable x either as \( \tilde{x} \) or as \( \mu_{1/2}\,\! \) .[1] There is no simple, widely accepted standard notation for the median, so the use of these or other symbols for the median needs to be explicitly defined when they are introduced.

Measures of location and dispersion

The median is one of a number ways of summarising the typical values associated with members of a statistical population: thus it is a possible location parameter.

When the median is used as a location parameter in descriptive statistics, there are several choices for a measure of variability: the range, the interquartile range, the mean absolute deviation, and the median absolute deviation. Since the median is the same as the second quartile, its calculation is illustrated in the article on quartiles.

For practical purposes, different measures of location and dispersion are often compared on the basis of how well the corresponding population values can be estimated from a sample of data. The median, estimated using the sample median, has good properties in this regard. While it is not usually optimal if a given population distribution is assumed, its properties are always reasonably good. For example, a comparison of the efficiency of candidate estimators, shows that the sample mean is more statistically efficient than the sample median when data are uncontaminated by data from heavy-tailed distributions or from mixtures of distributions, but less efficient otherwise, and that the efficiency of the sample median is higher than that for a wide range of distributions.

Medians of probability distributions

For any probability distribution on the real line R with cumulative distribution function F, regardless of whether it is any kind of continuous probability distribution, in particular an absolutely continuous distribution (and therefore has a probability density function), or a discrete probability distribution, a median is by definition any real number m that satisfies the inequalities

\( \operatorname{P}(X\leq m) \geq \frac{1}{2}\text{ and }\operatorname{P}(X\geq m) \geq \frac{1}{2}\,\! \)

or, equivalenty, the inequalities

\( \int_{-\infty}^m \mathrm{d}F(x) \geq \frac{1}{2}\text{ and }\int_m^{\infty} \mathrm{d}F(x) \geq \frac{1}{2}\,\! \)

in which a Lebesgue–Stieltjes integral is used. For an absolutely continuous probability distribution with probability density function ƒ, the median satisfies

\( \operatorname{P}(X\leq m) = \operatorname{P}(X\geq m)=\int_{-\infty}^m f(x)\, \mathrm{d}x=\frac{1}{2}.\,\! \)

Any probability distribution on R has at least one median, but there may be more than one median. Where exactly one median exists, statisticians speak of "the median" correctly; even when the median is not unique, some statisticians speak of "the median" informally.

Medians of particular distributions

The medians of certain types of distributions can be easily calculated from their parameters:

The median of a normal distribution with mean μ and variance σ2 is μ. In fact, for a normal distribution, mean = median = mode.

The median of a uniform distribution in the interval [a, b] is (a + b) / 2, which is also the mean.

The median of a Cauchy distribution with location parameter x0 and scale parameter y is x0, the location parameter.

The median of an exponential distribution with rate parameter λ is the natural logarithm of 2 divided by the rate parameter: λ−1ln 2.

The median of a Weibull distribution with shape parameter k and scale parameter λ is λ(ln 2)1/k.

Medians in descriptive statistics

Comparison of mean, median and mode of two log-normal distributions with different skewness.

The median is used primarily for skewed distributions, which it summarizes differently than the arithmetic mean. Consider the multiset { 1, 2, 2, 2, 3, 14 }. The median is 2 in this case, as is the mode, and it might be seen as a better indication of central tendency than the arithmetic mean of 4.

Calculation of medians is a popular technique in summary statistics and summarizing statistical data, since it is simple to understand and easy to calculate, while also giving a measure that is more robust in the presence of outlier values than is the mean.

Medians for populations

An optimality property

The mean absolute error of a real variable c with respect to the random variable X is

\( E(\left|X-c\right|)\, \)

Provided that the probability distribution of X is such that the above expectation exists, then m is a median of X if and only if m is a minimizer of the mean absolute error with respect to X.[3] In particular, m is a sample median if and only if m minimizes the arithmetic mean of the absolute deviations.

See also k-medians clustering.

Unimodal distributions

It can be shown for a unimodal distribution that the mean and the median lie within (3/5)1/2 times the standard deviation of each other.[4] In symbols

\( \frac{\left|\tilde{x} - \bar{x}\right|}{\sigma} \le (3/5)^{1/2} \)

where || is the absolute value.

A similar relation holds between the mode and the median. In this case the mode and the median lie within 31/2 of each other.

\( \frac{\left|\tilde{x} - \mathrm{mode}\right|}{\sigma} \le 3^{1/2} \)

An inequality relating means and medians

If the distribution has finite variance, then the distance between the median and the mean is bounded by one standard deviation.

This bound was proved by Mallows,[5] who used Jensen's inequality twice, as follows. We have

\( \begin{align} \left| \mu-m\right| = \left|\mathrm{E}(X-m)\right| & \leq \mathrm{E}\left(\left|X-m\right|\right) \\ & \leq \mathrm{E}\left(\left|X-\mu\right|\right) \\ & \leq \sqrt{\mathrm{E}((X-\mu)^2)} = \sigma. \end{align} \)

The first and third inequalities come from Jensen's inequality applied to the absolute-value function and the square function, which are each convex. The second inequality comes from the fact that a median minimizes the absolute deviation function

a \mapsto \mathrm{E}(\left|X-a\right|).\, \)

This proof can easily be generalized to obtain a multivariate version of the inequality[citation needed], as follows:

\( \left\|\mu-m\right\| = \left\| \mathrm{E} (X-m) \right\| \leq \mathrm{E} \|X-m\| \leq \mathrm{E} (\left\| X-\mu \right\| ) \leq \sqrt{ \mathrm{E} ( \| X-\mu \|^2 ) } = \sqrt{ \mathrm{trace} (\mathrm{var} (X) ) } \)

where m is a spatial median, that is, a minimizer of the function \( a \mapsto \mathrm{E}(\left\|X-a\right\|).\, \) The spatial median is unique when the data-set's dimension is two or more.[6][7] An alternative proof uses the one-sided Chebyshev inequality; it appears in an inequality on location and scale parameters.

Medians for samples

The sample median

Efficient computation of the sample median

Even though sorting n items requires O(n log n) operations, selection algorithms can compute the kth-smallest of n items (e.g., the median) with only O(n) operations.[8][citation needed]

Easy explanation of the sample median

In individual series (if number of observation is very low) first one must arrange all the observations in ascending order. Then count(n) total number of observation in given data.

If n is odd then Median (M) = value of ((n + 1)/2)th item term.

If n is even then Median (M) = value of [((n)/2)th item term + ((n)/2 + 1)th item term ]/2

For an odd number of values

As an example, we will calculate the sample median for the following set of observations: 1, 5, 2, 8, 7.

Start by sorting the values: 1, 2, 5, 7, 8.

In this case, the median is 5 since it is the middle observation in the ordered list.

The median is the ((n + 1)/2)th item, where n is the number of values. For example, for the list {1, 2, 5, 7, 8}, we have n = 5, so the median is the ((5 + 1)/2)th item.

median = (6/2)th item

median = 3rd item

median = 5

For an even number of values

As an example, we will calculate the sample median for the following set of observations: 1, 6, 2, 8, 7, 2.

Start by sorting the values: 1, 2, 2, 6, 7, 8.

In this case, the arithmetic mean of the two middlemost terms is (2 + 6)/2 = 4. Therefore, the median is 4 since it is the arithmetic mean of the middle observations in the ordered list.

We also use this formula MEDIAN = {(n + 1 )/2}th item . n = number of values

As above example 1, 2, 2, 6, 7, 8 n = 6 Median = {(6 + 1)/2}th item = 3.5th item. In this case, the median is average of the 3rd number and the next one (the fourth number). The median is (2 + 6)/2 which is 4.

Variance

The distribution of the sample median from a population with a density function ƒ(x) is asymptotically normal with mean m and variance \( \frac{1}{4nf(m)^2}[9] \) where m is the median value of distribution and n is the sample size.

The efficiency of the sample median, measured as the ratio of the variance of the mean to the variance of the median, depends on the sample size and on the underlying population distribution. For a sample of size N = 2n + 1 from the normal distribution, the ratio is

\( \frac{4n}{\pi (2n + 1)}. \)

For large samples (as n tends to infinity) this ratio tends to \( \frac{2}{\pi} . \)

Other estimators

For univariate distributions that are symmetric about one median, the Hodges–Lehmann estimator is a robust and highly efficient estimator of the population median.[10]

If data are represented by a statistical model specifying a particular family of probability distributions, then estimates of the median can be obtained by fitting that family of probability distributions to the data and calculating the theoretical median of the fitted distribution.[citation needed] Pareto interpolation is an applicaton of this when the population is assumed to have a Pareto distribution.

Multivariate median

Previously, this article discussed the concept of a univariate median for a one-dimensional object (population, sample). When the dimension is two or higher, there are multiple concepts that extend the definition of the univariate median; each such multivariate median agrees with the univariate median when the dimension is exactly one. In higher dimensions, however, there are several multivariate medians.[10]

Marginal median

The marginal median is defined for vectors defined with respect to a fixed set of coordinates. A marginal median is defined to be the vector whose components are univariate medians. The marginal median is easy to compute, and its properties were studied by Puri and Sen.[10][11]

Spatial median (L1 median)

In a normed vector space of dimension two or greater, the "spatial median" minimizes the expected distance

\( a \mapsto \mathrm{E}(\left\|X-a\right\|), \, \)

where X and a are vectors, if this expectation has a finite minimum; another definition is better suited for general probability-distributions.[10][6] The spatial median is unique when the data-set's dimension is two or more.[10][6][7] It is a robust and highly efficient estimator of the population spatial-median (also called the "L1 median")[12].[10]

Other multivariate medians

An alternative to the spatial median is defined in a similar way, but based on a different loss function, and is called the Geometric median.[citation needed] The centerpoint is another generalization to higher dimensions that does not relate to a particular metric.

Other median-related concepts

Pseudo-median

For univariate distributions that are symmetric about one median, the Hodges–Lehmann estimator is a robust and highly efficient estimator of the population median; for non-symmetric distributions, the Hodges–Lehmann estimator is a robust and highly efficient estimator of the population pseudo-median, which is the median of a symmetrized distribution and which is close to the population median.[citation needed] The Hodges–Lehmann estimator has been generalized to multivariate distributions.[13]

Variants of regression

The Theil–Sen estimator is a method for robust linear regression based on finding medians of slopes.

Median filter

Main article: Median filter

In the context of image processing of monochrome raster images there is a type of noise, known as the salt and pepper noise, when each pixel independently becomes black (with some small probability) or white (with some small probability), and is unchanged otherwise (with the probability close to 1). An image constructed of median values of neighborhoods (like 3×3 square) can effectively reduce noise in this case.

Cluster analysis

Main article: k-medians clustering

In cluster analysis, the k-medians clustering algorithm provides a way of defining clusters, in which the criterion of maximising the distance between cluster-means that is used in k-means clustering, is replaced by maximising the distance between cluster-medians.

Median-unbiased estimators

Any mean-unbiased estimator minimizes the risk (expected loss) with respect to the squared-error loss function, as observed by Gauss. A median-unbiased estimator minimizes the risk with respect to the absolute-deviation loss function, as observed by Laplace. Other loss functions are used in statistical theory, particularly in robust statistics.

The theory of median-unbiased estimators was revived by George W. Brown in 1947:[14]

An estimate of a one-dimensional parameter θ will be said to be median-unbiased, if, for fixed θ, the median of the distribution of the estimate is at the value θ; i.e., the estimate underestimates just as often as it overestimates. This requirement seems for most purposes to accomplish as much as the mean-unbiased requirement and has the additional property that it is invariant under one-to-one transformation. [page 584]

Further properties of median-unbiased estimators have been reported.[15][16][17][18] In particular, median-unbiased estimators exist in cases where mean-unbiased and maximum-likelihood estimators do not exist. Median-unbiased estimators are invariant under one-to-one transformations.

History

Gustav Fechner popularized the median into the formal analysis of data, although it had been used previously by Laplace.[19]

See also

Portal icon Statistics portal

A median is the 2nd quartile, 5th decile, and 50th percentile

A sample-median is median-unbiased but can be a mean-biased estimator

Absolute deviation

Concentration of measure for Lipschitz functions

Median voter theory

Median graph

Median search

References

^ a b Weisstein, Eric W., "Statistical Median" from MathWorld.

^ http://www.stat.psu.edu/old_resources/ClassNotes/ljs_07/sld008.htm Simon, Laura J.; "Descriptive statistics", Statistical Education Resource Kit, Pennsylvania State Department of Statistics

^ Stroock, Daniel (2011). Probability Theory. Cambridge University Press. pp. 43. ISBN 978-0-521-13250-3.

^ http://www.btinternet.com/~se16/hgb/cheb2.htm#3unimodalinequalities

^ Mallows, Colin (August 1991). "Another comment on O'Cinneide". The American Statistician 45 (3): 257.

^ a b c Kemperman, Johannes H. B. (1987). "The median of a finite measure on a Banach space". In Dodge, Yadolah. Statistical data analysis based on the L1-norm and related methods: Papers from the First International Conference held at Neuchâtel, August 31–September 4, 1987. Amsterdam: North-Holland Publishing Co.. pp. 217–230. MR 949228.

^ a b Milasevic, Philip; Ducharme, Gilles R. (1987). "Uniqueness of the spatial median". Annals of Statistics 15 (3): 1332–1333. MR 902264.

^ "When I was working on the MEDIAN problem, my goal was to prove that any deterministic algorithm to find the MEDIAN of n integers must necessarily make roughly as many comparisons as it takes to sort n integers, i.e., n log n comparisons. I was shocked to discover that the median of n integers can be found with just O(n) comparisons." – Manuel Blum, "Advice to a Beginning Graduate Student"

^ Rider, Paul R. (1960) "Variance of the median of small samples from several special populations". Journal of the American Statistical Association, 55 (289) 148–150

^ a b c d e f Hettmansperger, Thomas P.; McKean, Joseph W. (1998). Robust nonparametric statistical methods. Kendall's Library of Statistics. 5 (First ed., rather than Taylor and Francis (2010) second ed.). London: Edward Arnold. pp. xiv+467. ISBN 0-340-54937-8, 0-471-19479-4. MR 1604954.

^ Puri, Madan L.; Sen, Pranab K.; Nonparametric Methods in Multivariate Analysis, John Wiley & Sons, New York, NY, 197l. (Reprinted by Krieger Publishing)

^ Vardi, Yehuda; and Zhang, Cun-Hui; The multivariate l1-median and associated data depth, in Proceedings of the National Academy of Sciences, 97 (2000), no. 4, 1423–1426

^ Oja, Hannu (2010). Multivariate nonparametric methods with R: An approach based on spatial signs and ranks. Lecture Notes in Statistics. 199. New York, NY: Springer. pp. xiv+232. doi:10.1007/978-1-4419-0468-3. ISBN 978-1-4419-0467-6. MR 2598854.

^ Brown, George W. (1947) "On Small-Sample Estimation." The Annals of Mathematical Statistics, 18 (4),582–585

^ Lehmann, Erich L. (1951) "A General Concept of Unbiasedness" The Annals of Mathematical Statistics, 22 (4), 587–592.

^ Birnbaum, Allan (1961) "A Unified Theory of Estimation, I", The Annals of Mathematical Statistics, 32 (1), 112–135

^ van der Vaart, H. Robert (1961) "Some Extensions of the Idea of Bias", The Annals of Mathematical Statistics, 32 (2), 436–447.

^ Pfanzagl, Johann; with the assistance of R. Hamböker (1994). Parametric Statistical Theory. Walter de Gruyter. ISBN 3-11-013863-8. MR 1291393.

^ Keynes, John Maynard; A Treatise on Probability (1921), Pt. II, Ch. XVII, §5 (p 201)

External links

A Guide to Understanding & Calculating the Median

Median as a weighted arithmetic mean of all Sample Observations

On-line calculator

Calculating the median

A problem involving the mean, the median, and the mode.

Weisstein, Eric W., "Statistical Median" from MathWorld.

Python script for Median computations and income inequality metrics

This article incorporates material from Median of a distribution on PlanetMath, which is licensed under the Creative Commons Attribution/Share-Alike License.

Retrieved from "http://en.wikipedia.org/"

All text is available under the terms of the GNU Free Documentation License