# 二項式分布

（重定向自二項分佈

记号 概率质量函數 累積分布函數 B(n, p) ${\displaystyle n\geq 0}$ 试验次数 (整数)${\displaystyle 0\leq p\leq 1}$ 成功概率 (实数) ${\displaystyle k\in \{0,\dots ,n\}\!}$ ${\displaystyle {n \choose k}p^{k}(1-p)^{n-k}\!}$ ${\displaystyle I_{1-p}(n-\lfloor k\rfloor ,1+\lfloor k\rfloor )\!}$ ${\displaystyle n\,p\!}$ ${\displaystyle \{\lfloor np\rfloor ,\lceil (n+1)p\rceil \}}$之一 ${\displaystyle \lfloor (n+1)\,p\rfloor \!}$或${\displaystyle \lfloor (n+1)\,p\rfloor \!-1}$ ${\displaystyle n\,p\,(1-p)\!}$ ${\displaystyle {\frac {1-2\,p}{\sqrt {n\,p\,(1-p)}}}\!}$ ${\displaystyle {\frac {1-6\,p\,(1-p)}{n\,p\,(1-p)}}\!}$ ${\displaystyle {\frac {1}{2}}\ln \left(2\pi nep(1-p)\right)+O\left({\frac {1}{n}}\right)\!}$ ${\displaystyle (1-p+p\,e^{t})^{n}\!}$ ${\displaystyle (1-p+p\,e^{i\,t})^{n}\!}$

## 详述

### 概率质量函数

${\displaystyle f(k,n,p)=\Pr(X=k)={n \choose k}p^{k}(1-p)^{n-k}}$

${\displaystyle f(k;n,p)=f(n-k;n,1-p)\,}$

${\displaystyle (n+1)p-1

### 累积分布函数（概率分布函数）

${\displaystyle F(x;n,p)=\Pr(X\leq x)=\sum _{i=0}^{\lfloor x\rfloor }{n \choose i}p^{i}(1-p)^{n-i}}$

{\displaystyle {\begin{aligned}F(k;n,p)&=\Pr(X\leq k)=I_{1-p}(n-k,k+1)\\&=(n-k){n \choose k}\int _{0}^{1-p}t^{n-k-1}(1-t)^{k}\,dt\end{aligned}}}

## 期望和方差

${\displaystyle \operatorname {E} [X]=np}$

${\displaystyle \operatorname {Var} [X]=np(1-p).}$

${\displaystyle \mu _{n}=\sum _{k=1}^{n}\mu =np,\qquad \sigma _{n}^{2}=\sum _{k=1}^{n}\sigma ^{2}=np(1-p).}$

## 众数和中位数

${\displaystyle {\text{mode}}={\begin{cases}\lfloor (n+1)\,p\rfloor &{\text{若 }}(n+1)p{\text{ 是 0 或 非 整 数 }},\\(n+1)\,p\ {\text{ 和 }}\ (n+1)\,p-1&{\text{若 }}(n+1)p\in \{1,\dots ,n\},\\n&{\text{若 }}(n+1)p=n+1.\end{cases}}}$

• 如果${\displaystyle np}$ 是整数，那么平均数、中位数和众数相等，都等于${\displaystyle np}$ [1][2]
• 任何中位数${\displaystyle m}$ 都位于区间${\displaystyle \lfloor np\rfloor \leq m\leq \lceil np\rceil }$ 内。[3]
• 中位数${\displaystyle m}$ 不能离平均数太远：${\displaystyle \left\vert m-np\right\vert \leq \min\{\ln 2,\ \max\{p,1-p\}\}}$ [4]
• 如果${\displaystyle p\leq 1-\ln 2}$ ，或${\displaystyle p\geq \ln 2}$ ，或${\displaystyle \left\vert m-np\right\vert \leq \min\{p,1-p\}}$ （除了${\displaystyle p={\frac {1}{2}}}$ ${\displaystyle n}$ 是奇数的情况以外），那么中位数是唯一的，且等于${\displaystyle m=\mathrm {round} (np)}$ [3][4]
• 如果${\displaystyle p={\frac {1}{2}}}$ ，且${\displaystyle n}$ 是奇数，那么区间${\displaystyle {\frac {1}{2}}(n-1)\leq m\leq {\frac {1}{2}}(n+1)}$ 中的任何数${\displaystyle m}$ 都是二项分布的中位数。如果${\displaystyle p={\frac {1}{2}}}$ ${\displaystyle n}$ 是偶数，那么${\displaystyle m={\frac {n}{2}}}$ 是唯一的中位数。

## 两个二项分布的协方差

${\displaystyle \operatorname {Cov} (X,Y)=\operatorname {E} (XY)-\mu _{X}\mu _{Y}.}$

${\displaystyle \operatorname {Cov} (X,Y)=p_{B}-p_{X}p_{Y},\,}$

${\displaystyle \operatorname {Cov} (X,Y)_{n}=n(p_{B}-p_{X}p_{Y}).\,}$

## 与其他分布的关系

### 二项分布的和

${\displaystyle X+Y\sim B(n+m,p).\,}$

### 正态近似

${\displaystyle n=6}$ ${\displaystyle p=0.5}$ 时的二项分布以及正态近似

${\displaystyle {\mathcal {N}}(np,\,np(1-p))}$
${\displaystyle {\mathcal {Var}}(x)=np(1-p)}$

${\displaystyle n}$ 越大（至少30），近似越好，当${\displaystyle p}$ 不接近0或1时更好。[5]不同的经验法则可以用来决定${\displaystyle n}$ 是否足够大，以及${\displaystyle p}$ 是否距离0或1足够远：

• 一个规则是${\displaystyle np}$ ${\displaystyle n(1-p)}$ 都必须大于5。

## 极限

• ${\displaystyle n}$ 趋于${\displaystyle \infty }$ ${\displaystyle p}$ 趋于0，而${\displaystyle np}$ 固定于${\displaystyle \lambda >0}$ ，或至少${\displaystyle np}$ 趋于${\displaystyle \lambda >0}$ 时，二项分布${\displaystyle B(n,p)}$ 趋于期望值为λ的泊松分布
• ${\displaystyle n}$ 趋于${\displaystyle \infty }$ ${\displaystyle p}$ 固定时，
${\displaystyle {X-np \over {\sqrt {np(1-p)\ }}}}$

## 参考文献

1. ^ Neumann, P. Über den Median der Binomial- and Poissonverteilung. Wissenschaftliche Zeitschrift der Technischen Universität Dresden. 1966, 19: 29–33 （德语）.
2. ^ Lord, Nick. (July 2010). "Binomial averages when the mean is an integer", The Mathematical Gazette 94, 331-332.
3. Kaas, R.; Buhrman, J.M. Mean, Median and Mode in Binomial Distributions. Statistica Neerlandica. 1980, 34 (1): 13–18. doi:10.1111/j.1467-9574.1980.tb00681.x.
4. Kais Hamza. The smallest uniform upper bound on the distance between the mean and the median of the binomial and Poisson distributions. Statistics & Probability Letters: 21–25. [2018-04-02]. doi:10.1016/0167-7152(94)00090-u. （原始内容存档于2020-12-15）.页面存档备份，存于互联网档案馆
5. ^ Box, Hunter and Hunter. Statistics for experimenters. Wiley. 1978: 130.
6. ^ NIST/SEMATECH, "6.3.3.1. Counts Control Charts"页面存档备份，存于互联网档案馆）, e-Handbook of Statistical Methods.