Write random-variate-generation algorithms to generate values from the following distributions:
(a) the Erlang distribution with parameters λ and n phases;
(b) the binomial distribution with success probability γ and n trials;
(c) the number of arrivals by time t in a Poisson process with arrival rate λ; and
(d) the number of arrivals by time t in the nonstationary Poisson process given in Exercise 20. Code these algorithms, generate values, and examine the empirical cdfs and histograms as you vary λ, n, γ and t.
Exercise 20
A more refined model for the arrival-counting process to the emergency room described in Exercise 3 is as a nonstationary Poisson arrival process with arrival-rate function
where time is measured in hours and time 0 is 6 a.m.
(a) Derive the integrated-rate function for this model.
(b) What is the probability that the doctor will see more than 12 patients between 8 a.m. and 2 p.m. for this model? What is the expected number of patients the doctor will see during that time?
(c) If the doctor has seen six patients by 8 a.m., what is the probability that the doctor will see a total of nine patients by 10 a.m.?
(d) What is the probability that she will see her first patient in 15 minutes or less after coming on duty? (e) What is the probability that the doctor will see her thirteenth patient before 1 p.m.?
Exercise 3
Patients arrive to a hospital emergency room at a rate of 2 per hour. A doctor works a 12-hour shift from 6 a.m. until 6 p.m. Answer the following questions by approximating the arrival-counting process as a Poisson process:
(a) If the doctor has seen six patients by 8 a.m., what is the probability that the doctor will see a total of nine patients by 10 a.m.?
(b) What is the expected time between the arrival of successive patients? What is the probability that the time between the arrival of successive patients will be more than 1 hour?
(c) What is the expected time after coming on duty until the doctor sees her first patient? What is the probability that she will see her first patient in 15 minutes or less after coming on duty?
(d) What is the probability that the doctor will see her thirteenth patient before 1 p.m.?
(e) Of patients admitted to the emergency room, 14% are classified as “urgent.” What is the probability that the doctor will see more than six urgent patients during her shift?
(f) The hospital also has a walk-in clinic to handle minor problems. Patients arrive at this clinic at a rate of 4 per hour. What is the probability that the total number of patients arriving at both the emergency room and clinic from 6 a.m. until 12 noon will be greater than 30?