# 标准差

（重定向自均方差

1. 为非负数值（因为开平方后再做平方根）；
2. 与测量资料具有相同单位（这样才能比对）。

## 总体的标准差

### 基本定义

${\displaystyle \ SD={\sqrt {{\frac {1}{N}}\sum _{i=1}^{N}(x_{i}-\mu )^{2}}}}$

${\displaystyle \mu }$为平均值（${\displaystyle {\overline {x}}}$）。

### 简化计算公式

{\displaystyle {\begin{aligned}\sum _{i=1}^{N}(X_{i}-\mu )^{2}&={}\sum _{i=1}^{N}(X_{i}^{2}-2X_{i}\mu +\mu ^{2})\\&{}=\left(\sum _{i=1}^{N}X_{i}^{2}\right)-\left(2\mu \sum _{i=1}^{N}X_{i}\right)+N\mu ^{2}\\&{}=\left(\sum _{i=1}^{N}X_{i}^{2}\right)-2\mu (N\mu )+N\mu ^{2}\\&{}=\left(\sum _{i=1}^{N}X_{i}^{2}\right)-2N\mu ^{2}+N\mu ^{2}\\&{}=\left(\sum _{i=1}^{N}X_{i}^{2}\right)-N\mu ^{2}\end{aligned}}}

${\displaystyle \sigma ={\sqrt {{\frac {1}{N}}\sum _{i=1}^{N}(X_{i}-\mu )^{2}}}}$
${\displaystyle ={\sqrt {{\frac {1}{N}}\left(\sum _{i=1}^{N}X_{i}^{2}\right)-{\frac {1}{N}}N\mu ^{2}}}}$
${\displaystyle ={\sqrt {{\frac {\sum _{i=1}^{N}X_{i}^{2}}{N}}-\mu ^{2}}}}$

### 总体为随机变量

${\displaystyle \sigma ={\sqrt {\operatorname {E} ((X-\operatorname {E} (X))^{2})}}={\sqrt {\operatorname {E} (X^{2})-(\operatorname {E} (X))^{2}}}}$

#### 离散随机变量的标准差

${\displaystyle X}$是由实数${\displaystyle x_{1},x_{2},...,x_{n}}$构成的离散随机变量英语：discrete random variable），且每个值的概率相等，则${\displaystyle X}$的标准差定义为：

${\displaystyle \sigma ={\sqrt {{\frac {1}{N}}\left[(x_{1}-\mu )^{2}+(x_{2}-\mu )^{2}+\cdots +(x_{N}-\mu )^{2}\right]}}}$　，其中　${\displaystyle \mu ={\frac {1}{N}}(x_{1}+\cdots +x_{N})}$

${\displaystyle \sigma ={\sqrt {{\frac {1}{N}}\sum _{i=1}^{N}(x_{i}-\mu )^{2}}}}$　，其中　${\displaystyle \mu ={\frac {1}{N}}(x_{1}+\cdots +x_{N})}$

${\displaystyle \sigma ={\sqrt {\sum _{i=1}^{N}p_{i}(x_{i}-\mu )^{2}}}}$　，其中　${\displaystyle \mu =\sum _{i=1}^{N}p_{i}x_{i}.}$

#### 连续随机变量的标准差

${\displaystyle X}$为概率密度${\displaystyle p(X)}$连续随机变量英语：continuous random variable），则${\displaystyle X}$的标准差定义为：

${\displaystyle \sigma ={\sqrt {\int (x-\mu )^{2}\,p(x)\,dx}}}$

${\displaystyle \mu =\int x\,p(x)\,dx}$

### 标准差的特殊性质

${\displaystyle \sigma (X+c)=\sigma (X)}$
${\displaystyle \sigma (cX)=c\cdot \sigma (X)}$
${\displaystyle \sigma (X+Y)={\sqrt {\sigma ^{2}(X)+\sigma ^{2}(Y)+2\cdot {\mbox{cov}}(X,Y)}}}$

• ${\displaystyle {\mbox{cov}}(X,Y)}$表示随机变量${\displaystyle X}$${\displaystyle Y}$协方差
• ${\displaystyle \sigma ^{2}(X)}$表示${\displaystyle [\sigma (X)]^{2}}$，即${\displaystyle Var(X)}$${\displaystyle X}$的方差），对${\displaystyle Y}$亦同。

## 样本的标准差

${\displaystyle s={\sqrt {{\frac {1}{n-1}}\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}}$

## 范例

• 第一步，计算平均值${\displaystyle {\overline {x}}}$
${\displaystyle {\overline {x}}={\frac {1}{N}}\sum _{i=1}^{N}x_{i}}$
${\displaystyle {\begin{smallmatrix}N=4\end{smallmatrix}}}$（因为集合里有4个数），分别设为：
{\displaystyle {\begin{aligned}x_{1}&=5\\x_{2}&=6\\x_{3}&=8\\x_{4}&=9\\\end{aligned}}}
${\displaystyle {\overline {x}}={\frac {1}{4}}\sum _{i=1}^{4}x_{i}}$${\displaystyle (N=4)}$
${\displaystyle {\overline {x}}={\frac {1}{4}}\left(x_{1}+x_{2}+x_{3}+x_{4}\right)}$
${\displaystyle {\overline {x}}={\frac {1}{4}}\left(5+6+8+9\right)}$
${\displaystyle {\overline {x}}=7}$（此为平均值）
• 第二步，计算标准差${\displaystyle \sigma \,}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{N}}\sum _{i=1}^{N}(x_{i}-{\overline {x}})^{2}}}}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\sum _{i=1}^{4}(x_{i}-{\overline {x}})^{2}}}}$${\displaystyle (N=4)}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\sum _{i=1}^{4}(x_{i}-7)^{2}}}}$${\displaystyle ({\overline {x}}=7)}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\left[(x_{1}-7)^{2}+(x_{2}-7)^{2}+(x_{3}-7)^{2}+(x_{4}-7)^{2}\right]}}}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\left[(5-7)^{2}+(6-7)^{2}+(8-7)^{2}+(9-7)^{2}\right]}}}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\left((-2)^{2}+(-1)^{2}+1^{2}+2^{2}\right)}}}$
${\displaystyle \sigma ={\sqrt {{\frac {1}{4}}\left(4+1+1+4\right)}}}$
${\displaystyle \sigma ={\sqrt {\frac {10}{4}}}}$
${\displaystyle \sigma =1.58114\,\!}$（此为标准差）

## 标准差与平均值之间的关系

${\displaystyle \sigma (\mu )={\sqrt {{\frac {1}{N}}\sum _{i=1}^{N}(x_{i}-\mu )^{2}}}}$

${\displaystyle \mu ={\overline {x}}}$

## 几何学解释

${\displaystyle R=({\overline {x}},{\overline {x}},{\overline {x}})}$