基本概率分布Basic Concept of Probability Distributions 3: Geometric Distribution
PMF
Suppose that independent trials, each having a probability $p$, $0 < p < 1$, of being a success, are performed until a success occurs. If we let $X$ equal the number of failures required, then the geometric distribution mass function is $$f(x; p) =\Pr(X=x) = (1-p)^{x}p$$ for $x=0, 1, 2, \cdots$.
Proof:
$$ \begin{align*} \sum_{x=0}^{\infty}f(x; p) &= \sum_{x=0}^{\infty}(1-p)^{x}p\\ &= p\sum_{x=0}^{\infty}(1-p)^{x}\\ & = p\cdot {1\over 1-(1-p)}\\ & = 1 \end{align*} $$
Mean
The expected value is $$\mu = E[X] = {1-p\over p}$$
Proof:
Firstly, we know that $$\sum_{x=0}^{\infty}p^x = {1\over 1-p}$$ where $0 < p < 1$. Thus $$ \begin{align*} {d\over dp}\sum_{x=0}^{\infty}p^x &= \sum_{x=1}^{\infty}xp^{x-1}\\ &= {1\over(1-p)^2} \end{align*} $$ The expected value is $$ \begin{align*} E[X] &= \sum_{x=0}^{\infty}x(1-p)^{x}p\\ &=p(1-p)\sum_{x=1}^{\infty}x(1-p)^{x-1}\\ &= p(1-p){1\over(1-(1-p))^2}\\ &= {1-p\over p} \end{align*} $$
Variance
The variance is $$\sigma^2 = \mbox{Var}(X) = {1-p\over p^2}$$
Proof:
$$ \begin{align*} E\left[X^2\right] &=\sum_{x=0}^{\infty}x^2(1-p)^{x}p\\ &= (1-p)\sum_{x=1}^{\infty}x^2(1-p)^{x-1}p \end{align*} $$ Rewrite the right hand summation as $$ \begin{align*} \sum_{x=1}^{\infty} x^2(1-p)^{x-1}p&= \sum_{x=1}^{\infty} (x-1+1)^2(1-p)^{x-1}p\\ &= \sum_{x=1}^{\infty} (x-1)^2(1-p)^{x-1}p + \sum_{x=1}^{\infty} 2(x-1)(1-p)^{x-1}p + \sum_{x=1}^{\infty} (1-p)^{x-1}p\\ &= E\left[X^2\right] + 2E[X] + 1\\ &= E\left[X^2\right] + {2-p\over p} \end{align*} $$ Thus $$E\left[X^2\right] = (1-p)E\left[X^2\right] + {(1-p)(2-p) \over p}$$ That is $$E\left[X^2\right]= {(1-p)(2-p)\over p^2}$$ So the variance is $$ \begin{align*} \mbox{Var}(X) &= E\left[X^2\right] - E[X]^2\\ &= {(1-p)(2-p)\over p^2} - {(1-p)^2\over p^2}\\ &= {1-p\over p^2} \end{align*} $$
Examples
1. Let $X$ be geometrically distributed with probability parameter $p={1\over2}$. Determine the expected value $\mu$, the standard deviation $\sigma$, and the probability $P\left(|X-\mu| \geq 2\sigma\right)$. Compare with Chebyshev's Inequality.
Solution:
The geometric distribution mass function is $$f(x; p) = (1-p)^{x}p,\ x=0, 1, 2, \cdots$$ The expected value is $$\mu = {1-p\over p} = 1$$ The standard deviation is $$\sigma = \sqrt{1-p\over p^2} = 1.414214$$ The probability that $X$ takes a value more than two standard deviations from $\mu$ is $$P\left(|X-1| \geq 2.828428\right) = P(X\geq 4) = 0.0625$$ R code:
1 - sum(dgeom(c(0:3), 1/2))
# [1] 0.0625
Chebyshev's Inequality gives the weaker estimation $$P\left(|X - \mu| \geq 2\sigma\right) \leq {1\over4} = 0.25$$
2. A die is thrown until one gets a 6. Let $V$ be the number of throws used. What is the expected value of $V$? What is the variance of $V$?
Solution:
The PMF of geometric distribution is $$f(x; p) = (1-p)^xp,\ = 0, 1, 2, \cdots$$ where $p = {1\over 6}$. Let $X = V-1$, so the expected value of $V$ is $$ \begin{align*} E[V] &= E[X+1]\\ &= E[X] + 1\\ &= {1-p\over p} + 1\\ &= {1-{1\over6} \over {1\over6}} + 1\\ &= 6 \end{align*} $$ The variance of $V$ is $$ \begin{align*} \mbox{Var}(V) &= \mbox{Var}(X+1)\\ &= \mbox{Var}(X)\\ &= {1-p\over p^2}\\ &= {1-{1\over 6} \over \left({1\over6}\right)^2}\\ &= 30 \end{align*} $$ Note that this is another form of the geometric distribution which is so-called the shifted geometric distribution (i.e. $X$ equals to the number of trials required). By the above process we can see that the expected value of the shifted geometric distribution is $$\mu = {1\over p}$$ and the variance of the shifted geometric distribution is $$\sigma^2 = {1-p\over p^2}$$
3. Assume $W$ is geometrically distributed with probability parameter $p$. What is $P(W < n)$?
Solution:
$$ \begin{align*} P(W < n) &= 1 - P(W \geq n)\\ &= 1-(1-p)^n \end{align*} $$
4. In order to test whether a given die is fair, it is thrown until a 6 appears, and the number $n$ of throws is counted. How great should $n$ be before we can reject the null hypothesis $$H_0: \mbox{the die is fair}$$ against the alternative hypothesis $$H_1: \mbox{the probability of having a 6 is less than 1/6}$$ at significance level $5\%$?
Solution:
The probability of having to use at least $n$ throws given $H_0$ (i.e. the significance probability) is $$P = \left(1 - {1\over 6}\right) ^n$$ We will reject $H_0$ if $P < 0.05$. R code:
n = 1
while (n > 0){
+ p = (5/6) ^ n
+ if (p < 0.05) break
+ n = n + 1
+ }
n
# [1] 17
That is, we have to reject $H_0$ if $n$ is at least 17.
Reference
- Ross, S. (2010). A First Course in Probability (8th Edition). Chapter 4. Pearson. ISBN: 978-0-13-603313-4.
- Brink, D. (2010). Essentials of Statistics: Exercises. Chapter 5 & 10. ISBN: 978-87-7681-409-0.
基本概率分布Basic Concept of Probability Distributions 3: Geometric Distribution的更多相关文章
- 基本概率分布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 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 2: Poisson Distribution
PDF version PMF A discrete random variable $X$ is said to have a Poisson distribution with parameter ...
- 基本概率分布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 4: Negative Binomial Distribution
PDF version PMF Suppose there is a sequence of independent Bernoulli trials, each trial having two p ...
- 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 ...
随机推荐
- lecture3-线性神经元和算法
Hinton第三课 这节课主要是介绍NN的输出端常用的神经元,然后重点是说明怎么使用BP来计算偏导数,在Hinton这一课中,他提供了他1986年参与写的<并行分布处理>一书的第8章,49 ...
- windows 下 redis for php 配置
下载 redis,下载地址 https://github.com/dmajkic/redis/downloads,下载下来 zip 文件,解压,根据系统选择解压的文件夹(比如我的是 64bit). 我 ...
- Web Worker 是什么鬼?
前言 前端工程师们一定有过这样的体验,当一个页面加载了大量的 js 文件时,用户界面可能会短暂地"冻结".这很好理解,因为 js 是单线程的语言.我们再走的极端点,一段 js 中出 ...
- .net程序员转行做手游开发经历(二)
上篇主要介绍自己个人的经历,这篇主要讲下学习新语言的过程. 上次说到最终选择的语言是swift,框架用spritekit,上次有网友对为什么选择用这俩呢,为什么不用cocos和unity呢,cocos ...
- 编程中的offsetof
linux和windows平台都已经定义了offsetof函数,用于取struct类型中某个变量的偏移量 在stddef.h头文件中,该宏的完整说明如下: #ifdef __cplusplus #if ...
- 手把手教你在Windows下搭建React Native Android开发环境
最近看到React Native好像好厉害的样子,好奇心驱使之下体验了一下并将在Window下搭建React Natvie Android环境的步骤记录下来,并有需要的朋友参考.(我都是参考官方文档的 ...
- 移动OA,致我们终将逝去的青春(程序员版)[转]
移动OA和致青春有什么关系,难道说赵薇也来做手机应用了?为什么不行,当年小燕子代言的打印机可是红火的很,现在再秀一把时尚手机办公也未必不可啊.言归正转,本文还是以点代面阐述移动OA开发过程,但是,它的 ...
- hihocoder [Offer收割]编程练习赛4
描述 最近天气炎热,小Ho天天宅在家里叫外卖.他常吃的一家餐馆一共有N道菜品,价格分别是A1, A2, ... AN元.并且如果消费总计满X元,还能享受优惠.小Ho是一个不薅羊毛不舒服斯基的人,他希望 ...
- equals()的用法
比如,两个对象 c1, c2; 那么,c1.equals(c2) == true; 则表示c1, c2两个变量的值是一致的 equals适用于所有对象,这是一种特殊方法 equals这种表现形式我们一 ...
- 从scrapy使用经历说开来
关于scrapy这个Python框架,萌萌的官网这么介绍: An open source and collaborative framework for extracting the data you ...