# 均值和中值

## 中位数 The Median

4.1中介绍过一个分布的的期望，是在随机变量所在的数轴的重心位置，这种角度下，期望是一个中心位置。

Definition Median.Let $X$ be a random varibale.Every number $m$ with the following prperty is called a median of the distribution of $X$:
\begin{aligned} Pr(X\leq m)\geq 1/2\ \end{aligned} \text{ and } \begin{aligned} Pr(X\geq m)\geq 1/2 \end{aligned}

Firest,if m is included with the values of X to the left of m,then
$$Pr(X\leq m)\geq Pr(X>m)$$

seconde ,if m is included with the values of X to the right of m,then
$$Pr(X\geq m)\geq Pr(X<m)$$

If there is a number $m$ such that $Pr(X < m)=Pr(X > m)$ ,that is,if the number $m$ does actually divide the total Probability into two equal parts,then $m$ will of course be a median of the distribution of $X$

## 均值和中值的比较 Comparison of the Mean and the median

Theorem One-to-One Function.Let $X$ be a random variable that takes values in an interval $I$ of real numbers.Let $r$ be a one-to-one function defined on the interval $I$.If $m$ is a median of $X$ ,then $r(m)$ is a median of $r(X)$

## 最小均方误差 Minimizing the Mean Squared Error

Definition Mean Squared Error/M.S.E.. The number $E[(X-d)^2]$ is called the mean squared error(M.S.E) of prediction $d$ .

Theorem Let $X$ be a random varibale with finite variance $\sigma^2$ ,and let $\mu=E(X)$ .For every number $d$ ,
$$E[(X-\mu)^2]\leq E[(X-d)^2]$$
Furthermore ,there will be equality in the relation if and only if $d=\mu$

\begin{aligned} E[(X-d)^2]&=E(X^2+2dX+d^2)\\ &=E(X^2)-2d\mu+d^2 \end{aligned}

## 最小化绝对误差均值 Minimizing the Mean Absolute Error

Definition Mean Absolute Error/M.A.E. The number $E(|X-d|)$ is called the mean absolute error (M.A.E) of the prediction $d$ .

Theorem Let $X$ be a random variable with finite mean,and let $m$ be a median of the distribution of $X$ .For every number $d$ ,
$$E(|X-m|)\leq E(|X-d|)$$
Furthermore,there will be equality in the relation if and only if $d$ is also a median of the distribution of $X$

$$E(|X-d|)-E(|X-m|)=\int^{\infty}_{-\infty}(|x-d|-|x-m|)f(x)dx\\ =\int^{m}_{-\infty}(d-m)f(x)dx+\int^{d}_{m}(d+m-2x)fxdx+\int^{\infty}_{d}(m-d)f(x)dx\\ \geq \int^{m}_{-\infty}(d-m)f(x)dx+\int^{d}_{m}(d+m)fxdx+\int^{\infty}_{d}(m-d)f(x)dx\\ =(d-m)[Pr(X\leq m)-Pr(X > m)]$$

$$Pr(X\leq m)\geq 1/2 \geq Pr(X>m)$$