当前位置:网站首页>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

边栏推荐
- Are the top ten domestic securities companies safe?
- 模电 2个NPN管组成的恒流源电路分析
- Kubernetes pod troubleshooting guide
- Heavyweight! The latest SCI impact factors were released in 2022, and the ranking of the three famous journals NCS and the top10 of domestic journals has changed (the latest impact factors in 2022 are
- 类模板案例-【数组类封装】
- Imitation headline news information DZ template discuz news information business version GBK template source code
- 《canvas》之第11章 canvas状态
- Chinese garbled code output from idea output station
- 墨滴排版
- Huali biology rushes to the scientific innovation board: the annual revenue is RMB 226million and it is planned to raise RMB 800million
猜你喜欢

Source code of campus secondary market

两个字的名字如何变成有空格的3个字符的名字

What should phpcms do when it sends an upgrade request to the official website when it opens the background home page?

驱动器实际运用案例

The 5th China software open source innovation competition | opengauss track live training

Configuration tutorial for swagger2

June 27 talk SofiE

网易严选离线数仓质量建设实践

文本预处理库spaCy的基本使用(快速入门)

Jet hydrogen technology rushes to the scientific innovation board: SAIC Group is the major shareholder to raise 1.06 billion yuan
随机推荐
Chapter 12 other applications of canvas
《canvas》之第11章 canvas状态
Methods of accessing external services in istio grid
Digital IC code -- traffic lights
《canvas》之第8章 像素操作
[Jenkins] pipeline controls the sequential execution of multiple jobs for timed continuous integration
Source code of campus secondary market
Chapter 8 pixel operation of canvas
k8s部署redis哨兵
在平面坐标上画斜线
I want to search the hundreds of nodes in the data warehouse. Can I check a table used in the SQL
Chapter 10 of canvas path
Interview shock 61: tell me about MySQL transaction isolation level?
阿尔兹海默病智能诊断
[practical chapter of correlation analysis] why can't Bi software do correlation analysis
Why is redis so fast? Is redis single threaded or multi-threaded?
PostgreSql学习(基于菜鸟课程)
QRcode custom QR code middle picture
《canvas》之第9章 渐变与阴影
Huali biology rushes to the scientific innovation board: the annual revenue is RMB 226million and it is planned to raise RMB 800million