written 5.6 years ago by | • modified 5.6 years ago |
Given mean $\lambda = 4$, $R_1 = 0.5389$, $R_2 = 0.0532$, $R_3 = 0.3492$
Iteration 1:
Set $x=0$ and $P = 1$
Generate a random number $R_1 \sim \cup (0,1)$
$\begin{aligned} \text { compure } P \cdot R_{1} & \Rightarrow 1(0.5389) \\ &=0.5389 \end{aligned}$
Set $P=p \cdot R_{1}=0.5389$
check $P \lt e^{-\lambda}$
i.e. $0.5389 \lt e^{-4}$
i.e. $0.5389 \lt 0.0183, \text{ false } \Rightarrow \text{reject x and} $
set $x=x+1=0+1,$ go to step 2
Iteration 2:
Generate a random number $R_2 \sim \cup (0,1)$
$\begin{aligned} \text { Compute } P \cdot R_{2} & \Rightarrow(0.5389) - (0.0532) \\ &=0.0286 \end{aligned}$
Check $P \lt e^{-\lambda}$
i.e, $0.0286 \lt e^{-4}$
$0.0286 \lt 0.0183, false \Rightarrow \text{reject x and}$
set $x=x+1=1+1=2$ go to step 2
Iteration 3:
Generate a random number $R_3 \sim \cup (0,1)$
$\begin{aligned} \text { Compute } P \cdot R_{3} & \Rightarrow(0.0286) - (0.3492) \\ &=0.0099\end{aligned}$
Check $P \lt e^{-4}$
i.e, $0.0099 \lt e^{-4}$
$0.0099 \lt 0.0183, true \Rightarrow \text{ accept } x - 2$
The whole process is summarized in table below:
X | P | $R_{x+1}$ | Accept / Reject | Result |
---|---|---|---|---|
0 | 0.5389 | 0.5389 | $P \gt e^{-\lambda} \Rightarrow Reject$ | - |
1 | 0.0532 | 0.0286 | $P \gt e^{-\lambda} \Rightarrow Reject$ | - |
2 | 0.3492 | 0.0099 | $P \gt e^{-\lambda} \Rightarrow Accept$ | X = 2 |
Table: Acceptance - Rejection process for Poisson variable