HOME

TheInfoList



OR:

The median of a set of numbers is the value separating the higher half from the lower half of a data sample, a
population Population is a set of humans or other organisms in a given region or area. Governments conduct a census to quantify the resident population size within a given jurisdiction. The term is also applied to non-human animals, microorganisms, and pl ...
, or a
probability distribution In probability theory and statistics, a probability distribution is a Function (mathematics), function that gives the probabilities of occurrence of possible events for an Experiment (probability theory), experiment. It is a mathematical descri ...
. For a
data set A data set (or dataset) is a collection of data. In the case of tabular data, a data set corresponds to one or more table (database), database tables, where every column (database), column of a table represents a particular Variable (computer sci ...
, it may be thought of as the “middle" value. The basic feature of the median in describing data compared to the
mean A mean is a quantity representing the "center" of a collection of numbers and is intermediate to the extreme values of the set of numbers. There are several kinds of means (or "measures of central tendency") in mathematics, especially in statist ...
(often simply described as the "average") is that it is not
skewed In probability theory and statistics, skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The skewness value can be positive, zero, negative, or undefined. For a unimodal ...
by a small proportion of extremely large or small values, and therefore provides a better representation of the center.
Median income The median income is the income amount that divides a population into two groups, half having an income above that amount, and half having an income below that amount. It may differ from the mean (or average) income. Both of these are ways of unde ...
, for example, may be a better way to describe the center of the income distribution because increases in the largest incomes alone have no effect on the median. For this reason, the median is of central importance in
robust statistics Robust statistics are statistics that maintain their properties even if the underlying distributional assumptions are incorrect. Robust Statistics, statistical methods have been developed for many common problems, such as estimating location parame ...
. Median is a 2-
quantile In statistics and probability, quantiles are cut points dividing the range of a probability distribution into continuous intervals with equal probabilities or dividing the observations in a sample in the same way. There is one fewer quantile t ...
; it is the value that partitions a set into two equal parts.


Finite set of numbers

The median of a finite list of numbers is the "middle" number, when those numbers are listed in order from smallest to greatest. If the data set has an odd number of observations, the middle one is selected (after arranging in ascending order). For example, the following list of seven numbers, has the median of ''6'', which is the fourth value. If the data set has an even number of observations, there is no distinct middle value and the median is usually defined to be the
arithmetic mean In mathematics and statistics, the arithmetic mean ( ), arithmetic average, or just the ''mean'' or ''average'' is the sum of a collection of numbers divided by the count of numbers in the collection. The collection is often a set of results fr ...
of the two middle values. For example, this data set of 8 numbers has a median value of ''4.5'', that is (4 + 5)/2. (In more technical terms, this interprets the median as the fully trimmed
mid-range In statistics, the mid-range or mid-extreme is a measure of central tendency of a sample defined as the arithmetic mean of the maximum and minimum values of the data set: :M=\frac. The mid-range is closely related to the range, a measure of ...
). In general, with this convention, the median can be defined as follows: For a data set x of n elements, ordered from smallest to greatest,


Definition and notation

Formally, a median of a
population Population is a set of humans or other organisms in a given region or area. Governments conduct a census to quantify the resident population size within a given jurisdiction. The term is also applied to non-human animals, microorganisms, and pl ...
is any value such that at least half of the population is less than or equal to the proposed median and at least half is greater than or equal to the proposed median. As seen above, medians may not be unique. If each set contains more than half the population, then some of the population is exactly equal to the unique median. The median is well-defined for any ordered (one-dimensional) data and is independent of any distance metric. The median can thus be applied to school classes which are ranked but not numerical (e.g. working out a median grade when student test scores are graded from F to A), although the result might be halfway between classes if there is an even number of classes. (For odd number classes, one specific class is determined as the median.) A
geometric median In geometry, the geometric median of a discrete point set in a Euclidean space is the point minimizing the sum of distances to the sample points. This generalizes the median, which has the property of minimizing the sum of distances or absolute ...
, on the other hand, is defined in any number of dimensions. A related concept, in which the outcome is forced to correspond to a member of the sample, is the medoid. There is no widely accepted standard notation for the median, but some authors represent the median of a variable ''x'' as med(''x''), ''x͂'', as ''μ''1/2, or as ''M''. In any of these cases, the use of these or other symbols for the median needs to be explicitly defined when they are introduced. The median is a special case of other ways of summarizing the typical values associated with a statistical distribution: it is the 2nd
quartile In statistics, quartiles are a type of quantiles which divide the number of data points into four parts, or ''quarters'', of more-or-less equal size. The data must be ordered from smallest to largest to compute quartiles; as such, quartiles are ...
, 5th decile, and 50th
percentile In statistics, a ''k''-th percentile, also known as percentile score or centile, is a score (e.g., a data point) a given percentage ''k'' of all scores in its frequency distribution exists ("exclusive" definition) or a score a given percentage ...
.


Uses

The median can be used as a measure of
location In geography, location or place is used to denote a region (point, line, or area) on Earth's surface. The term ''location'' generally implies a higher degree of certainty than ''place'', the latter often indicating an entity with an ambiguous bou ...
when one attaches reduced importance to extreme values, typically because a distribution is
skewed In probability theory and statistics, skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The skewness value can be positive, zero, negative, or undefined. For a unimodal ...
, extreme values are not known, or
outlier In statistics, an outlier is a data point that differs significantly from other observations. An outlier may be due to a variability in the measurement, an indication of novel data, or it may be the result of experimental error; the latter are ...
s are untrustworthy, i.e., may be measurement or transcription errors. For example, consider the
multiset In mathematics, a multiset (or bag, or mset) is a modification of the concept of a set that, unlike a set, allows for multiple instances for each of its elements. The number of instances given for each element is called the ''multiplicity'' of ...
The median is 2 in this case, as is the mode, and it might be seen as a better indication of the center than the
arithmetic mean In mathematics and statistics, the arithmetic mean ( ), arithmetic average, or just the ''mean'' or ''average'' is the sum of a collection of numbers divided by the count of numbers in the collection. The collection is often a set of results fr ...
of 4, which is larger than all but one of the values. However, the widely cited empirical relationship that the mean is shifted "further into the tail" of a distribution than the median is not generally true. At most, one can say that the two statistics cannot be "too far" apart; see below. As a median is based on the middle data in a set, it is not necessary to know the value of extreme results in order to calculate it. For example, in a psychology test investigating the time needed to solve a problem, if a small number of people failed to solve the problem at all in the given time a median can still be calculated. Because the median is simple to understand and easy to calculate, while also a robust approximation to the
mean A mean is a quantity representing the "center" of a collection of numbers and is intermediate to the extreme values of the set of numbers. There are several kinds of means (or "measures of central tendency") in mathematics, especially in statist ...
, the median is a popular summary statistic in
descriptive statistics A descriptive statistic (in the count noun sense) is a summary statistic that quantitatively describes or summarizes features from a collection of information, while descriptive statistics (in the mass noun sense) is the process of using and an ...
. In this context, there are several choices for a measure of variability: the range, the
interquartile range In descriptive statistics, the interquartile range (IQR) is a measure of statistical dispersion, which is the spread of the data. The IQR may also be called the midspread, middle 50%, fourth spread, or H‑spread. It is defined as the differen ...
, the mean absolute deviation, and the median absolute deviation. 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 Efficiency is the often measurable ability to avoid making mistakes or wasting materials, energy, efforts, money, and time while performing a task. In a more general sense, it is the ability to do things well, successfully, and without waste. ...
of candidate estimators shows that the sample mean is more statistically efficient when—and only when— data is uncontaminated by data from heavy-tailed distributions or from mixtures of distributions. Even then, the median has a 64% efficiency compared to the minimum-variance mean (for large normal samples), which is to say the variance of the median will be ~50% greater than the variance of the mean.


Probability distributions

For any real-valued
probability distribution In probability theory and statistics, a probability distribution is a Function (mathematics), function that gives the probabilities of occurrence of possible events for an Experiment (probability theory), experiment. It is a mathematical descri ...
with
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Ever ...
 ''F'', a median is defined as any real number ''m'' that satisfies the inequalities \lim_ F(x) \leq \frac \leq F(m) (cf. the
drawing Drawing is a Visual arts, visual art that uses an instrument to mark paper or another two-dimensional surface, or a digital representation of such. Traditionally, the instruments used to make a drawing include pencils, crayons, and ink pens, some ...
in the definition of expected value for arbitrary real-valued random variables). An equivalent phrasing uses a random variable ''X'' distributed according to ''F'': \operatorname(X\leq m) \geq \frac\text \operatorname(X\geq m) \geq \frac\,. Note that this definition does not require ''X'' to have an absolutely continuous distribution (which has a
probability density function In probability theory, a probability density function (PDF), density function, or density of an absolutely continuous random variable, is a Function (mathematics), function whose value at any given sample (or point) in the sample space (the s ...
''f''), nor does it require a discrete one. In the former case, the inequalities can be upgraded to equality: a median satisfies \operatorname(X \leq m) = \int_^m = \frac and \operatorname(X \geq m) = \int_m^ = \frac\,. Any
probability distribution In probability theory and statistics, a probability distribution is a Function (mathematics), function that gives the probabilities of occurrence of possible events for an Experiment (probability theory), experiment. It is a mathematical descri ...
on the real number set \R has at least one median, but in pathological cases there may be more than one median: if ''F'' is constant 1/2 on an interval (so that ''f'' = 0 there), then any value of that interval is a median.


Medians of particular distributions

The medians of certain types of distributions can be easily calculated from their parameters; furthermore, they exist even for some distributions lacking a well-defined mean, such as the
Cauchy distribution The Cauchy distribution, named after Augustin-Louis Cauchy, is a continuous probability distribution. It is also known, especially among physicists, as the Lorentz distribution (after Hendrik Lorentz), Cauchy–Lorentz distribution, Lorentz(ian) ...
: * The median of a symmetric
unimodal distribution In mathematics, unimodality means possessing a unique mode (statistics), mode. More generally, unimodality means there is only a single highest value, somehow defined, of some mathematical object. Unimodal probability distribution In statis ...
coincides with the mode. * The median of a
symmetric distribution In statistics, a symmetric probability distribution is a probability distribution—an assignment of probabilities to possible occurrences—which is unchanged when its probability density function (for continuous probability distribution) or pro ...
which possesses a mean ''μ'' also takes the value ''μ''. ** The median of a
normal distribution In probability theory and statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is f(x) = \frac ...
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 The Cauchy distribution, named after Augustin-Louis Cauchy, is a continuous probability distribution. It is also known, especially among physicists, as the Lorentz distribution (after Hendrik Lorentz), Cauchy–Lorentz distribution, Lorentz(ian) ...
with location parameter ''x''0 and scale parameter ''y'' is ''x''0, the location parameter. * The median of a power law distribution ''x''−''a'', with exponent ''a'' > 1 is 21/(''a'' − 1)''x''min, where ''x''min is the minimum value for which the power law holds * The median of an
exponential distribution In probability theory and statistics, the exponential distribution or negative exponential distribution is the probability distribution of the distance between events in a Poisson point process, i.e., a process in which events occur continuousl ...
with rate parameter ''λ'' is the
natural logarithm The natural logarithm of a number is its logarithm to the base of a logarithm, base of the e (mathematical constant), mathematical constant , which is an Irrational number, irrational and Transcendental number, transcendental number approxima ...
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''.


Properties


Optimality property

The '' mean absolute error'' of a real variable ''c'' with respect to the
random variable A random variable (also called random quantity, aleatory variable, or stochastic variable) is a Mathematics, mathematical formalization of a quantity or object which depends on randomness, random events. The term 'random variable' in its mathema ...
 ''X'' is \operatorname\left X-c\\right/math> 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''. In particular, if ''m'' is a sample median, then it minimizes the arithmetic mean of the absolute deviations. Note, however, that in cases where the sample contains an even number of elements, this minimizer is not unique. More generally, a median is defined as a minimum of \operatorname\left X - c\ - \left, X\\right as discussed below in the section on multivariate medians (specifically, the spatial median). This optimization-based definition of the median is useful in statistical data-analysis, for example, in ''k''-medians clustering.


Inequality relating means and medians

If the distribution has finite variance, then the distance between the median \tilde and the mean \bar is bounded by one
standard deviation In statistics, the standard deviation is a measure of the amount of variation of the values of a variable about its Expected value, mean. A low standard Deviation (statistics), deviation indicates that the values tend to be close to the mean ( ...
. This bound was proved by Book and Sher in 1979 for discrete samples, and more generally by Page and Murty in 1982. In a comment on a subsequent proof by O'Cinneide, Mallows in 1991 presented a compact proof that uses Jensen's inequality twice, as follows. Using , ·, for the
absolute value In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if x is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), ...
, we have \begin \left, \mu - m\ = \left, \operatorname(X - m)\ & \leq \operatorname\left(\left, X - m \\right) \\ ex & \leq \operatorname\left(\left, X - \mu\\right) \\ ex & \leq \sqrt = \sigma. \end 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 \operatorname norm (mathematics), norm: \left\, \mu - m\right\, \leq \sqrt = \sqrt where ''m'' is a spatial median, that is, a minimizer of the function a \mapsto \operatorname(\, X-a\, ).\, The spatial median is unique when the data-set's dimension is two or more. An alternative proof uses the one-sided Chebyshev inequality; it appears in an inequality on location and scale parameters. This formula also follows directly from Cantelli's inequality.


Unimodal distributions

For the case of unimodal distributions, one can achieve a sharper bound on the distance between the median and the mean: \left, \tilde - \bar\ \le \left(\frac\right)^ \sigma \approx 0.7746\sigma. A similar relation holds between the median and the mode: \left, \tilde - \mathrm\ \le 3^ \sigma \approx 1.732\sigma.


Mean, median, and skew

A typical heuristic is that positively skewed distributions have mean > median. This is true for all members of the Pearson distribution family. However this is not always true. For example, the Weibull distribution family has members with positive mean, but mean < median. Violations of the rule are particularly common for discrete distributions. For example, any Poisson distribution has positive skew, but its mean < median whenever \mu \bmod 1>\ln 2. See for a proof sketch. When the distribution has a monotonically decreasing probability density, then the median is less than the mean, as shown in the figure.


Jensen's inequality for medians

Jensen's inequality states that for any random variable ''X'' with a finite expectation ''E'' 'X''and for any convex function ''f'' f(\operatorname(x)) \le \operatorname( f(x) ) This inequality generalizes to the median as well. We say a function is a C function if, for any ''t'', f^\left( \,(-\infty, t]\, \right) = \ is a
closed interval In mathematics, a real interval is the set of all real numbers lying between two fixed endpoints with no "gaps". Each endpoint is either a real number or positive or negative infinity, indicating the interval extends without a bound. A real in ...
(allowing the degenerate cases of a single point or an
empty set In mathematics, the empty set or void set is the unique Set (mathematics), set having no Element (mathematics), elements; its size or cardinality (count of elements in a set) is 0, zero. Some axiomatic set theories ensure that the empty set exi ...
). Every convex function is a C function, but the reverse does not hold. If ''f'' is a C function, then f(\operatorname \le \operatorname f(X) If the medians are not unique, the statement holds for the corresponding suprema.


Medians for samples


Efficient computation of the sample median

Even though comparison-sorting ''n'' items requires operations, selection algorithms can compute the th-smallest of items with only operations. This includes the median, which is the th order statistic (or for an even number of samples, the
arithmetic mean In mathematics and statistics, the arithmetic mean ( ), arithmetic average, or just the ''mean'' or ''average'' is the sum of a collection of numbers divided by the count of numbers in the collection. The collection is often a set of results fr ...
of the two middle order statistics). Selection algorithms still have the downside of requiring memory, that is, they need to have the full sample (or a linear-sized portion of it) in memory. Because this, as well as the linear time requirement, can be prohibitive, several estimation procedures for the median have been developed. A simple one is the median of three rule, which estimates the median as the median of a three-element subsample; this is commonly used as a subroutine in the
quicksort Quicksort is an efficient, general-purpose sorting algorithm. Quicksort was developed by British computer scientist Tony Hoare in 1959 and published in 1961. It is still a commonly used algorithm for sorting. Overall, it is slightly faster than ...
sorting algorithm, which uses an estimate of its input's median. A more robust estimator is Tukey's ''ninther'', which is the median of three rule applied with limited recursion: if is the sample laid out as an array, and then The ''remedian'' is an estimator for the median that requires linear time but sub-linear memory, operating in a single pass over the sample.


Sampling distribution

The distributions of both the sample mean and the sample median were determined by
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
. The distribution of the sample median from a population with a density function f(x) is asymptotically normal with mean \mu and variance \frac where m is the median of f(x) and n is the sample size: \text \sim \mathcal A modern proof follows below. Laplace's result is now understood as a special case of the asymptotic distribution of arbitrary quantiles. For normal samples, the density is f(m) = 1 / \sqrt, thus for large samples the variance of the median equals (/) \cdot(\sigma^2/n). (See also section #Efficiency below.)


Derivation of the asymptotic distribution

We take the sample size to be an odd number N = 2n + 1 and assume our variable continuous; the formula for the case of discrete variables is given below in . The sample can be summarized as "below median", "at median", and "above median", which corresponds to a trinomial distribution with probabilities F(v) , f(v) and 1 - F(v) . For a continuous variable, the probability of multiple sample values being exactly equal to the median is 0, so one can calculate the density of at the point v directly from the trinomial distribution: \Pr operatorname=v\, dv = \frac F(v)^n (1 - F(v))^n f(v)\, dv. Now we introduce the beta function. For integer arguments \alpha and \beta , this can be expressed as \Beta(\alpha,\beta) = \frac . Also, recall that f(v)\,dv = dF(v) . Using these relationships and setting both \alpha and \beta equal to n+1 allows the last expression to be written as \frac \, dF(v) Hence the density function of the median is a symmetric beta distribution pushed forward by F. Its mean, as we would expect, is 0.5 and its variance is 1/(4(N+2)) . By the
chain rule In calculus, the chain rule is a formula that expresses the derivative of the Function composition, composition of two differentiable functions and in terms of the derivatives of and . More precisely, if h=f\circ g is the function such that h ...
, the corresponding variance of the sample median is \frac. The additional 2 is negligible in the limit.


=Empirical local density

= In practice, the functions f and F above are often not known or assumed. However, they can be estimated from an observed frequency distribution. In this section, we give an example. Consider the following table, representing a sample of 3,800 (discrete-valued) observations: Because the observations are discrete-valued, constructing the exact distribution of the median is not an immediate translation of the above expression for \Pr(\operatorname = v) ; one may (and typically does) have multiple instances of the median in one's sample. So we must sum over all these possibilities: \Pr(\operatorname = v) = \sum_^n \sum_^n \frac F(v-1)^i(1 - F(v))^kf(v)^ Here, ''i'' is the number of points strictly less than the median and ''k'' the number strictly greater. Using these preliminaries, it is possible to investigate the effect of sample size on the standard errors of the mean and median. The observed mean is 3.16, the observed raw median is 3 and the observed interpolated median is 3.174. The following table gives some comparison statistics. The expected value of the median falls slightly as sample size increases while, as would be expected, the standard errors of both the median and the mean are proportionate to the inverse square root of the sample size. The asymptotic approximation errs on the side of caution by overestimating the standard error.


Estimation of variance from sample data

The value of (2 f(x))^—the asymptotic value of n^ (\nu - m) where \nu is the population median—has been studied by several authors. The standard "delete one" jackknife method produces
inconsistent In deductive logic, a consistent theory is one that does not lead to a logical contradiction. A theory T is consistent if there is no formula \varphi such that both \varphi and its negation \lnot\varphi are elements of the set of consequences o ...
results. An alternative—the "delete k" method—where k grows with the sample size has been shown to be asymptotically consistent. This method may be computationally expensive for large data sets. A bootstrap estimate is known to be consistent, but converges very slowly ( order of n^). Other methods have been proposed but their behavior may differ between large and small samples.


Efficiency

The
efficiency Efficiency is the often measurable ability to avoid making mistakes or wasting materials, energy, efforts, money, and time while performing a task. In a more general sense, it is the ability to do things well, successfully, and without waste. ...
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 In probability theory and statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is f(x) = \frac ...
, the efficiency for large N is \frac \frac The efficiency tends to \frac as N tends to infinity. In other words, the relative variance of the median will be \pi/2 \approx 1.57, or 57% greater than the variance of the mean – the relative standard error of the median will be (\pi/2)^\frac \approx 1.25, or 25% greater than the standard error of the mean, \sigma/\sqrt (see also section #Sampling distribution above.).


Other estimators

For univariate distributions that are ''symmetric'' about one median, the
Hodges–Lehmann estimator In statistics, the Hodges–Lehmann estimator is a robust and nonparametric estimator of a population's location parameter. For populations that are symmetric about one median, such as the Gaussian or normal distribution or the Student ''t''-di ...
is a robust and highly efficient estimator of the population median. If data is represented by a
statistical model A statistical model is a mathematical model that embodies a set of statistical assumptions concerning the generation of Sample (statistics), sample data (and similar data from a larger Statistical population, population). A statistical model repre ...
specifying a particular family of
probability distribution In probability theory and statistics, a probability distribution is a Function (mathematics), function that gives the probabilities of occurrence of possible events for an Experiment (probability theory), experiment. It is a mathematical descri ...
s, 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.
Pareto interpolation Pareto interpolation is a method of estimator, estimating the median and other properties of a population that follows a Pareto distribution. It is used in economics when analysing the distribution of incomes in a population, when one must base es ...
is an application of this when the population is assumed to have a
Pareto distribution The Pareto distribution, named after the Italian civil engineer, economist, and sociologist Vilfredo Pareto, is a power-law probability distribution that is used in description of social, quality control, scientific, geophysical, actuarial scien ...
.


Multivariate median

Previously, this article discussed the univariate median, when the sample or population had one-dimension. 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.


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.


Geometric median

The
geometric median In geometry, the geometric median of a discrete point set in a Euclidean space is the point minimizing the sum of distances to the sample points. This generalizes the median, which has the property of minimizing the sum of distances or absolute ...
of a discrete set of sample points x_1,\ldots x_N in a Euclidean space is the point minimizing the sum of distances to the sample points. \hat\mu = \underset \sum_^ \left \, \mu-x_n \right \, _2 In contrast to the marginal median, the geometric median is equivariant with respect to Euclidean similarity transformations such as translations and rotations.


Median in all directions

If the marginal medians for all coordinate systems coincide, then their common location may be termed the "median in all directions". This concept is relevant to voting theory on account of the
median voter theorem In political science and social choice theory, social choice, Black's median voter theorem says that if voters and candidates are distributed along a political spectrum, any voting method Condorcet criterion, compatible with majority-rule will elec ...
. When it exists, the median in all directions coincides with the geometric median (at least for discrete distributions).


Centerpoint


Conditional median

The conditional median occurs in the setting where we seek to estimate a random variable X from a random variable Y , which is a noisy version of X . The conditional median in this setting is given by m(X, Y=y) = F^_ \left(\frac\right) where t \mapsto F^_(t) is the inverse of the conditional cdf (i.e., conditional quantile function) of x \mapsto F_(x, y). For example, a popular model is Y = X+Z where Z is standard normal independent of X. The conditional median is the optimal Bayesian L_1 estimator: m(X, Y=y) = \arg \min_f \operatorname \left X - f(Y) , \right/math> It is known that for the model Y = X+Z where Z is standard normal independent of X, the estimator is linear if and only if X is Gaussian.


Other median-related concepts


Interpolated median

When dealing with a discrete variable, it is sometimes useful to regard the observed values as being midpoints of underlying continuous intervals. An example of this is a
Likert scale A Likert scale ( ,) is a psychometric scale named after its inventor, American social psychologist Rensis Likert, which is commonly used in research questionnaires. It is the most widely used approach to scaling responses in survey research, s ...
, on which opinions or preferences are expressed on a scale with a set number of possible responses. If the scale consists of the positive integers, an observation of 3 might be regarded as representing the interval from 2.50 to 3.50. It is possible to estimate the median of the underlying variable. If, say, 22% of the observations are of value 2 or below and 55.0% are of 3 or below (so 33% have the value 3), then the median m is 3 since the median is the smallest value of x for which F(x) is greater than a half. But the interpolated median is somewhere between 2.50 and 3.50. First we add half of the interval width w to the median to get the upper bound of the median interval. Then we subtract that proportion of the interval width which equals the proportion of the 33% which lies above the 50% mark. In other words, we split up the interval width pro rata to the numbers of observations. In this case, the 33% is split into 28% below the median and 5% above it so we subtract 5/33 of the interval width from the upper bound of 3.50 to give an interpolated median of 3.35. More formally, if the values f(x) are known, the interpolated median can be calculated from m_\text = m + w\left frac - \frac\right Alternatively, if in an observed sample there are k scores above the median category, j scores in it and i scores below it then the interpolated median is given by m_\text = m + \frac \left frac j\right


Pseudo-median

For univariate distributions that are ''symmetric'' about one median, the
Hodges–Lehmann estimator In statistics, the Hodges–Lehmann estimator is a robust and nonparametric estimator of a population's location parameter. For populations that are symmetric about one median, such as the Gaussian or normal distribution or the Student ''t''-di ...
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. The Hodges–Lehmann estimator has been generalized to multivariate distributions.


Variants of regression

The Theil–Sen estimator is a method for robust
linear regression In statistics, linear regression is a statistical model, model that estimates the relationship between a Scalar (mathematics), scalar response (dependent variable) and one or more explanatory variables (regressor or independent variable). A mode ...
based on finding medians of
slope In mathematics, the slope or gradient of a Line (mathematics), line is a number that describes the direction (geometry), direction of the line on a plane (geometry), plane. Often denoted by the letter ''m'', slope is calculated as the ratio of t ...
s.


Median filter

The
median filter The median filter is a non-linear digital filtering technique, often used to remove signal noise, noise from an image, signal, and video. Such noise reduction is a typical pre-processing step to improve the results of later processing (for example ...
is an important tool of
image processing An image or picture is a visual representation. An image can be two-dimensional, such as a drawing, painting, or photograph, or three-dimensional, such as a carving or sculpture. Images may be displayed through other media, including a pr ...
, that can effectively remove any salt and pepper noise from
grayscale In digital photography, computer-generated imagery, and colorimetry, a greyscale (more common in Commonwealth English) or grayscale (more common in American English) image is one in which the value of each pixel is a single sample (signal), s ...
images.


Cluster analysis

In
cluster analysis Cluster analysis or clustering is the data analyzing technique in which task of grouping a set of objects in such a way that objects in the same group (called a cluster) are more Similarity measure, similar (in some specific sense defined by the ...
, the
k-medians clustering K-medians clustering is a partitioning technique used in cluster analysis. It groups data into ''k'' clusters by minimizing the sum of distances—typically using the Manhattan (L1) distance—between data points and the median of their assigned c ...
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 ''k''-means clustering is a method of vector quantization, originally from signal processing, that aims to partition of a set, partition ''n'' observations into ''k'' clusters in which each observation belongs to the cluster (statistics), cluste ...
, is replaced by maximising the distance between cluster-medians.


Median–median line

This is a method of robust regression. The idea dates back to Wald in 1940 who suggested dividing a set of bivariate data into two halves depending on the value of the independent parameter x: a left half with values less than the median and a right half with values greater than the median. He suggested taking the means of the dependent y and independent x variables of the left and the right halves and estimating the slope of the line joining these two points. The line could then be adjusted to fit the majority of the points in the data set. Nair and Shrivastava in 1942 suggested a similar idea but instead advocated dividing the sample into three equal parts before calculating the means of the subsamples. Brown and Mood in 1951 proposed the idea of using the medians of two subsamples rather the means. Tukey combined these ideas and recommended dividing the sample into three equal size subsamples and estimating the line based on the medians of the subsamples.


Median-unbiased estimators

Any ''mean''-unbiased estimator minimizes the
risk In simple terms, risk is the possibility of something bad happening. Risk involves uncertainty about the effects/implications of an activity with respect to something that humans value (such as health, well-being, wealth, property or the environ ...
( expected loss) with respect to the squared-error loss function, as observed by
Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, Geodesy, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observat ...
. A ''median''-unbiased estimator minimizes the risk with respect to the absolute-deviation loss function, as observed by
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
. Other
loss functions In mathematical optimization and decision theory, a loss function or cost function (sometimes also called an error function) is a function that maps an event or values of one or more variables onto a real number intuitively representing some "cost ...
are used in
statistical theory The theory of statistics provides a basis for the whole range of techniques, in both study design and data analysis, that are used within applications of statistics. The theory covers approaches to statistical-decision problems and to statistica ...
, particularly in
robust statistics Robust statistics are statistics that maintain their properties even if the underlying distributional assumptions are incorrect. Robust Statistics, statistical methods have been developed for many common problems, such as estimating location parame ...
. The theory of median-unbiased estimators was revived by George W. Brown in 1947: Further properties of median-unbiased estimators have been reported. There are methods of constructing median-unbiased estimators that are optimal (in a sense analogous to the minimum-variance property for mean-unbiased estimators). Such constructions exist for probability distributions having monotone likelihood-functions. One such procedure is an analogue of the Rao–Blackwell procedure for mean-unbiased estimators: The procedure holds for a smaller class of probability distributions than does the Rao—Blackwell procedure but for a larger class of loss functions.


History

Scientific researchers in the ancient near east appear not to have used summary statistics altogether, instead choosing values that offered maximal consistency with a broader theory that integrated a wide variety of phenomena. Within the Mediterranean (and, later, European) scholarly community, statistics like the mean are fundamentally a medieval and early modern development. (The history of the median outside Europe and its predecessors remains relatively unstudied.) The idea of the median appeared in the 6th century in the
Talmud The Talmud (; ) is the central text of Rabbinic Judaism and the primary source of Jewish religious law (''halakha'') and Jewish theology. Until the advent of Haskalah#Effects, modernity, in nearly all Jewish communities, the Talmud was the cen ...
, in order to fairly analyze divergent appraisals. However, the concept did not spread to the broader scientific community. Instead, the closest ancestor of the modern median is the
mid-range In statistics, the mid-range or mid-extreme is a measure of central tendency of a sample defined as the arithmetic mean of the maximum and minimum values of the data set: :M=\frac. The mid-range is closely related to the range, a measure of ...
, invented by
Al-Biruni Abu Rayhan Muhammad ibn Ahmad al-Biruni (; ; 973after 1050), known as al-Biruni, was a Khwarazmian Iranian scholar and polymath during the Islamic Golden Age. He has been called variously "Father of Comparative Religion", "Father of modern ...
Transmission of his work to later scholars is unclear. He applied his technique to
assay An assay is an investigative (analytic) procedure in laboratory medicine, mining, pharmacology, environmental biology and molecular biology for qualitatively assessing or quantitatively measuring the presence, amount, or functional activity ...
ing currency metals, but, after he published his work, most assayers still adopted the most unfavorable value from their results, lest they appear to cheat. However, increased navigation at sea during the
Age of Discovery The Age of Discovery (), also known as the Age of Exploration, was part of the early modern period and overlapped with the Age of Sail. It was a period from approximately the 15th to the 17th century, during which Seamanship, seafarers fro ...
meant that ship's navigators increasingly had to attempt to determine latitude in unfavorable weather against hostile shores, leading to renewed interest in summary statistics. Whether rediscovered or independently invented, the mid-range is recommended to nautical navigators in Harriot's "Instructions for Raleigh's Voyage to Guiana, 1595". The idea of the median may have first appeared in Edward Wright's 1599 book ''Certaine Errors in Navigation'' on a section about
compass A compass is a device that shows the cardinal directions used for navigation and geographic orientation. It commonly consists of a magnetized needle or other element, such as a compass card or compass rose, which can pivot to align itself with No ...
navigation. Wright was reluctant to discard measured values, and may have felt that the median — incorporating a greater proportion of the dataset than the
mid-range In statistics, the mid-range or mid-extreme is a measure of central tendency of a sample defined as the arithmetic mean of the maximum and minimum values of the data set: :M=\frac. The mid-range is closely related to the range, a measure of ...
— was more likely to be correct. However, Wright did not give examples of his technique's use, making it hard to verify that he described the modern notion of median. The median (in the context of probability) certainly appeared in the correspondence of
Christiaan Huygens Christiaan Huygens, Halen, Lord of Zeelhem, ( , ; ; also spelled Huyghens; ; 14 April 1629 – 8 July 1695) was a Dutch mathematician, physicist, engineer, astronomer, and inventor who is regarded as a key figure in the Scientific Revolution ...
, but as an example of a statistic that was inappropriate for actuarial practice. The earliest recommendation of the median dates to 1757, when Roger Joseph Boscovich developed a regression method based on the ''L''1 norm and therefore implicitly on the median. In 1774,
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
made this desire explicit: he suggested the median be used as the standard estimator of the value of a posterior
PDF Portable document format (PDF), standardized as ISO 32000, is a file format developed by Adobe Inc., Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, computer hardware, ...
. The specific criterion was to minimize the expected magnitude of the error; , \alpha - \alpha^, where \alpha^ is the estimate and \alpha is the true value. To this end, Laplace determined the distributions of both the sample mean and the sample median in the early 1800s.Laplace PS de (1818) ''Deuxième supplément à la Théorie Analytique des Probabilités'', Paris, Courcier However, a decade later,
Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, Geodesy, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observat ...
and Legendre developed the
least squares The method of least squares is a mathematical optimization technique that aims to determine the best fit function by minimizing the sum of the squares of the differences between the observed values and the predicted values of the model. The me ...
method, which minimizes (\alpha - \alpha^)^ to obtain the mean; the strong justification of this estimator by reference to
maximum likelihood estimation In statistics, maximum likelihood estimation (MLE) is a method of estimation theory, estimating the Statistical parameter, parameters of an assumed probability distribution, given some observed data. This is achieved by Mathematical optimization, ...
based on a
normal distribution In probability theory and statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is f(x) = \frac ...
means it has mostly replaced Laplace's original suggestion.
Antoine Augustin Cournot Antoine Augustin Cournot (; 28 August 180131 March 1877) was a French philosopher and mathematician who contributed to the development of economics. Biography Antoine Augustin Cournot was born on August 28, 1801 in Gray, Haute-Saône. He ent ...
in 1843 was the first to use the term ''median'' (''valeur médiane'') for the value that divides a probability distribution into two equal halves.
Gustav Theodor Fechner Gustav Theodor Fechner (; ; 19 April 1801 – 18 November 1887) was a German physicist, philosopher, and experimental psychologist. A pioneer in experimental psychology and founder of psychophysics (techniques for measuring the mind), he inspired ...
used the median (''Centralwerth'') in sociological and psychological phenomena.Keynes, J.M. (1921) '' A Treatise on Probability''. Pt II Ch XVII §5 (p 201) (2006 reprint, Cosimo Classics, : multiple other reprints) It had earlier been used only in astronomy and related fields.
Gustav Fechner Gustav Theodor Fechner (; ; 19 April 1801 – 18 November 1887) was a German physicist, philosopher, and experimental psychologist. A pioneer in experimental psychology and founder of psychophysics (techniques for measuring the mind), he inspi ...
popularized the median into the formal analysis of data, although it had been used previously by Laplace, and the median appeared in a textbook by F. Y. Edgeworth.
Francis Galton Sir Francis Galton (; 16 February 1822 – 17 January 1911) was an English polymath and the originator of eugenics during the Victorian era; his ideas later became the basis of behavioural genetics. Galton produced over 340 papers and b ...
used the term ''median'' in 1881,Galton F (1881) "Report of the Anthropometric Committee" pp 245–260
''Report of the 51st Meeting of the British Association for the Advancement of Science''
/ref> having earlier used the terms ''middle-most value'' in 1869, and the ''medium'' in 1880. ''personal.psu.edu''
/ref>


See also

* * * * for * * – Algorithm to calculate the approximate median in linear time * * * * s – Generalization of the median in higher dimensions * *


Notes


References


External links

*
Median as a weighted arithmetic mean of all Sample Observations

On-line calculator



A problem involving the mean, the median, and the mode.
*
Python script
for Median computations and
income inequality metrics Income inequality metrics or income distribution metrics are used by social scientists to measure the distribution of wealth, distribution of income and economic inequality among the participants in a particular economy, such as that of a specific ...

Fast Computation of the Median by Successive Binning

'Mean, median, mode and skewness'
A tutorial devised for first-year psychology students at Oxford University, based on a worked example.
The Complex SAT Math Problem Even the College Board Got Wrong
Andrew Daniels in ''
Popular Mechanics ''Popular Mechanics'' (often abbreviated as ''PM'' or ''PopMech'') is a magazine of popular science and technology, featuring automotive, home, outdoor, electronics, science, do it yourself, and technology topics. Military topics, aviation an ...
'' {{Statistics, descriptive Means Robust statistics>X-a, /math>. Mallows's proof can be generalized to obtain a multivariate version of the inequality simply by replacing the absolute value with a norm (mathematics), norm: \left\, \mu - m\right\, \leq \sqrt = \sqrt where ''m'' is a spatial median, that is, a minimizer of the function a \mapsto \operatorname(\, X-a\, ).\, The spatial median is unique when the data-set's dimension is two or more. An alternative proof uses the one-sided Chebyshev inequality; it appears in an inequality on location and scale parameters. This formula also follows directly from Cantelli's inequality.


Unimodal distributions

For the case of unimodal distributions, one can achieve a sharper bound on the distance between the median and the mean: \left, \tilde - \bar\ \le \left(\frac\right)^ \sigma \approx 0.7746\sigma. A similar relation holds between the median and the mode: \left, \tilde - \mathrm\ \le 3^ \sigma \approx 1.732\sigma.


Mean, median, and skew

A typical heuristic is that positively skewed distributions have mean > median. This is true for all members of the Pearson distribution family. However this is not always true. For example, the Weibull distribution family has members with positive mean, but mean < median. Violations of the rule are particularly common for discrete distributions. For example, any Poisson distribution has positive skew, but its mean < median whenever \mu \bmod 1>\ln 2. See for a proof sketch. When the distribution has a monotonically decreasing probability density, then the median is less than the mean, as shown in the figure.


Jensen's inequality for medians

Jensen's inequality states that for any random variable ''X'' with a finite expectation ''E'' 'X''and for any convex function ''f'' f(\operatorname(x)) \le \operatorname( f(x) ) This inequality generalizes to the median as well. We say a function is a C function if, for any ''t'', f^\left( \,(-\infty, t]\, \right) = \ is a
closed interval In mathematics, a real interval is the set of all real numbers lying between two fixed endpoints with no "gaps". Each endpoint is either a real number or positive or negative infinity, indicating the interval extends without a bound. A real in ...
(allowing the degenerate cases of a single point or an
empty set In mathematics, the empty set or void set is the unique Set (mathematics), set having no Element (mathematics), elements; its size or cardinality (count of elements in a set) is 0, zero. Some axiomatic set theories ensure that the empty set exi ...
). Every convex function is a C function, but the reverse does not hold. If ''f'' is a C function, then f(\operatorname \le \operatorname f(X) If the medians are not unique, the statement holds for the corresponding suprema.


Medians for samples


Efficient computation of the sample median

Even though comparison-sorting ''n'' items requires operations, selection algorithms can compute the th-smallest of items with only operations. This includes the median, which is the th order statistic (or for an even number of samples, the
arithmetic mean In mathematics and statistics, the arithmetic mean ( ), arithmetic average, or just the ''mean'' or ''average'' is the sum of a collection of numbers divided by the count of numbers in the collection. The collection is often a set of results fr ...
of the two middle order statistics). Selection algorithms still have the downside of requiring memory, that is, they need to have the full sample (or a linear-sized portion of it) in memory. Because this, as well as the linear time requirement, can be prohibitive, several estimation procedures for the median have been developed. A simple one is the median of three rule, which estimates the median as the median of a three-element subsample; this is commonly used as a subroutine in the
quicksort Quicksort is an efficient, general-purpose sorting algorithm. Quicksort was developed by British computer scientist Tony Hoare in 1959 and published in 1961. It is still a commonly used algorithm for sorting. Overall, it is slightly faster than ...
sorting algorithm, which uses an estimate of its input's median. A more robust estimator is Tukey's ''ninther'', which is the median of three rule applied with limited recursion: if is the sample laid out as an array, and then The ''remedian'' is an estimator for the median that requires linear time but sub-linear memory, operating in a single pass over the sample.


Sampling distribution

The distributions of both the sample mean and the sample median were determined by
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
. The distribution of the sample median from a population with a density function f(x) is asymptotically normal with mean \mu and variance \frac where m is the median of f(x) and n is the sample size: \text \sim \mathcal A modern proof follows below. Laplace's result is now understood as a special case of the asymptotic distribution of arbitrary quantiles. For normal samples, the density is f(m) = 1 / \sqrt, thus for large samples the variance of the median equals (/) \cdot(\sigma^2/n). (See also section #Efficiency below.)


Derivation of the asymptotic distribution

We take the sample size to be an odd number N = 2n + 1 and assume our variable continuous; the formula for the case of discrete variables is given below in . The sample can be summarized as "below median", "at median", and "above median", which corresponds to a trinomial distribution with probabilities F(v) , f(v) and 1 - F(v) . For a continuous variable, the probability of multiple sample values being exactly equal to the median is 0, so one can calculate the density of at the point v directly from the trinomial distribution: \Pr operatorname=v\, dv = \frac F(v)^n (1 - F(v))^n f(v)\, dv. Now we introduce the beta function. For integer arguments \alpha and \beta , this can be expressed as \Beta(\alpha,\beta) = \frac . Also, recall that f(v)\,dv = dF(v) . Using these relationships and setting both \alpha and \beta equal to n+1 allows the last expression to be written as \frac \, dF(v) Hence the density function of the median is a symmetric beta distribution pushed forward by F. Its mean, as we would expect, is 0.5 and its variance is 1/(4(N+2)) . By the
chain rule In calculus, the chain rule is a formula that expresses the derivative of the Function composition, composition of two differentiable functions and in terms of the derivatives of and . More precisely, if h=f\circ g is the function such that h ...
, the corresponding variance of the sample median is \frac. The additional 2 is negligible in the limit.


=Empirical local density

= In practice, the functions f and F above are often not known or assumed. However, they can be estimated from an observed frequency distribution. In this section, we give an example. Consider the following table, representing a sample of 3,800 (discrete-valued) observations: Because the observations are discrete-valued, constructing the exact distribution of the median is not an immediate translation of the above expression for \Pr(\operatorname = v) ; one may (and typically does) have multiple instances of the median in one's sample. So we must sum over all these possibilities: \Pr(\operatorname = v) = \sum_^n \sum_^n \frac F(v-1)^i(1 - F(v))^kf(v)^ Here, ''i'' is the number of points strictly less than the median and ''k'' the number strictly greater. Using these preliminaries, it is possible to investigate the effect of sample size on the standard errors of the mean and median. The observed mean is 3.16, the observed raw median is 3 and the observed interpolated median is 3.174. The following table gives some comparison statistics. The expected value of the median falls slightly as sample size increases while, as would be expected, the standard errors of both the median and the mean are proportionate to the inverse square root of the sample size. The asymptotic approximation errs on the side of caution by overestimating the standard error.


Estimation of variance from sample data

The value of (2 f(x))^—the asymptotic value of n^ (\nu - m) where \nu is the population median—has been studied by several authors. The standard "delete one" jackknife method produces
inconsistent In deductive logic, a consistent theory is one that does not lead to a logical contradiction. A theory T is consistent if there is no formula \varphi such that both \varphi and its negation \lnot\varphi are elements of the set of consequences o ...
results. An alternative—the "delete k" method—where k grows with the sample size has been shown to be asymptotically consistent. This method may be computationally expensive for large data sets. A bootstrap estimate is known to be consistent, but converges very slowly ( order of n^). Other methods have been proposed but their behavior may differ between large and small samples.


Efficiency

The
efficiency Efficiency is the often measurable ability to avoid making mistakes or wasting materials, energy, efforts, money, and time while performing a task. In a more general sense, it is the ability to do things well, successfully, and without waste. ...
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 In probability theory and statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is f(x) = \frac ...
, the efficiency for large N is \frac \frac The efficiency tends to \frac as N tends to infinity. In other words, the relative variance of the median will be \pi/2 \approx 1.57, or 57% greater than the variance of the mean – the relative standard error of the median will be (\pi/2)^\frac \approx 1.25, or 25% greater than the standard error of the mean, \sigma/\sqrt (see also section #Sampling distribution above.).


Other estimators

For univariate distributions that are ''symmetric'' about one median, the
Hodges–Lehmann estimator In statistics, the Hodges–Lehmann estimator is a robust and nonparametric estimator of a population's location parameter. For populations that are symmetric about one median, such as the Gaussian or normal distribution or the Student ''t''-di ...
is a robust and highly efficient estimator of the population median. If data is represented by a
statistical model A statistical model is a mathematical model that embodies a set of statistical assumptions concerning the generation of Sample (statistics), sample data (and similar data from a larger Statistical population, population). A statistical model repre ...
specifying a particular family of
probability distribution In probability theory and statistics, a probability distribution is a Function (mathematics), function that gives the probabilities of occurrence of possible events for an Experiment (probability theory), experiment. It is a mathematical descri ...
s, 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.
Pareto interpolation Pareto interpolation is a method of estimator, estimating the median and other properties of a population that follows a Pareto distribution. It is used in economics when analysing the distribution of incomes in a population, when one must base es ...
is an application of this when the population is assumed to have a
Pareto distribution The Pareto distribution, named after the Italian civil engineer, economist, and sociologist Vilfredo Pareto, is a power-law probability distribution that is used in description of social, quality control, scientific, geophysical, actuarial scien ...
.


Multivariate median

Previously, this article discussed the univariate median, when the sample or population had one-dimension. 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.


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.


Geometric median

The
geometric median In geometry, the geometric median of a discrete point set in a Euclidean space is the point minimizing the sum of distances to the sample points. This generalizes the median, which has the property of minimizing the sum of distances or absolute ...
of a discrete set of sample points x_1,\ldots x_N in a Euclidean space is the point minimizing the sum of distances to the sample points. \hat\mu = \underset \sum_^ \left \, \mu-x_n \right \, _2 In contrast to the marginal median, the geometric median is equivariant with respect to Euclidean similarity transformations such as translations and rotations.


Median in all directions

If the marginal medians for all coordinate systems coincide, then their common location may be termed the "median in all directions". This concept is relevant to voting theory on account of the
median voter theorem In political science and social choice theory, social choice, Black's median voter theorem says that if voters and candidates are distributed along a political spectrum, any voting method Condorcet criterion, compatible with majority-rule will elec ...
. When it exists, the median in all directions coincides with the geometric median (at least for discrete distributions).


Centerpoint


Conditional median

The conditional median occurs in the setting where we seek to estimate a random variable X from a random variable Y , which is a noisy version of X . The conditional median in this setting is given by m(X, Y=y) = F^_ \left(\frac\right) where t \mapsto F^_(t) is the inverse of the conditional cdf (i.e., conditional quantile function) of x \mapsto F_(x, y). For example, a popular model is Y = X+Z where Z is standard normal independent of X. The conditional median is the optimal Bayesian L_1 estimator: m(X, Y=y) = \arg \min_f \operatorname \left X - f(Y) , \right/math> It is known that for the model Y = X+Z where Z is standard normal independent of X, the estimator is linear if and only if X is Gaussian.


Other median-related concepts


Interpolated median

When dealing with a discrete variable, it is sometimes useful to regard the observed values as being midpoints of underlying continuous intervals. An example of this is a
Likert scale A Likert scale ( ,) is a psychometric scale named after its inventor, American social psychologist Rensis Likert, which is commonly used in research questionnaires. It is the most widely used approach to scaling responses in survey research, s ...
, on which opinions or preferences are expressed on a scale with a set number of possible responses. If the scale consists of the positive integers, an observation of 3 might be regarded as representing the interval from 2.50 to 3.50. It is possible to estimate the median of the underlying variable. If, say, 22% of the observations are of value 2 or below and 55.0% are of 3 or below (so 33% have the value 3), then the median m is 3 since the median is the smallest value of x for which F(x) is greater than a half. But the interpolated median is somewhere between 2.50 and 3.50. First we add half of the interval width w to the median to get the upper bound of the median interval. Then we subtract that proportion of the interval width which equals the proportion of the 33% which lies above the 50% mark. In other words, we split up the interval width pro rata to the numbers of observations. In this case, the 33% is split into 28% below the median and 5% above it so we subtract 5/33 of the interval width from the upper bound of 3.50 to give an interpolated median of 3.35. More formally, if the values f(x) are known, the interpolated median can be calculated from m_\text = m + w\left frac - \frac\right Alternatively, if in an observed sample there are k scores above the median category, j scores in it and i scores below it then the interpolated median is given by m_\text = m + \frac \left frac j\right


Pseudo-median

For univariate distributions that are ''symmetric'' about one median, the
Hodges–Lehmann estimator In statistics, the Hodges–Lehmann estimator is a robust and nonparametric estimator of a population's location parameter. For populations that are symmetric about one median, such as the Gaussian or normal distribution or the Student ''t''-di ...
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. The Hodges–Lehmann estimator has been generalized to multivariate distributions.


Variants of regression

The Theil–Sen estimator is a method for robust
linear regression In statistics, linear regression is a statistical model, model that estimates the relationship between a Scalar (mathematics), scalar response (dependent variable) and one or more explanatory variables (regressor or independent variable). A mode ...
based on finding medians of
slope In mathematics, the slope or gradient of a Line (mathematics), line is a number that describes the direction (geometry), direction of the line on a plane (geometry), plane. Often denoted by the letter ''m'', slope is calculated as the ratio of t ...
s.


Median filter

The
median filter The median filter is a non-linear digital filtering technique, often used to remove signal noise, noise from an image, signal, and video. Such noise reduction is a typical pre-processing step to improve the results of later processing (for example ...
is an important tool of
image processing An image or picture is a visual representation. An image can be two-dimensional, such as a drawing, painting, or photograph, or three-dimensional, such as a carving or sculpture. Images may be displayed through other media, including a pr ...
, that can effectively remove any salt and pepper noise from
grayscale In digital photography, computer-generated imagery, and colorimetry, a greyscale (more common in Commonwealth English) or grayscale (more common in American English) image is one in which the value of each pixel is a single sample (signal), s ...
images.


Cluster analysis

In
cluster analysis Cluster analysis or clustering is the data analyzing technique in which task of grouping a set of objects in such a way that objects in the same group (called a cluster) are more Similarity measure, similar (in some specific sense defined by the ...
, the
k-medians clustering K-medians clustering is a partitioning technique used in cluster analysis. It groups data into ''k'' clusters by minimizing the sum of distances—typically using the Manhattan (L1) distance—between data points and the median of their assigned c ...
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 ''k''-means clustering is a method of vector quantization, originally from signal processing, that aims to partition of a set, partition ''n'' observations into ''k'' clusters in which each observation belongs to the cluster (statistics), cluste ...
, is replaced by maximising the distance between cluster-medians.


Median–median line

This is a method of robust regression. The idea dates back to Wald in 1940 who suggested dividing a set of bivariate data into two halves depending on the value of the independent parameter x: a left half with values less than the median and a right half with values greater than the median. He suggested taking the means of the dependent y and independent x variables of the left and the right halves and estimating the slope of the line joining these two points. The line could then be adjusted to fit the majority of the points in the data set. Nair and Shrivastava in 1942 suggested a similar idea but instead advocated dividing the sample into three equal parts before calculating the means of the subsamples. Brown and Mood in 1951 proposed the idea of using the medians of two subsamples rather the means. Tukey combined these ideas and recommended dividing the sample into three equal size subsamples and estimating the line based on the medians of the subsamples.


Median-unbiased estimators

Any ''mean''-unbiased estimator minimizes the
risk In simple terms, risk is the possibility of something bad happening. Risk involves uncertainty about the effects/implications of an activity with respect to something that humans value (such as health, well-being, wealth, property or the environ ...
( expected loss) with respect to the squared-error loss function, as observed by
Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, Geodesy, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observat ...
. A ''median''-unbiased estimator minimizes the risk with respect to the absolute-deviation loss function, as observed by
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
. Other
loss functions In mathematical optimization and decision theory, a loss function or cost function (sometimes also called an error function) is a function that maps an event or values of one or more variables onto a real number intuitively representing some "cost ...
are used in
statistical theory The theory of statistics provides a basis for the whole range of techniques, in both study design and data analysis, that are used within applications of statistics. The theory covers approaches to statistical-decision problems and to statistica ...
, particularly in
robust statistics Robust statistics are statistics that maintain their properties even if the underlying distributional assumptions are incorrect. Robust Statistics, statistical methods have been developed for many common problems, such as estimating location parame ...
. The theory of median-unbiased estimators was revived by George W. Brown in 1947: Further properties of median-unbiased estimators have been reported. There are methods of constructing median-unbiased estimators that are optimal (in a sense analogous to the minimum-variance property for mean-unbiased estimators). Such constructions exist for probability distributions having monotone likelihood-functions. One such procedure is an analogue of the Rao–Blackwell procedure for mean-unbiased estimators: The procedure holds for a smaller class of probability distributions than does the Rao—Blackwell procedure but for a larger class of loss functions.


History

Scientific researchers in the ancient near east appear not to have used summary statistics altogether, instead choosing values that offered maximal consistency with a broader theory that integrated a wide variety of phenomena. Within the Mediterranean (and, later, European) scholarly community, statistics like the mean are fundamentally a medieval and early modern development. (The history of the median outside Europe and its predecessors remains relatively unstudied.) The idea of the median appeared in the 6th century in the
Talmud The Talmud (; ) is the central text of Rabbinic Judaism and the primary source of Jewish religious law (''halakha'') and Jewish theology. Until the advent of Haskalah#Effects, modernity, in nearly all Jewish communities, the Talmud was the cen ...
, in order to fairly analyze divergent appraisals. However, the concept did not spread to the broader scientific community. Instead, the closest ancestor of the modern median is the
mid-range In statistics, the mid-range or mid-extreme is a measure of central tendency of a sample defined as the arithmetic mean of the maximum and minimum values of the data set: :M=\frac. The mid-range is closely related to the range, a measure of ...
, invented by
Al-Biruni Abu Rayhan Muhammad ibn Ahmad al-Biruni (; ; 973after 1050), known as al-Biruni, was a Khwarazmian Iranian scholar and polymath during the Islamic Golden Age. He has been called variously "Father of Comparative Religion", "Father of modern ...
Transmission of his work to later scholars is unclear. He applied his technique to
assay An assay is an investigative (analytic) procedure in laboratory medicine, mining, pharmacology, environmental biology and molecular biology for qualitatively assessing or quantitatively measuring the presence, amount, or functional activity ...
ing currency metals, but, after he published his work, most assayers still adopted the most unfavorable value from their results, lest they appear to cheat. However, increased navigation at sea during the
Age of Discovery The Age of Discovery (), also known as the Age of Exploration, was part of the early modern period and overlapped with the Age of Sail. It was a period from approximately the 15th to the 17th century, during which Seamanship, seafarers fro ...
meant that ship's navigators increasingly had to attempt to determine latitude in unfavorable weather against hostile shores, leading to renewed interest in summary statistics. Whether rediscovered or independently invented, the mid-range is recommended to nautical navigators in Harriot's "Instructions for Raleigh's Voyage to Guiana, 1595". The idea of the median may have first appeared in Edward Wright's 1599 book ''Certaine Errors in Navigation'' on a section about
compass A compass is a device that shows the cardinal directions used for navigation and geographic orientation. It commonly consists of a magnetized needle or other element, such as a compass card or compass rose, which can pivot to align itself with No ...
navigation. Wright was reluctant to discard measured values, and may have felt that the median — incorporating a greater proportion of the dataset than the
mid-range In statistics, the mid-range or mid-extreme is a measure of central tendency of a sample defined as the arithmetic mean of the maximum and minimum values of the data set: :M=\frac. The mid-range is closely related to the range, a measure of ...
— was more likely to be correct. However, Wright did not give examples of his technique's use, making it hard to verify that he described the modern notion of median. The median (in the context of probability) certainly appeared in the correspondence of
Christiaan Huygens Christiaan Huygens, Halen, Lord of Zeelhem, ( , ; ; also spelled Huyghens; ; 14 April 1629 – 8 July 1695) was a Dutch mathematician, physicist, engineer, astronomer, and inventor who is regarded as a key figure in the Scientific Revolution ...
, but as an example of a statistic that was inappropriate for actuarial practice. The earliest recommendation of the median dates to 1757, when Roger Joseph Boscovich developed a regression method based on the ''L''1 norm and therefore implicitly on the median. In 1774,
Laplace Pierre-Simon, Marquis de Laplace (; ; 23 March 1749 – 5 March 1827) was a French polymath, a scholar whose work has been instrumental in the fields of physics, astronomy, mathematics, engineering, statistics, and philosophy. He summariz ...
made this desire explicit: he suggested the median be used as the standard estimator of the value of a posterior
PDF Portable document format (PDF), standardized as ISO 32000, is a file format developed by Adobe Inc., Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, computer hardware, ...
. The specific criterion was to minimize the expected magnitude of the error; , \alpha - \alpha^, where \alpha^ is the estimate and \alpha is the true value. To this end, Laplace determined the distributions of both the sample mean and the sample median in the early 1800s.Laplace PS de (1818) ''Deuxième supplément à la Théorie Analytique des Probabilités'', Paris, Courcier However, a decade later,
Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, Geodesy, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observat ...
and Legendre developed the
least squares The method of least squares is a mathematical optimization technique that aims to determine the best fit function by minimizing the sum of the squares of the differences between the observed values and the predicted values of the model. The me ...
method, which minimizes (\alpha - \alpha^)^ to obtain the mean; the strong justification of this estimator by reference to
maximum likelihood estimation In statistics, maximum likelihood estimation (MLE) is a method of estimation theory, estimating the Statistical parameter, parameters of an assumed probability distribution, given some observed data. This is achieved by Mathematical optimization, ...
based on a
normal distribution In probability theory and statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is f(x) = \frac ...
means it has mostly replaced Laplace's original suggestion.
Antoine Augustin Cournot Antoine Augustin Cournot (; 28 August 180131 March 1877) was a French philosopher and mathematician who contributed to the development of economics. Biography Antoine Augustin Cournot was born on August 28, 1801 in Gray, Haute-Saône. He ent ...
in 1843 was the first to use the term ''median'' (''valeur médiane'') for the value that divides a probability distribution into two equal halves.
Gustav Theodor Fechner Gustav Theodor Fechner (; ; 19 April 1801 – 18 November 1887) was a German physicist, philosopher, and experimental psychologist. A pioneer in experimental psychology and founder of psychophysics (techniques for measuring the mind), he inspired ...
used the median (''Centralwerth'') in sociological and psychological phenomena.Keynes, J.M. (1921) '' A Treatise on Probability''. Pt II Ch XVII §5 (p 201) (2006 reprint, Cosimo Classics, : multiple other reprints) It had earlier been used only in astronomy and related fields.
Gustav Fechner Gustav Theodor Fechner (; ; 19 April 1801 – 18 November 1887) was a German physicist, philosopher, and experimental psychologist. A pioneer in experimental psychology and founder of psychophysics (techniques for measuring the mind), he inspi ...
popularized the median into the formal analysis of data, although it had been used previously by Laplace, and the median appeared in a textbook by F. Y. Edgeworth.
Francis Galton Sir Francis Galton (; 16 February 1822 – 17 January 1911) was an English polymath and the originator of eugenics during the Victorian era; his ideas later became the basis of behavioural genetics. Galton produced over 340 papers and b ...
used the term ''median'' in 1881,Galton F (1881) "Report of the Anthropometric Committee" pp 245–260
''Report of the 51st Meeting of the British Association for the Advancement of Science''
/ref> having earlier used the terms ''middle-most value'' in 1869, and the ''medium'' in 1880. ''personal.psu.edu''
/ref>


See also

* * * * for * * – Algorithm to calculate the approximate median in linear time * * * * s – Generalization of the median in higher dimensions * *


Notes


References


External links

*
Median as a weighted arithmetic mean of all Sample Observations

On-line calculator



A problem involving the mean, the median, and the mode.
*
Python script
for Median computations and
income inequality metrics Income inequality metrics or income distribution metrics are used by social scientists to measure the distribution of wealth, distribution of income and economic inequality among the participants in a particular economy, such as that of a specific ...

Fast Computation of the Median by Successive Binning

'Mean, median, mode and skewness'
A tutorial devised for first-year psychology students at Oxford University, based on a worked example.
The Complex SAT Math Problem Even the College Board Got Wrong
Andrew Daniels in ''
Popular Mechanics ''Popular Mechanics'' (often abbreviated as ''PM'' or ''PopMech'') is a magazine of popular science and technology, featuring automotive, home, outdoor, electronics, science, do it yourself, and technology topics. Military topics, aviation an ...
'' {{Statistics, descriptive Means Robust statistics