Suppose that we with to simulate from the $Bi(n,\theta)$ distriubtion, where the parameters $n$ and $\theta$ are known. Show how the recursive formula for the probabilities of this distribution can be utilized to set up a method of simulation?
I've calculated the recursive formula as $P(X=0) = (1-\theta)^n$ and $P(X=x) = (n-(x-1))/x \times \theta/(1-\theta) P(X=x-1)$ but how could this be used for simulation?
The most natural way to be to simulate from the binomial would be let $Y = \sum_{i=1}^{n} X_i$ where each $X_i$ is a bernoulli random variable with parameter $\theta$ and then simulate each $X_i$. I'm not sure how the recursive formula could be used? Of course we could use the formula as follows, simulate $u \sim U(0,1)$ then find an index $j$ such that $\sum_{i=1}^{j-1} p(X_i) \leq u \leq \sum_{i=1}^{j} p(X_i)$ and then set $x=x_j$. Of course the sum would be calculated by the recursive formula. But i could also just get this by calculating the sum directly using the mass function at each index $i$. Could this be what they wanted or is it some other clever trick?