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

边栏推荐
- The 5th China software open source innovation competition | opengauss track live training
- VQA needs not only pictures, but also external knowledge! University of Washington & Microsoft proposed revive, using gpt-3 and wikidata to help answer questions
- How bad can a programmer be?
- 阿尔兹海默病智能诊断
- 熊市慢慢,Bit.Store提供稳定Staking产品助你穿越牛熊
- If I am in Foshan, where can I open an account? Is it safe to open an account online?
- Chapter 10 of canvas path
- MySQL中100w数据表比1000w数据表查询更快吗?
- 云上第一课 | 建个小破站有多简单?云计算老司机带你一小时搞定
- Transport layer user datagram protocol (UDP)
猜你喜欢

模电 2个NPN管组成的恒流源电路分析

阿尔兹海默病智能诊断

You need to know about project procurement management

phpcms打开后台首页时向官网发送升级请求觉得卡怎么办?

【Try to Hack】vulnhub DC2

Redis installation in windows and Linux Environment

Uncover the secret! Pay attention to those machines under the membership system!

华理生物冲刺科创板:年营收2.26亿 拟募资8亿

FIFO implementation with single port RAM

Thanos store component
随机推荐
MySQL 数据库 - 通用语法 DDL DML DQL DCL
Draw a slash on a plane coordinate
QRcode custom QR code middle picture
技术沟通遇到3个为什么背后的逻辑
《canvas》之第7章 变形操作
高並發軟件(網站,服務器端接口)的評價指標
Huashu high tech rushes to the scientific innovation board: the actual controller xuxiaoshu and his son, who plan to raise 660million yuan, are both American nationals
Transport layer user datagram protocol (UDP)
Alibaba cloud experience Award: use polardb-x and Flink to build a large real-time data screen
const用法精讲
我想在数仓的几百个节点里面 查找一个都有哪些sql里面用到了某张表 能查吗
【Try to Hack】vulnhub DC2
Whitelabel Error Page访问
《canvas》之第6章 图片操作
Huali biology rushes to the scientific innovation board: the annual revenue is RMB 226million and it is planned to raise RMB 800million
Analysis of istio -- observability
利用多态实现简单的计算器
[QT tutorial] QPushButton key and double click effect
【牛客网刷题系列 之 Verilog快速入门】~ 移位运算与乘法
Stm32 mbed tutorial (IV) --pwm