Skip to content

Commit ed68c9a

Browse files
committed
integrated new fcontent
The proof "med-mse" was slightly rewritten.
1 parent 8dbe7ec commit ed68c9a

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

I/ToC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ title: "Table of Contents"
192192
<p id="Measures of central tendency"></p>
193193
1.15. Measures of central tendency <br>
194194
&emsp;&ensp; 1.15.1. *[Median](/D/med)* <br>
195-
&emsp;&ensp; 1.15.2. **[The median minimizes mean absolute error](/P/med-mae)** <br>
195+
&emsp;&ensp; 1.15.2. **[Median minimizes mean absolute error](/P/med-mae)** <br>
196196
&emsp;&ensp; 1.15.3. *[Mode](/D/mode)* <br>
197197

198198
<p id="Measures of statistical dispersion"></p>

P/med-mae.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ date: 2024-09-23 23:30:00
1010
title: "The median minimizes the mean absolute error"
1111
chapter: "General Theorems"
1212
section: "Probability theory"
13-
topic: "Measures of central tendency
14-
theorem: "The median minimizes the mean absolute error"
13+
topic: "Measures of central tendency"
14+
theorem: "Median minimizes mean absolute error"
1515

1616
sources:
1717
- authors: "Wikipedia"
@@ -28,57 +28,62 @@ sources:
2828
url: "https://en.wikipedia.org/wiki/Leibniz_integral_rule"
2929
- authors: "Wikipedia"
3030
year: 2024
31-
title: "Jensen's Inequality"
31+
title: "Jensen's inequality"
3232
in: "Wikipedia, the free encyclopedia"
3333
pages: "retrieved on 2024-09-23"
3434
url: "https://en.wikipedia.org/wiki/Jensen%27s_inequality"
3535
- authors: "Wikipedia"
3636
year: 2024
37-
title: "Convex Function"
37+
title: "Convex function"
3838
in: "Wikipedia, the free encyclopedia"
3939
pages: "retrieved on 2024-09-23"
4040
url: "https://en.wikipedia.org/wiki/Convex_function"
4141

42-
proof_id: "P470"
42+
proof_id: "P471"
4343
shortcut: "med-mae"
4444
username: "salbalkus"
4545
---
4646

4747

48-
**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:
4949

5050
$$ \label{eq:med-mae}
5151
m = \operatorname*{arg\,min}_{a \in \mathbb{R}} \mathrm{E}\left[ \lvert X_i - a \rvert \right] \; .
5252
$$
5353

5454

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:
5656

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 \; .
5959
$$
6060

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.
6262

6363
Applying Leibniz's rule, we can differentiate the objective function as follows:
6464

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
65+
$$ \label{eq:med-mae-s2}
66+
\frac{\partial}{\partial a} \left( \int_{-\infty}^a (a - x) f(x) \, \mathrm{d}x + \int_{a}^\infty (x - a) f(x) \, \mathrm{d}x \right) = (a - x) f(x) + \int_{-\infty}^a f(x) \, \mathrm{d}x - (x - a) f(x) - \int_{a}^\infty f(x) \, \mathrm{d}x \; .
6767
$$
6868

6969
Canceling terms and setting this derivative to 0, it must be true that
7070

7171
$$\label{eq:dmed-da}
72-
\int_{-\infty}^a f(x)dx - \int_{a}^\infty f(x)dx = 0 \implies P(X_i < a) = P(X_i > a)
72+
\int_{-\infty}^a f(x) \, \mathrm{d}x - \int_{a}^\infty f(x) \, \mathrm{d}x = 0
73+
\quad \Rightarrow \quad
74+
P(X_i < a) = P(X_i > a) \; .
7375
$$
7476

7577
This yields the implication
7678

7779
$$\label{eq:med-mae-qed}
78-
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
7985
$$
8086

8187
As a result, $a$ satisfies the [definition of a median](/D/med) at the critical point of the objective function.
8288

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

Comments
 (0)