基本概率分布Basic Concept of Probability Distributions 4: Negative Binomial Distribution
PMF
Suppose there is a sequence of independent Bernoulli trials, each trial having two potential outcomes called "success" and "failure". In each trial the probability of success is $p$ and of failure is $(1-p)$. We are observing this sequence until a predefined number $r$ of failures has occurred. Then the random number of successes we have seen, $X$, will have the negative binomial (or Pascal) distribution: $$f(x; r, p) = \Pr(X=x) = {x + r-1\choose x}p^{x}(1-p)^{r}$$ for $x = 0, 1, 2, \cdots$.
Proof:
$$ \begin{align*} \sum_{x =0}^{\infty}P(X = x) &= \sum_{x= 0}^{\infty} {x + r-1\choose x}p^{x}(1-p)^{r}\\ &= (1-p)^{r}\sum_{x=0}^{\infty} (-1)^{x}{-r\choose x}p^{x}\;\;\quad\quad (\mbox{identity}\ (-1)^{x}{-r\choose x}= {x+r-1\choose x})\\ &= (1-p)^r(1-p)^{-r}\;\;\quad\quad\quad\quad\quad\quad (\mbox{binomial theorem})\\ &= 1 \end{align*} $$ Using the identity $(-1)^{x}{-r\choose x}= {x+r-1\choose x}$: $$ \begin{align*} {x+r-1\choose x} &= {(x+r-1)!\over x!(r-1)!}\\ &= {(x+r-1)(x+r-2) \cdots r\over x!}\\ &= (-1)^{x}{(-r-(x-1))(-r-(x-2))\cdots(-r)\over x!}\\ &= (-1)^{x}{(-r)(-r-1)\cdots(-r-(x-1))\over x!}\\ &= (-1)^{x}{(-r)(-r-1)\cdots(-r-(x-1))(-r-x)!\over x!(-r-x)!}\\ &=(-1)^{x}{-r\choose x} \end{align*} $$
Mean
The expected value is $$\mu = E[X] = {rp\over 1-p}$$
Proof:
$$ \begin{align*} E[X] &= \sum_{x=0}^{\infty}xf(x; r, p)\\ &= \sum_{x=0}^{\infty}x{x + r-1\choose x}p^{x}(1-p)^{r}\\ &=\sum_{x=1}^{\infty}{(x+r-1)!\over(r-1)!(x-1)!}p^{x}(1-p)^{r}\\ &=\sum_{x=1}^{\infty}r{(x+r-1)!\over r(r-1)!(x-1)!}p^{x}(1-p)^{r}\\ &= {rp\over 1-p}\sum_{x=1}^{\infty}{x + r-1\choose x-1}p^{x-1}(1-p)^{r+1}\\ &={rp\over 1-p}\sum_{y=0}^{\infty}{y+(r+1)-1\choose y}p^{y}(1-p)^{r+1}\quad\quad\quad \mbox{setting}\ y= x-1\\ &= {rp\over 1-p} \end{align*} $$ where the last summation follows $Y\sim\mbox{NB}(r+1; p)$.
Variance
The variance is $$\sigma^2 = \mbox{Var}(X) = {rp\over(1-p)^2}$$
Proof:
$$ \begin{align*} E\left[X^2\right] &= \sum_{x=0}^{\infty}x^2f(x; r, p)\\ &= \sum_{x=0}^{\infty}x^2{x + r-1\choose x}p^{x}(1-p)^{r}\\ &=\sum_{x=1}^{\infty}x{(x+r-1)!\over(r-1)!(x-1)!}p^{x}(1-p)^{r}\\ &=\sum_{x=1}^{\infty}rx{(x+r-1)!\over r(r-1)!(x-1)!}p^{x}(1-p)^{r}\\ &= {rp\over 1-p}\sum_{x=1}^{\infty}x{x + r-1\choose x-1}p^{x-1}(1-p)^{r+1}\\ &={rp\over 1-p}\sum_{y=0}^{\infty}(y+1){y+(r+1)-1\choose y}p^{y}(1-p)^{r+1}\quad\quad\quad (\mbox{setting}\ y= x-1)\\ &= {rp\over 1-p}\left(\sum_{y=0}^{\infty}y{y+(r+1)-1\choose y}p^{y}(1-p)^{r+1}+\sum_{y=0}^{\infty}{y+(r+1)-1\choose y}p^{y}(1-p)^{r+1} \right)\\ &= {rp\over 1-p}\left({(r+1)p\over 1-p} + 1\right)\quad\quad\quad\quad\quad\quad(Y\sim\mbox{NB}(r+1; p),\ E[Y] = {(r+1)p\over1-p})\\ &= {rp\over 1-p}\cdot{rp+1\over 1-p} \end{align*} $$ Thus the variance is $$ \begin{align*} \mbox{Var}(X) &= E\left[X^2\right] - E[X]^2\\ &= {rp\over 1-p}\cdot{rp+1\over 1-p}- \left({rp\over 1-p}\right)^2\\ &= {rp\over 1-p}\left({rp+1\over 1-p} - {rp\over 1-p}\right)\\ &= {rp\over(1-p)^2} \end{align*} $$
Examples
1. Find the expected value and the variance of the number of times one must throw a die until the outcome 1 has occurred 4 times.
Solution:
Let $X$ be the number of times and $Y$ be the number of success in the trials. Obviously, we have $X = Y+4$. Then the problem can be rewritten as ``the expected value and the variance of the number of times one must throw a die until the outcome 1 has NOT occurred 4 times''. That is, $r = 4$, $p = {5\over 6}$ and $Y\sim\mbox{NB}(r; p)$. Thus $$E[X] = E[Y+4]= E[Y] + 4 = {rp\over 1-p}+4 = 24$$ $$\mbox{Var}(X) = \mbox{Var}(Y+4) = \mbox{Var}(Y) = {rp\over(1-p)^2}= 120$$
Reference
- Ross, S. (2010). A First Course in Probability (8th Edition). Chapter 4. Pearson. ISBN: 978-0-13-603313-4.
- Chen, H. Advanced Statistical Inference. Class Notes. PDF
基本概率分布Basic Concept of Probability Distributions 4: Negative Binomial Distribution的更多相关文章
- 基本概率分布Basic Concept of Probability Distributions 5: Hypergemometric Distribution
PDF version PMF Suppose that a sample of size $n$ is to be chosen randomly (without replacement) fro ...
- 基本概率分布Basic Concept of Probability Distributions 1: Binomial Distribution
PDF下载链接 PMF If the random variable $X$ follows the binomial distribution with parameters $n$ and $p$ ...
- 基本概率分布Basic Concept of Probability Distributions 8: Normal Distribution
PDF version PDF & CDF The probability density function is $$f(x; \mu, \sigma) = {1\over\sqrt{2\p ...
- 基本概率分布Basic Concept of Probability Distributions 7: Uniform Distribution
PDF version PDF & CDF The probability density function of the uniform distribution is $$f(x; \al ...
- 基本概率分布Basic Concept of Probability Distributions 6: Exponential Distribution
PDF version PDF & CDF The exponential probability density function (PDF) is $$f(x; \lambda) = \b ...
- 基本概率分布Basic Concept of Probability Distributions 3: Geometric Distribution
PDF version PMF Suppose that independent trials, each having a probability $p$, $0 < p < 1$, o ...
- 基本概率分布Basic Concept of Probability Distributions 2: Poisson Distribution
PDF version PMF A discrete random variable $X$ is said to have a Poisson distribution with parameter ...
- PRML Chapter 2. Probability Distributions
PRML Chapter 2. Probability Distributions P68 conjugate priors In Bayesian probability theory, if th ...
- Common Probability Distributions
Common Probability Distributions Probability Distribution A probability distribution describes the p ...
随机推荐
- 一道经典JS题(关于this)
项目中碰到的问题,以前也碰到过,没有重视,现记录如下. <input type='button' value='click me' id='btn' /> <script> v ...
- ASP.NET Web API 实现客户端Basic(基本)认证 之简单实现
优点是逻辑简单明了.设置简单. 缺点显而易见,即使是BASE64后也是可见的明文,很容易被破解.非法利用,使用HTTPS是一个解决方案. 还有就是HTTP是无状态的,同一客户端每次都需要验证. 实现: ...
- go-- 用go-mssql驱动连接sqlserver数据库
import _ "github.com/denisenkom/go-mssqldb" import ( "crypto/cipher" "crypt ...
- [转]Java使用commons-dbcp2.0
原文地址:http://blog.csdn.net/jiutianhe/article/details/39670817 dbcp 是 apache 上的一个 java 连接池项目,也是 tomcat ...
- 【UOJ #150】【NOIP 2015】运输计划
http://uoj.ac/problem/150 用树链剖分求lca,二分答案树上差分判断. 时间复杂度$O(nlogn)$,n,m同阶. #include<cstdio> #inclu ...
- 【BZOJ 1568】【JSOI 2008】Blue Mary开公司
经典的splay维护凸壳,但是看了看zky学长的题解最后决定写线段树维护标记永久化. Round1考到了这个之后一直没有理解标记永久化,CTSC也因为自己的缺陷丢掉了一些部分分,so sad 看来以后 ...
- 【BZOJ 3053】The Closest M Points
KDTree模板,在m维空间中找最近的k个点,用的是欧几里德距离. 理解了好久,昨晚始终不明白那些“估价函数”,后来才知道分情况讨论,≤k还是=k,在当前这一维度距离过线还是不过线,过线则要继续搜索另 ...
- 【BZOJ 4518】【SDOI 2016 Round1 Day2 T3】征途
比较明显的斜率优化DP,省选时因为时间太紧张和斜率DP写得不熟等原因只写了60分的暴力DP,其实当时完全可以对拍来检验标算的正确,但是我当时too naive- 很快打完了,调了将近一晚上QAQ,因为 ...
- ES6新特性:let和const的使用
(声明, 本文的所有代码均在node的最新稳定版本v4.4.3中执行的, 如果在浏览器中执行请把JS的运行环境提升为ES6) 以前一直用var定义变量, 现在有了两种新的定义变量的方式, 1: let ...
- mysql解决无法远程客户端连接
1. 改表法.可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 " ...