Exponential Distribution Random Numbers out of range

136 Views Asked by At

Hi All I have following exponential distribution equation to generate different values for random variable 'r':

$$p_r = \frac{(1 - \alpha)\alpha^{CW}}{1 - \alpha^{CW}} \alpha^{-r} \text{ for } r = 1, \dots, CW$$

I have applied inverse sampling to get values of $r$ by equating this equation to random variable $U$ between 0 and 1 and then applying log on both sides. CW is fixed as 10 and $\alpha$ as 0.8 . But I get values of $r$ greater than CW (its max range) and values are positive and negative.

1

There are 1 best solutions below

7
On

For convenience, use the shorthand $\beta \equiv\frac{(1 - \alpha)\alpha^{CW}}{1 - \alpha^{CW}}$.

Generate random variable $U$ uniformly from $[0,1)$, where the observed values are $u$, then the desired random variable $R$ (which observed values are $r$) can be obtained as

\begin{align} r &= 1 & &\text{if} & 0 \le \frac{u}{\beta} & < \alpha^{-1} \\ r &= 2 & &\text{if} & \alpha^{-1} \le \frac{u}{\beta} & < \alpha^{-1} + \alpha^{-2} \\ r &= 3 & &\text{if} & \alpha^{-1} + \alpha^{-2} \le \frac{u}{\beta} &< \alpha^{-1} + \alpha^{-2} + \alpha^{-3} \\ r &= 4 & &\text{if} & \alpha^{-1} + \alpha^{-2} + \alpha^{-3} \le \frac{u}{\beta} &< \alpha^{-1} + \alpha^{-2} + \alpha^{-3} + \alpha^{-4}\\ &\vdots &&\vdots &&\vdots \\ r &= k & &\text{if} & \sum_{j=1}^{k-1} \alpha^{-j} \le \frac{u}{\beta} &< \sum_{j=1}^k \alpha^{-j} \\ &\vdots &&\vdots &&\vdots \\ r &= CW & &\text{if} & \sum_{j=1}^{CW-1} \alpha^{-j} \le \frac{u}{\beta} &< \sum_{j=1}^{CW} \alpha^{-j} \end{align}

By the way, this is not an exponential distribution. It is a truncated Geometric distribution.

Your original approach of "applying log on both sides" is the method of inverse transformation that works only on continuous distributions when directly applied like that.