当前位置:网站首页>MCS:离散随机变量——几何分布
MCS:离散随机变量——几何分布
2022-06-29 14:39:00 【今晚打佬虎】
Geometric
几何分布(Geometric distribution)是离散型概率分布。其中一种定义为:在 n n n次伯努利试验中,试验 k k k次才得到第一次成功的机率。详细地说,是:前 k − 1 k-1 k−1次皆失败,第 k k k次成功的概率,每次实验中成功的概率 p p p保持不变。几何分布是帕斯卡分布当 r = 1 r=1 r=1时的特例。
P ( k ) = p ( 1 − p ) k − 1 , k = 1 , 2 , . . . P(k) = p(1 - p)^{k - 1} , k = 1, 2,... P(k)=p(1−p)k−1,k=1,2,...
F ( k ) = 1 − ( 1 − p ) k , k = 1 , 2 , . . . F(k) = 1 - (1 - p)^k,k = 1, 2, ... F(k)=1−(1−p)k,k=1,2,...
E ( k ) = 1 p E(k) = \frac{1}{p} E(k)=p1
V ( k ) = 1 − p p 2 V(k) = \frac{1 - p}{p^2} V(k)=p21−p
当变量 x ′ x' x′定义为实验第一次成功时失败的次数, x ′ = k − 1 x' = k - 1 x′=k−1:
P ( x ′ ) = p ( 1 − p ) x ′ P(x') = p(1 - p)^{x'} P(x′)=p(1−p)x′
F ( x ′ ) = 1 − ( 1 − p ) x ′ + 1 F(x') = 1 - (1 - p)^{x'+1} F(x′)=1−(1−p)x′+1
E ( x ′ ) = E ( x ) − 1 = ( 1 − p ) / p E(x') = E(x) - 1 = (1 - p)/p E(x′)=E(x)−1=(1−p)/p
V ( x ′ ) = V ( x ) = ( 1 − p ) / p 2 V(x') = V(x) = (1 - p)/p^2 V(x′)=V(x)=(1−p)/p2
生成几何分布的随机变量 k k k:
- 生成随机连续均匀变量: u ∼ U ( 0 , 1 ) u \sim U(0,1) u∼U(0,1)
- x = i n t [ l n ( 1 − u ) l n ( 1 − p ) ] + 1 x = int[\frac{ln(1 - u)}{ln(1 - p)}] + 1 x=int[ln(1−p)ln(1−u)]+1
例:假设一个实验成功的概率为 p = 0.2 p = 0.2 p=0.2,随机几何变量 x x x为该实验第一次成功是尝试的次数,生成一个随机几何变量:
- 生成随机均匀变量: u ∼ U ( 0 , 1 ) , u = 0.27 u \sim U(0, 1),u = 0.27 u∼U(0,1),u=0.27
- x = i n t ( l n ( 1 − 0.27 ) / l n ( 1 − 0.2 ) ) + 1 = 2 x = int(ln(1 - 0.27)/ln(1 - 0.2)) + 1 = 2 x=int(ln(1−0.27)/ln(1−0.2))+1=2
模拟生成随机几何变量
import numpy as np
import matplotlib.pyplot as plt
def generate_geometric(p=0.1):
u = np.random.uniform(0, 1)
x = int(np.log(1 - u)/ np.log(1 - p)) + 1
return x

边栏推荐
- [blackduck] configure the specified Synopsys detect scan version under Jenkins
- 他山之石 | 丁香园 医疗领域图谱的构建与应用
- June 27 talk SofiE
- Trigonometric function corresponding to drawing circle on plane coordinate
- 面试突击61:说一下MySQL事务隔离级别?
- Analysis of constant current source circuit composed of two NPN tubes
- k8s部署redis哨兵
- 在平面坐标上画斜线
- 捷氢科技冲刺科创板:拟募资10.6亿 上汽集团是大股东
- Build your own website (19)
猜你喜欢

Alibaba cloud experience Award: use polardb-x and Flink to build a large real-time data screen

《canvas》之第12章 其他应用

二级指针

Configuration tutorial for swagger2

Yi Ming ang Ke rushed to Hong Kong shares: loss of 730million in the year Lilly and sunshine life insurance were shareholders

Mysql database - general syntax DDL DML DQL DCL

How bad can a programmer be?

第五届中国软件开源创新大赛 | openGauss赛道直播培训

在平面坐标上画斜线

curl: (56) Recv failure: Connection reset by peer
随机推荐
Redis installation in windows and Linux Environment
[Verilog quick start of Niuke online question series] ~ shift operation and multiplication
校园转转二手市场源码
自动注入@Resource和@Autowired注解的区别:
两个字的名字如何变成有空格的3个字符的名字
Are the top ten domestic securities companies safe?
华理生物冲刺科创板:年营收2.26亿 拟募资8亿
Indice d'évaluation du logiciel hautement simultané (site Web, interface côté serveur)
Mysql database - general syntax DDL DML DQL DCL
Evaluation index of high concurrency software (website, server interface)
EMC-浪涌防护及退耦设计
Weigao blood purification sprint to Hong Kong: annual revenue of RMB 2.9 billion, net profit decreased by 12.7%
Chapter 13 event operation of canvas
Laravel - Composer 安装指定 Laravel 版本
Uncover the secret! Pay attention to those machines under the membership system!
QRcode custom QR code middle picture
阿里云体验有奖:使用PolarDB-X与Flink搭建实时数据大屏
揭秘!付费会员制下的那些小心机!
关于项目采购管理,这些你需要知道
Chapter 9 of canvas: gradients and shadows