Generating Poisson-distributed random variables

https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables

https://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/

https://hpaulkeeler.com/simulating-poisson-random-variables-direct-method/

Here’s the idea behind the algorithm. The time between arrivals in a Poisson process is exponentially distributed. Count how many arrivals there are in an interval by simulating the times between arrivals and adding them up until the time sum spills over the interval.

泊松过程的到达时间是指数分布的。通过模拟到达之间的时间来计算一个间隔内有多少到达,并将它们相加,直到时间总和溢出该间隔

第一个到达的时间是x1 ,第二个达到与第一个到达的时间是x2,........则\sum x_{i}<1的数量(在单位时间内有多少个到达)有多少个;

而服从泊松分布的时间间隔服从指数分布:

x1 是一个服从指数分布的随机变量,

已知分布概率,如何以此概率生成服从此分布的随机变量?

https://blog.csdn.net/zhxue123/article/details/3859512

指数分布的概率密度函数     y=lamda*exp(-lamda*x)       x>=0  
  由此可以计算概率分布函数         y=1-exp(-lamda*x)       x>=0  
  y是   X<x的概率,其取值在区间(0,1)内  
   
  首先,把y当作是在(0,1)区间的均匀分布的随机变量。  
  然后,求y=1-exp(-lamda*x)的逆函数,x=-(1/lamda)*ln(1-y)  
   
  令z=1-y,显然z也是(0,1)区间的均匀分布的随机变量,于是就有x=-(1/lamda)*ln(z)。
 

But, as I said before, don’t use this code instead of the inbuilt function poissrnd.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值