当前位置:网站首页>MCS: discrete random variable Poisson distribution
MCS: discrete random variable Poisson distribution
2022-06-29 15:13:00 【Fight the tiger tonight】
Poisson
When the event is within a specified time interval ( Unit time ), At a fixed average instantaneous rate ( The average number of occurrences ) θ \theta θ happen , Then the variable describing the number of events per unit time is Poisson variable . Poisson distribution is suitable for describing the number of random events per unit time , for example : The number of vehicles passing the intersection per minute ; The number of passengers waiting at the station every hour ;
P ( x ) = θ x e − θ x ! , x = 0 , 1 , 2 , . . . P(x) = \frac{\theta^x e^{-\theta}}{x!},x = 0, 1, 2, ... P(x)=x!θxe−θ,x=0,1,2,...
Expectation and variance :
E ( x ) = θ E(x) = \theta E(x)=θ
V ( x ) = θ V(x) = \theta V(x)=θ
Poisson variable & Exponential variable : t t t
E ( t ) = 1 θ E(t) = \frac{1}{\theta} E(t)=θ1
Generate random Poisson variables
Generate random Poisson variables x x x, And E ( x ) = V ( x ) = θ E(x) = V(x) = \theta E(x)=V(x)=θ
- Make x = 0 , i = 0 , S t = 0 x = 0, i = 0, S_t = 0 x=0,i=0,St=0
- i = i + 1 i = i + 1 i=i+1, Generate random exponential variables : t t t, And E ( t ) = 1 / θ E(t) = 1/\theta E(t)=1/θ, S t = S t + t S_t = S_t + t St=St+t
- if S t > 1 S_t > 1 St>1, → s t e p 5 \to step5 →step5
- if S t < = 1 , x = x + 1 S_t <= 1, x = x + 1 St<=1,x=x+1, → s t e p 2 \to step2 →step2
- Return x x x
example : hypothesis x x x Is a random variable subject to Poisson distribution , The expected number of events per unit time is θ = 2.4 \theta = 2.4 θ=2.4, Let's use the exponential variable t t t,( E ( t ) = 1 / 2.4 E(t) = 1/2.4 E(t)=1/2.4) To generate Poisson variables :
- Make x = 0 , S t = 0 x = 0, S_t = 0 x=0,St=0
- i = 1 , t = 0.21 , S t = 0.21 , x = 1 i = 1,t = 0.21,S_t = 0.21,x = 1 i=1,t=0.21,St=0.21,x=1
- i = 2 , t = 0.43 , S t = 0.64 , x = 2 i = 2,t = 0.43,S_t = 0.64,x = 2 i=2,t=0.43,St=0.64,x=2
- i = 3 , t = 0.09 , S t = 0.73 , x = 3 i = 3,t = 0.09,S_t = 0.73,x = 3 i=3,t=0.09,St=0.73,x=3
- i = 4 , t = 0.31 , S t = 1.04 , x = 4 i = 4,t = 0.31,S_t = 1.04,x = 4 i=4,t=0.31,St=1.04,x=4
- x = 3 x = 3 x=3
example : One 24 A gas station that is open 24 hours , Every day 200-300 A car came here to refuel , among 80% It's a car ,15% It's a truck ,5% It's a motorcycle . The minimum gasoline consumption per car is 3 Gallon , The average is 11 Gallon . Trucks consume at least 8 Gallon , The average is 20 Gallon . Motorcycles consume at least 2 Gallon , The average is 4 Gallon . Analysts want to figure out the distribution of the total consumption of gas stations in a day .
Simulate the future with random numbers 1000 God , Gasoline consumption in gas stations , The type of vehicle and the amount of fuel consumed are generated by random numbers .
- Record analog data , Total fuel consumption per day G G G
- Sort from small to large , G ( 1 ) < = G ( 2 ) < = G ( 3 ) < = . . . G ( 1000 ) G(1) <= G(2) <= G(3) <= ...G(1000) G(1)<=G(2)<=G(3)<=...G(1000)
- Estimated quantile : G ( p × 1000 ) G(p \times 1000) G(p×1000), p = 0.01 , G ( 0.01 × 1000 ) = G ( 10 ) p = 0.01, G(0.01 \times 1000) = G(10) p=0.01,G(0.01×1000)=G(10)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def gas_consum_oneday():
num_vehicle = np.clip(np.random.poisson(300), 200, 500)
num_cars = int(num_vehicle * 0.8)
num_trucks = int(num_vehicle * 0.15)
num_motos = num_vehicle - (num_cars + num_trucks)
car_consume = [np.random.randint(3, 19) for i in range(num_cars)]
truck_consume = [np.random.randint( 8, 32) for i in range(num_trucks)]
moto_consume = [np.random.randint( 2, 6) for i in range(num_motos)]
sum_gas = np.sum(car_consume + truck_consume + moto_consume)
return num_vehicle, num_cars, num_trucks, num_motos, sum_gas
| vehicle_record | cars_record | trucks_record | motos_record | gas_record | P | |
|---|---|---|---|---|---|---|
| 9 | 201 | 160 | 30 | 11 | 2362 | 0.01 |
| 49 | 202 | 161 | 30 | 11 | 2447 | 0.05 |
| 99 | 213 | 170 | 31 | 12 | 2498 | 0.10 |
| 199 | 215 | 172 | 32 | 11 | 2617 | 0.20 |
| 299 | 228 | 182 | 34 | 12 | 2723 | 0.30 |
| 399 | 245 | 196 | 36 | 13 | 2841 | 0.40 |
| 499 | 254 | 203 | 38 | 13 | 2965 | 0.50 |
| 599 | 259 | 207 | 38 | 14 | 3089 | 0.60 |
| 699 | 262 | 209 | 39 | 14 | 3199 | 0.70 |
| 799 | 276 | 220 | 41 | 15 | 3332 | 0.80 |
| 899 | 288 | 230 | 43 | 15 | 3468 | 0.90 |
| 949 | 297 | 237 | 44 | 16 | 3536 | 0.95 |
| 989 | 299 | 239 | 44 | 16 | 3616 | 0.99 |
Simulation results :
- The daily oil consumption exceeds 3536 The probability of gallons is :5%
- The daily fuel consumption exceeds 3616 The probability of gallons is :1%
- Daily fuel consumption 90% The interval is : P ( 2447 < = G < = 3536 ) = 0.90 P(2447 <= G <= 3536) = 0.90 P(2447<=G<=3536)=0.90
边栏推荐
- Informatics Olympiad all in one 1194: mobile route
- symfony框架安全组件(security)防火墙配置
- Create an API rapid development platform, awesome!
- Ink drop typesetting
- Chapter IX app project test (4) test tools
- Konva series Tutorial 4: drawing attributes
- Biovendor free light chain( κ and λ) Chemical properties of ELISA Kit
- 信息学奥赛一本通2062:电影票
- PostgreSQL learning (based on rookie course)
- 高並發軟件(網站,服務器端接口)的評價指標
猜你喜欢

