Skip to main content
added 262 characters in body
Source Link
josliber
  • 4.4k
  • 29
  • 44

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

Without ordering your data, you can use the definition of the geometric median to define the median in one dimension:

$$ \mathrm{Median}(\{X_1, X_2, \ldots, X_N\}) = \arg\min_{y} \sum_{i=1}^N \big|X_i-y\big| $$

Note that this does not necessarily define a unique median when there are an even number of points; for instance any number $y\in[3, 4]$ optimizes the objective with $X = \{2, 3, 4, 5\}$.

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

Without ordering your data, you can use the definition of the geometric median to define the median:

$$ \mathrm{Median}(\{X_1, X_2, \ldots, X_N\}) = \arg\min_{y} \sum_{i=1}^N \big|X_i-y\big| $$

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

Without ordering your data, you can use the definition of the geometric median to define the median in one dimension:

$$ \mathrm{Median}(\{X_1, X_2, \ldots, X_N\}) = \arg\min_{y} \sum_{i=1}^N \big|X_i-y\big| $$

Note that this does not necessarily define a unique median when there are an even number of points; for instance any number $y\in[3, 4]$ optimizes the objective with $X = \{2, 3, 4, 5\}$.

added 262 characters in body
Source Link
josliber
  • 4.4k
  • 29
  • 44

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

Without ordering your data, you can use the definition of the geometric median to define the median:

$$ \mathrm{Median}(\{X_1, X_2, \ldots, X_N\}) = \arg\min_{y} \sum_{i=1}^N \big|X_i-y\big| $$

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$

Without ordering your data, you can use the definition of the geometric median to define the median:

$$ \mathrm{Median}(\{X_1, X_2, \ldots, X_N\}) = \arg\min_{y} \sum_{i=1}^N \big|X_i-y\big| $$

Source Link
josliber
  • 4.4k
  • 29
  • 44

If you define $O_1, O_2, \ldots, O_N$ to be the sorted version of your original data $X_1, X_2, \ldots, X_N$, then the median is defined as:

$$ \mathrm{Median}(\{O_1, O_2, \ldots, O_N\}) = \left\{\begin{array}{ll} O_{(N+1)/2} & \mathrm{if}~N~\mathrm{is~odd} \\ (O_{N/2}+O_{N/2+1})/2 & \mathrm{otherwise}\end{array}\right. $$