標準差

(重新導向自 均方差)

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 \approx 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}})}$