【牛客网刷题系列 之 Verilog快速入门】~ 移位运算与乘法

Lumiprobe 点击化学丨非荧光炔烃:己酸STP酯

synchronized 与多线程的哪些关系

Render follows, encapsulating a form and adding data to the table

Knowledge points: what are the know-how of PCB wiring?

Northwestern Polytechnic University attacked by overseas e-mail

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

Chinese garbled code output from idea output station

Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear

MCS:离散随机变量——Binomial分布
随机推荐
MCS:离散随机变量——Binomial分布
Digital IC code -- traffic lights
Draw a slash on a plane coordinate
message from server: “Host ‘xxxxxx‘ is blocked because of many connection errors; unblock with ‘m
Configuration tutorial for swagger2
Solidworks零件图存放位置更改后装配图识别不出来的解决办法
How bad can a programmer be?
Query function of Excel vlookup
Whitelabel error page access
ROS 笔记(10)— launch 文件启动
You need to know about project procurement management
西北工业大学遭境外电邮攻击
Biovendor free light chain( κ and λ) Chemical properties of ELISA Kit
威高血液净化冲刺香港:年营收29亿 净利降12.7%
第九章 APP项目测试(4) 测试工具
信息学奥赛一本通1194:移动路线
信息学奥赛一本通1001:Hello,World!
If I am in Foshan, where can I open an account? Is it safe to open an account online?
Lumiprobe 活性染料丨环炔染料:AF488 DBCO,5 异构体
JS will have variable promotion and function promotion