How to simulate a Poisson-distributed random sample
- From: "\"Luis A. Afonso\"" <licas_@xxxxxxxxxxx>
- Date: Sat, 09 Apr 2005 11:38:16 EDT
How to simulate a Poisson-distributed random sample
To get the samples is the first thing to do in Monte Carlo simulations.
The Principle (X distributed as the Poisson Law).
Let be a random r and C(k)= prob(X=k) If the following condition is
verified between the cumulative probabilities.
C (j +1) < r < C (j)
then X=j.
Preliminaries (for all the samples):
To get C(k+1) I use C(k+1) = C(k) + prob(X=k+1)
To get prob(X= k+1 ):
prob(X=k+1) = prob (X=k) * m / (k+1)
where m is the distribution parameter (the mean value).
starting by p(X=0) = exp(-m).
I find k (for each random) by successive tentative trials,
If random < C(0) then k=0
If < C(1) then k=1
If < C(2) then k=2
Etc.
The first time that random<C(w) I find X=w and the
search stops.
Then other random is called and the procedure repeated.
Licas_@xxxxxxxx
.
- Prev by Date: Re: Simulating a data sample with given mean and std
- Next by Date: Re: P-value from chi-square value: source code
- Previous by thread: The union of three events
- Next by thread: C Code to fit weighted least squares
- Index(es):
Relevant Pages
|