You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Theorem:** Let $X_1, \ldots, X_n$ be a collection of continuous [random variables](/D/rvar) drawn from the [probability density function](/D/pdf) $f(x)$ supported on $(-\infty, \infty)$ with common [median](/D/med) $m$. Then, $m$ minimizes the mean absolute error:
48
+
**Theorem:** Let $X_1, \ldots, X_n$ be a collection of [continuous](/D/rvar-disc)[random variables](/D/rvar) drawn from a [probability distribution](/D/dist) with the [probability density function](/D/pdf) $f(x)$ supported on $(-\infty, \infty)$ with common [median](/D/med) $m$. Then, $m$ minimizes the mean absolute error:
49
49
50
50
$$ \label{eq:med-mae}
51
51
m = \operatorname*{arg\,min}_{a \in \mathbb{R}} \mathrm{E}\left[ \lvert X_i - a \rvert \right] \; .
52
52
$$
53
53
54
54
55
-
**Proof:** We can find the optimum by performing a derivative test. First, since an absolute value function is not directly differentaible, simplify the objective function by splitting it into two separate integrals like so:
55
+
**Proof:** We can find the optimum by performing a derivative test. First, since an absolute value function is not differentaible at 0, we simplify the objective function by splitting it into two separate integrals:
56
56
57
-
$$ \label{eq:med-mae-split}
58
-
E(\lvert X_i - a \rvert) = \int_{-\infty}^a (a - x) f(x)dx + \int_{a}^\infty (x - a) f(x)dx
57
+
$$ \label{eq:med-mae-s1}
58
+
E(\lvert X_i - a \rvert) = \int_{-\infty}^a (a - x) f(x) \, \mathrm{d}x + \int_{a}^\infty (x - a) f(x) \, \mathrm{d}x \; .
59
59
$$
60
60
61
-
Now note that $\lvert\frac{\partial}{\partial a}(a - x)f(x)\rvert = \lvert\frac{\partial}{\partial a}(x - a)f(x)\rvert = f(x)$. Consequently, $\int_{-\infty}^af(x) = P(X_i < a)$ and $\int_{a}^\infty f(x) = P(X_i > a)$ both of which must be finite by the [axioms of probability](/D/prob-ax). Therefore, these integrals meet the conditions for [Leibniz's rule](https://en.wikipedia.org/wiki/Leibniz_integral_rule) to be applied.
61
+
Now note that $\lvert\frac{\partial}{\partial a}(a - x)f(x)\rvert = \lvert\frac{\partial}{\partial a}(x - a)f(x)\rvert = f(x)$. Consequently, $\int_{-\infty}^af(x) = P(X_i < a)$ and $\int_{a}^\infty f(x) = P(X_i > a)$, both of which must be finite by the [axioms of probability](/D/prob-ax). Therefore, these integrals meet the conditions for application of Leibniz's integral rule.
62
62
63
63
Applying Leibniz's rule, we can differentiate the objective function as follows:
64
64
65
-
$$ \label{eq:med-mae-split}
66
-
\frac{\partial}{\partial a} \Big(\int_{-\infty}^a (a - x) f(x)dx + \int_{a}^\infty (x - a) f(x)dx\Big) = (a - x)f(x) + \int_{-\infty}^a f(x)dx - (x - a)f(x) - \int_{a}^\infty f(x)dx
P(X_i < a) = P(X_i > a) \implies P(X_i < a) = 1 - P(X_i < a) \implies P(X_i < a) = 0.5
80
+
P(X_i < a) = P(X_i > a)
81
+
\quad \Rightarrow \quad
82
+
P(X_i < a) = 1 - P(X_i < a)
83
+
\quad \Rightarrow \quad
84
+
P(X_i < a) = 0.5
79
85
$$
80
86
81
87
As a result, $a$ satisfies the [definition of a median](/D/med) at the critical point of the objective function.
82
88
83
-
Finally, absolute value is a [convex function](https://en.wikipedia.org/wiki/Convex_function), and so is its expected value by [Jensen's inequality](https://en.wikipedia.org/wiki/Jensen%27s_inequality); this implies, since the median is the sole critical point, it must be a global minimum. Therefore, the median must minimize the mean absolute error, completing the proof.
84
-
89
+
Finally, the absolute value is a convex function, and so is its expected value by Jensen's inequality. This implies, since the median is the sole critical point, it must be a global minimum. Therefore, the median must minimize the mean absolute error, completing the proof.
0 commit comments