[Gamma Distribution] Generate random number according to Gamma Distribution

#1
Hi,
I request your help / suggestion to solve the following problem

Suppose X_i, i=1,2,...,n are exponential RVs with mean 1/k. If the triggering event X_0 occurred at t_0, then probability of occurring X_n is given by

Pr (X_n occurred between t ant t+dt | X_0 occurred at t_0) =

( k[k(t-t_0)]^{n-1} . exp[-k(t-t_0)] . dt ) / (n-1)!

I can generate number according to standard Gamma distribution with paramters k and n.

But how I can generate random numbers according to the above distribution?

Thank you very much for your attention.

Cheers!
 

BGM

TS Contributor
#2
But how I can generate random numbers according to the above distribution
Not sure which random number you are referring to.

You have put down a gamma (erlang) distribution pdf and this is the distribution of the arrival time of a Poisson process. So as you have mentioned, you know how to simulate this arrival time. On the other hand, if you want to simulate the number of occurrence before a particular time, you will need the Poisson distribution.
 
#3
Not sure which random number you are referring to.

You have put down a gamma (erlang) distribution pdf and this is the distribution of the arrival time of a Poisson process. So as you have mentioned, you know how to simulate this arrival time. On the other hand, if you want to simulate the number of occurrence before a particular time, you will need the Poisson distribution.
Thanks a lot for your reply. I want to simulate the arrival time rather the number of occurrence before a particular time. I want to know what will be the difference between

Pr (X_n occurred between t ant t+dt | X_0 occurred at t_0) =
( k[k(t-t_0)]^{n-1} . exp[-k(t-t_0)] . dt ) / (n-1)!

and

Pr (X_n occurred between t ant t+dt) =
( k[k t]^{n-1} . exp[-k t] . dt ) / (n-1)!


Thanks once again.
 

BGM

TS Contributor
#4
Oh I see your question. Let \( T \) be the occurrence time that you want to simulate.

The former set up is a location-shifted gamma - \( T - t_0 \) follows a gamma distribution. To simulate this, you simply simulate the corresponding gamma distribution and then add the constant \( t_0 \).

In the later set up is a gamma which you can simulate it directly.