# 方差

「Variance」的各地常用名稱

## 定义

X为服从分布F随机变量，如果E[X]是随机变量X期望值（均值μ=E[X]），则随机变量X或者分布F的方差为X离差平方的期望值：

${\displaystyle \operatorname {Var} (X)=\operatorname {E} \left[(X-\mu )^{2}\right]}$

${\displaystyle \operatorname {Var} (X)=\operatorname {Cov} (X,X)}$

{\displaystyle {\begin{aligned}\operatorname {Var} (X)&=\operatorname {E} \left[(X-\operatorname {E} [X])^{2}\right]\\[4pt]&=\operatorname {E} \left[X^{2}-2X\operatorname {E} [X]+\operatorname {E} [X]^{2}\right]\\[4pt]&=\operatorname {E} \left[X^{2}\right]-2\operatorname {E} [X]\operatorname {E} [X]+\operatorname {E} [X]^{2}\\[4pt]&=\operatorname {E} \left[X^{2}\right]-\operatorname {E} [X]^{2}\end{aligned}}}

### 离散随机变量

${\displaystyle \operatorname {Var} (X)=\sum _{i=1}^{n}p_{i}\cdot (x_{i}-\mu )^{2}=\sum _{i=1}^{n}(p_{i}\cdot x_{i}^{2})-\mu ^{2}}$

${\displaystyle \mu =\sum _{i=1}^{n}p_{i}\cdot x_{i}.}$

${\displaystyle x_{i}}$ 表示實現值(realized value)

X為有n個相等機率值的離散型均勻分佈時：

${\displaystyle \mu ={\frac {1}{n}}\sum _{i=1}^{n}x_{i},}$
${\displaystyle \operatorname {Var} (X)=\sigma ^{2}={\frac {1}{n}}\sum _{i=1}^{n}(x_{i}-\mu )^{2}={\frac {1}{n}}\left(\sum _{i=1}^{n}x_{i}^{2}-n\mu ^{2}\right)={\frac {\sum _{i=1}^{n}x_{i}^{2}}{n}}-\mu ^{2}.}$

n個相等機率值的方差亦可以點對點間的方變量表示為：

${\displaystyle \operatorname {Var} (X)={\frac {1}{n^{2}}}\sum _{i=1}^{n}\sum _{j=1}^{n}{\frac {1}{2}}(x_{i}-x_{j})^{2}.}$

### 连续型随机变量

{\displaystyle {\begin{aligned}\operatorname {Var} (X)=\sigma ^{2}&=\int _{\mathbb {R} }(x-\mu )^{2}f(x)\,dx\\[4pt]&=\int _{\mathbb {R} }x^{2}f(x)\,dx-2\mu \int _{\mathbb {R} }xf(x)\,dx+\mu ^{2}\int _{\mathbb {R} }f(x)\,dx\\[4pt]&=\int _{\mathbb {R} }x^{2}\,dF(x)-2\mu \int _{\mathbb {R} }x\,dF(x)+\mu ^{2}\int _{\mathbb {R} }\,dF(x)\\[4pt]&=\int _{\mathbb {R} }x^{2}\,dF(x)-2\mu \cdot \mu +\mu ^{2}\cdot 1\\[4pt]&=\int _{\mathbb {R} }x^{2}\,dF(x)-\mu ^{2},\end{aligned}}}

${\displaystyle \operatorname {Var} (X)=\int _{\mathbb {R} }x^{2}f(x)\,dx-\mu ^{2},}$

${\displaystyle \mu =\int _{\mathbb {R} }xf(x)\,dx=\int _{\mathbb {R} }x\,dF(x).}$

${\displaystyle \operatorname {Var} (X)=\int _{-\infty }^{+\infty }x^{2}f(x)\,dx-\mu ^{2},}$

## 特性

${\displaystyle \operatorname {Var} (X)\geq 0}$

${\displaystyle P(X=a)=1\Leftrightarrow \operatorname {Var} (X)=0}$

${\displaystyle \operatorname {Var} (X+a)=\operatorname {Var} (X).}$

${\displaystyle \operatorname {Var} (aX)=a^{2}\operatorname {Var} (X)}$

${\displaystyle \operatorname {Var} (aX+bY)=a^{2}\operatorname {Var} (X)+b^{2}\operatorname {Var} (Y)+2ab\,\operatorname {Cov} (X,Y),}$
${\displaystyle \operatorname {Var} (X-Y)=\operatorname {Var} (X)+\operatorname {Var} (Y)-2\,\operatorname {Cov} (X,Y),}$

${\displaystyle \operatorname {Var} \left(\sum _{i=1}^{N}X_{i}\right)=\sum _{i,j=1}^{N}\operatorname {Cov} (X_{i},X_{j})=\sum _{i=1}^{N}\operatorname {Var} (X_{i})+\sum _{i\neq j}\operatorname {Cov} (X_{i},X_{j})}$

## 总体方差和样本方差

### 总体方差

{\displaystyle {\begin{aligned}\sigma ^{2}&={\frac {1}{N}}\sum _{i=1}^{N}\left(x_{i}-\mu \right)^{2}={\frac {1}{N}}\sum _{i=1}^{N}\left(x_{i}^{2}-2\mu x_{i}+\mu ^{2}\right)\\[5pt]&=\left({\frac {1}{N}}\sum _{i=1}^{N}x_{i}^{2}\right)-2\mu \left({\frac {1}{N}}\sum _{i=1}^{N}x_{i}\right)+\mu ^{2}\\[5pt]&=\left({\frac {1}{N}}\sum _{i=1}^{N}x_{i}^{2}\right)-\mu ^{2}\end{aligned}}}

