Activity: Random Variate Generation
Modeling Randomness Activities
Work in teams. Each problem generates a random variate by hand from the given pseudo-random number \(u\). Write down the algorithm first, then the value. Give continuous values to three decimal places.
1. The inverse transform method, continuous
Generate an exponentially distributed random variate with a mean of 5 using \(u = 0.526\).
Generate a uniformly distributed random variate with a minimum of 3 and a maximum of 13 using \(u = 0.5921\).
Let \(f(x) = 2x/25\) for \(0 \leq x \leq 5\), and 0 otherwise, represent a probability density function. Derive the inverse transform algorithm, and generate two variates using \(u_1 = 0.943\) and \(u_2 = 0.398\).
2. The inverse transform method, discrete
Generate a Bernoulli random variate with a probability of success of 0.24 using \(u = 0.612\).
The demand for a product is 2 units with probability 0.1, 3 units with probability 0.4, 4 units with probability 0.1, and 5 units with probability 0.4. Generate one demand using \(u = 0.7321\).
Generate a random variate from a discrete uniform distribution on \(\{12, 13, \ldots, 22\}\) using \(u = 0.837\).
3. Convolution
The number of damaged items in a shipment of 18 items has a binomial distribution with a probability of damage of 0.2. Use the table of pseudo-random numbers below, read by rows, for the parts of this section and the next.
| 0.943 | 0.398 | 0.372 | 0.943 | 0.204 | 0.794 |
| 0.498 | 0.528 | 0.272 | 0.899 | 0.294 | 0.156 |
| 0.102 | 0.057 | 0.409 | 0.398 | 0.400 | 0.997 |
A binomial random variable is the sum of Bernoulli random variables. Generate the number of damaged items in the shipment.
How many pseudo-random numbers does one binomial variate need? How could you generate it with only one?
4. Acceptance-rejection
Return to \(f(x) = 2x/25\) on \([0, 5]\) from 1c.
Find a constant majorizing function \(g(x)\) for \(f(x)\) on \([0, 5]\), as small as possible. What is the proxy density \(w(x)\)?
What is the probability that a generated \(W\) is accepted?
With \(W = 3\) and \(U = 0.205\), is \(W\) accepted?
Generate two variates, using the table in pairs from its start: the first number of each pair generates \(W\) from \(w(x)\), and the second is \(U\). How many pairs did you need, and is that consistent with 4b?
Which method would you use for this \(f(x)\), and why?