1
$\begingroup$

i need some help to understand what is going on here.I'll be more specific on questions after i give the context.

Suppose we want to simulate $X$ such that:

$P\{X = i \} = p(1-p)^{i-1} , i \geq 1 $

As:

$\sum\limits_{i=1}^{j-1} P\{X = i\} = 1- P\{X > j-1 \} = 1-(1-p)^{j-1}$

we can simulate such a random variable by generating a random number $U$ and setting $X$ equal to that value $j$ for which:

$1-(1-p)^{j-1} < U < (1-p)^j$

or,equivalently, for which:

$(1-p)^{j} < 1-U < (1-p)^{j-1}$

As, $1-U$ has the same distribution as $U$ , we an thus define $X$ by :

$X = min\{j:(1-p)^j < U \} = min \big \{j:j > \frac{log (U)}{log(1-p)} \big\} = 1 +\big[ \frac{log (U)}{log(1-p)}\big]$

questions:

$\textbf{(1)}$ $\sum\limits_{i=1}^{j-1} P\{X = i\} = 1- P\{X > j-1 \} = 1-(1-p)^{j-1}$ this is nothing more than specifying the CDF (distribution function) right?

$\textbf{2)}$ $1-(1-p)^{j-1} < U < (1-p)^j$ . X gets the value of $j$ if the random number $U$ is between $1-(1-p)^{j-1}$ and $(1-p)^j$ .Did i get it right?

$\textbf{3)}$

$X = min\{j:(1-p)^j < U \} = min \big \{j:j > \frac{log (U)}{log(1-p)} \big\} = 1 +\big[ \frac{log (U)}{log(1-p)}\big]$

can someone show me or explain the stepwise calculations so that you finally come to $1 +\big[ \frac{log (U)}{log(1-p)}\big]$ , because u don't get the given calculations(in the way they do it)

$\endgroup$
1
$\begingroup$

(1) Yes, this is exactly the CDF.

(2) Yes, this is exactly what this means.

(3) This is a simple computation: $$\begin{align*} (1-p)^j<U &\Leftrightarrow \log(1-p)^j<\log U\\ &\Leftrightarrow j\log(1-p)<\log U\\ &\Leftrightarrow j>\frac{\log U}{\log(1-p)}\\ \end{align*}$$ Note that we have used two facts: $\log$ is monotone increasing, and therefore it preserves inequalities, and $\log(1-p)$ is negative, and therefore it reverses the inequality when we divide by it.

Finally, we note that the smallest integer $j$ such that $j>\frac{\log U}{\log(1-p)}$ is, by definition, the ceiling of $\frac{\log U}{\log(1-p)}$, which is also equal to $1+\lfloor \frac{\log U}{\log(1-p)}\rfloor$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.