${\displaystyle \mu ={\frac {1}{N}}\sum _{i=1}^{N}x_{i}.}$

${\displaystyle \sigma ^{2}={\frac {1}{N^{2}}}\sum _{i

{\displaystyle {\begin{aligned}&{\frac {1}{2N^{2}}}\sum _{i,j=1}^{N}\left(x_{i}-x_{j}\right)^{2}\\[5pt]={}&{\frac {1}{2N^{2}}}\sum _{i,j=1}^{N}\left(x_{i}^{2}-2x_{i}x_{j}+x_{j}^{2}\right)\\[5pt]={}&{\frac {1}{2N}}\sum _{j=1}^{N}\left({\frac {1}{N}}\sum _{i=1}^{N}x_{i}^{2}\right)-\left({\frac {1}{N}}\sum _{i=1}^{N}x_{i}\right)\left({\frac {1}{N}}\sum _{j=1}^{N}x_{j}\right)+{\frac {1}{2N}}\sum _{i=1}^{N}\left({\frac {1}{N}}\sum _{j=1}^{N}x_{j}^{2}\right)\\[5pt]={}&{\frac {1}{2}}\left(\sigma ^{2}+\mu ^{2}\right)-\mu ^{2}+{\frac {1}{2}}\left(\sigma ^{2}+\mu ^{2}\right)\\[5pt]={}&\sigma ^{2}\end{aligned}}}

### 样本方差

#### 有偏样本方差

${\displaystyle \sigma _{Y}^{2}={\frac {1}{n}}\sum _{i=1}^{n}\left(Y_{i}-{\overline {Y}}\right)^{2}=\left({\frac {1}{n}}\sum _{i=1}^{n}Y_{i}^{2}\right)-{\overline {Y}}^{2}={\frac {1}{n^{2}}}\sum _{i,j\,:\,i

${\displaystyle {\overline {Y}}={\frac {1}{n}}\sum _{i=1}^{n}Y_{i}.}$

{\displaystyle {\begin{aligned}\operatorname {E} [\sigma _{Y}^{2}]&=\operatorname {E} \left[{\frac {1}{n}}\sum _{i=1}^{n}\left(Y_{i}-{\frac {1}{n}}\sum _{j=1}^{n}Y_{j}\right)^{2}\right]\\[5pt]&={\frac {1}{n}}\sum _{i=1}^{n}\operatorname {E} \left[Y_{i}^{2}-{\frac {2}{n}}Y_{i}\sum _{j=1}^{n}Y_{j}+{\frac {1}{n^{2}}}\sum _{j=1}^{n}Y_{j}\sum _{k=1}^{n}Y_{k}\right]\\[5pt]&={\frac {1}{n}}\sum _{i=1}^{n}\left({\frac {n-2}{n}}\operatorname {E} \left[Y_{i}^{2}\right]-{\frac {2}{n}}\sum _{j\neq i}\operatorname {E} \left[Y_{i}Y_{j}\right]+{\frac {1}{n^{2}}}\sum _{j=1}^{n}\sum _{k\neq j}^{n}\operatorname {E} \left[Y_{j}Y_{k}\right]+{\frac {1}{n^{2}}}\sum _{j=1}^{n}\operatorname {E} \left[Y_{j}^{2}\right]\right)\\[5pt]&={\frac {1}{n}}\sum _{i=1}^{n}\left[{\frac {n-2}{n}}\left(\sigma ^{2}+\mu ^{2}\right)-{\frac {2}{n}}(n-1)\mu ^{2}+{\frac {1}{n^{2}}}n(n-1)\mu ^{2}+{\frac {1}{n}}\left(\sigma ^{2}+\mu ^{2}\right)\right]\\[5pt]&={\frac {n-1}{n}}\sigma ^{2}.\end{aligned}}}

#### 无偏样本方差

${\displaystyle s^{2}={\frac {n}{n-1}}\sigma _{Y}^{2}={\frac {n}{n-1}}\left[{\frac {1}{n}}\sum _{i=1}^{n}\left(Y_{i}-{\overline {Y}}\right)^{2}\right]={\frac {1}{n-1}}\sum _{i=1}^{n}\left(Y_{i}-{\overline {Y}}\right)^{2}}$

## 半方差

${\displaystyle {\text{Semivariance}}={1 \over {n}}\sum _{i:x_{i}<\mu }(x_{i}-\mu )^{2}}$

## 参考文献

1. ^ 存档副本. [2023-07-25]. （原始内容存档于2023-07-25）.
2. ^ 存档副本. [2023-07-25]. （原始内容存档于2023-07-25）.
3. ^ Wasserman, Larry. All of Statistics: a concise course in statistical inference. Springer texts in statistics. 2005: 51. ISBN 9781441923226.
4. ^ Navidi, William (2006) Statistics for Engineers and Scientists, McGraw-Hill, pg 14.
5. ^ Montgomery, D. C. and Runger, G. C. (1994) Applied statistics and probability for engineers, page 201. John Wiley & Sons New York
6. ^
7. ^ Fama, Eugene F.; French, Kenneth R. Q&A: Semi-Variance: A Better Risk Measure?. Fama/French Forum. 2010-04-21 [2022-06-10]. （原始内容存档于2021-07-25）.