0% found this document useful (0 votes)
3 views4 pages

Experiment Estimation

The document outlines a method for generating random variables from a Poisson distribution with a parameter of λ=1.6 using the inverse transform algorithm. It provides a step-by-step algorithm, R code, and results of 10 generated random variables. The final output of the experiment shows the generated random numbers as 0, 1, 1, 2, 0, 1, 0, 2, 1, and 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Experiment Estimation

The document outlines a method for generating random variables from a Poisson distribution with a parameter of λ=1.6 using the inverse transform algorithm. It provides a step-by-step algorithm, R code, and results of 10 generated random variables. The final output of the experiment shows the generated random numbers as 0, 1, 1, 2, 0, 1, 0, 2, 1, and 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment No : Date Of Assignment :

Date Of Submission :

Topic : Generating Random Variable from Poisson Distribution

Question : Generate 10 random variables from Poisson (), =1.6

Theory And Solution :

Here, we shall use the discrete version of the inverse algorithm to generate 20 random variables
from the Poisson Distribution.

The PMF of a random variable ‘X’ following Poisson Distribution with parameter ‘’ is
given by:
i

e−¿❑
P ( X=i ) = ¿
i!

The key to using the inverse algorithm transform method to generate such a random variable is to
the following identity.

Pi+1 = ❑ Pi ; i = 0,1,2,……
i +1

Upon using the recursion to complete the Poisson probability as they become needed , the
inverse transform for generating a poisson random variable with parameter ‘’ can be expressed
as follows :

# ALGORITHM

Step 1 : Generate a random number ‘u’ lying between ‘0’ and ‘1’.

Step 2 : For i = 0 , P=e−¿¿ ,F = P .

Step 3 : If U< F ,Set X = i and stop .

P
Step 4 : P= , F = F+P , i = i+1 .
i+1

Step 5 : Go to Step 3 .
The R-program is given by :

n=100

lambda=1.6

P=mat.or.vec(n+1,1)

F=mat.or.vec(n+1,1)

for(i in 1:n)

P[1]=exp(-lambda)

P[i+1]=((lambda)/(i+1))*P[i]

F[1]=P[1]

F[i+1]=F[i]+P[i+1]}

U1<-runif(15,0,F[n])

[1] 0.2018965 0.3634137 0.4495562 0.4840133 0.4950395 0.4979798 0.4986519 0.4987863


0.4988102 0.4988140 0.4988146 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[17] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[33] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[49] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[65] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[81] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147

[97] 0.4988147 0.4988147 0.4988147 0.4988147 0.4988147


U1

[1] 0.07062773 0.30135070 0.41854299 0.41156093 0.44938069 0.04225947 0.28001845


0.43075855 0.23342872 0.45121622 0.38656024 0.11397230 0.46729100 0.18377705

[15] 0.27531164

The 15 Random Numbers selected are :

0.07062773 0.30135070 0.41854299 0.41156093 0.44938069 0.04225947 0.28001845


0.43075855 0.23342872 0.45121622 0.38656024 0.11397230 0.46729100 0.18377705
0.27531164 .

Now, we construct the following table for generating the required numbers of random variable
from Poisson with  = 1.6

TABLE : 1

X F(x) F(x)=F(x+1)
0 0.2018965 0.2018965-0.3634137
1 0.3634137 0.3634137-0.4495562
2 0.4495562 0.4495562-0.4840133
3 0.4840133 0.4840133-0.4950395
4 0.4950395 0.4950395-0.4979798
5 0.4979798 0.4979798-0.4986519
6 0.4986519 0.4986519-0.4987863
7 0.4987863 0.4987863-0.4988102
8 0.4988102 0.4988102-0.4988140
9 0.4988140 0.4988140-0.4988146
10 0.4988146 0.4988146-0.4988147
11 0.4988147 0.4988147-0.4988147
12 0.4988147 0.4988147-0.4988147
13 0.4988147 0.4988147-0.4988147
14 0.4988147 0.4988147-0.4988147
15 0.4988147 0.4988147-0.4988147
16 0.4988147 0.4988147-0.4988147
17 0.4988147 0.4988147-0.4988147
18 0.4988147 0.4988147-0.4988147
19 0.4988147 0.4988147-0.4988147
TABLE : 2

Sl.No Random Number Selected Interval in which lies Value of x generated


from P(1.6)
1 0.07062773 - Invalid Selection
2 0.30135070 0.2018965-0.3634137 0
3 0.41854299 0.3634137-0.4495562 1
4 0.41156093 0.3634137-0.4495562 1
5 0.44938069 0.4495562-0.4840133 2
6 0.04225947 - Invalid Selection
7 0.28001845 0.2018965-0.3634137 0
8 0.43075855 0.3634137-0.4495562 1
9 0.23342872 0.2018965-0.3634137 0
10 0.45121622 0.4495562-0.4840133 2
11 0.38656024 0.3634137-0.4495562 1
12 0.11397230 - Invalid Selection
13 0.46729100 0.4495562-0.4840133 2
14 0.18377705 - Invalid Selection
15 0.27531164 0.2018965-0.3634137 0

CONCLUSION :

The 10 random numbers generated from Poisson (1.6) are :

0,1,1,2,0,1,0,2,1,2.

You might also like