*1. Suppose it is relatively easy to simulate from the distributions Fi,i=1,2,…,n. If n is small, how can we simulate from
F(x)=∑i=1nPiFi(x),Pi⩾0,∑iPi=1?
Give a method for simulating from
F(x)=1-e-2x+2x3,0<x<13-e-2x3,1<x<∞
2. Give a method for simulating a negative binomial random variable.
*3. Give a method for simulating a hypergeometric random variable.
4. Suppose we want to simulate a point located at random in a circle of radius r centered at the origin. That is, we want to simulate X,Y having joint density
f(x,y)=1πr2,x2+y2⩽r2
(a) Let R=X2+Y2,θ=tan-1Y/X denote the polar coordinates. Compute the joint density of R,θ and use this to give a simulation method. Another method for simulating X,Y is as follows:
Step 1: Generate independent random numbers U1,U2 and set Z1=2rU1-r,Z2=2rU2-r. Then Z1,Z2 is uniform in the square whose sides are of length 2r and which encloses, the circle of radius r (see Figure 11.6).
Step 2: If (Z1,Z2) lies in the circle of radius r—that is, if Z12+Z22⩽r2—set (X,Y)=(Z1,Z2). Otherwise return to step 1.
(b) Prove that this method works, and compute the distribution of the number of random numbers it requires.
5. Suppose it is relatively easy to simulate from Fi for each i=1,…,n. How can we simulate from
(a) F(x)=∏i=1nFi(x)?
(b) F(x)=1-∏i=1n(1-Fi(x))?
(c) Give two methods for simulating from the distribution F(x)=xn,0<x<1.
*6. In Example 11.4 we simulated the absolute value of a standard normal by using the Von Neumann rejection procedure on exponential random variables with rate 1. This raises the question of whether we could obtain a more efficient algorithm by using a different exponential density—that is, we could use the density g(x)=λe-λx. Show that the mean number of iterations needed in the rejection scheme is minimized when λ=1.
7. Give an algorithm for simulating a random variable having density function
f(x)=30(x2-2x3+x4),0<x<1
8. Consider the technique of simulating a gamma (n,λ) random variable by using the rejection method with g being an exponential density with rate λ/n.
(a) Show that the average number of iterations of the algorithm needed to generate a gamma is nne1-n/(n-1)!.
(b) Use Stirling’s approximation to show that for large n the answer to part (a) is approximately equal to e[(n-1)/(2π)]1/2.
(c) Show that the procedure is equivalent to the following:
Step 1: Generate Y1 and Y2, independent exponentials with rate 1.
Step 2: If Y1<(n-1)[Y2-log(Y2)-1], return to step 1.
Step 3: Set X=nY2/λ.
(d) Explain how to obtain an independent exponential along with a gamma from the preceding algorithm.
9. Set up the alias method for simulating from a binomial random variable with parameters n=6,p=0.4.
10. Explain how we can number the Q(k) in the alias method so that k is one of the two points that Q(k) gives weight.
Hint: Rather than giving the initial Q the name Q(1), what else could we call it?
11. Complete the details of Example 11.10.
12. Let X1,…,Xk be independent with
P{Xi=j}=1n,j=1,…,n,i=1,…,k
If D is the number of distinct values among X1,…,Xk show that
E[D]=n1-n-1nk≈k-k22nwhenk2nis small
13. The Discrete Rejection Method: Suppose we want to simulate X having probability mass function P{X=i}=Pi,i=1,…,n and suppose we can easily simulate from the probability mass function Qi,∑iQi=1,Qi⩾0. Let C be such that Pi⩽CQi,i=1,…,n. Show that the following algorithm generates the desired random variable:
Step 1: Generate Y having mass function Q and U an independent random number.
Step 2: If U⩽PY/CQY, set X=Y. Otherwise return to step 1.
14. The Discrete Hazard Rate Method: Let X denote a nonnegative integer valued random variable. The function λ(n)=P{X=n∣X⩾n},n⩾0, is called the discrete hazard rate function.
(a) Show that P{X=n}=λ(n)∏i=0n-1(1-λ(i)).
(b) Show that we can simulate X by generating random numbers U1,U2,… stopping at
X=min{n:Un⩽λ(n)}
(c) Apply this method to simulating a geometric random variable. Explain, intuitively, why it works.
(d) Suppose that λ(n)⩽p<1 for all n. Consider the following algorithm for simulating X and explain why it works: Simulate Xi,Ui,i⩾1 where Xi is geometric with mean 1/p and Ui is a random number. Set Sk=X1+⋯+Xk and let
X=min{Sk:Uk⩽λ(Sk)/p}
15. Suppose you have just simulated a normal random variable X with mean μ and variance σ2. Give an easy way to generate a second normal variable with the same mean and variance that is negatively correlated with X.
*16. Suppose n balls having weights w1,w2,…,wn are in an urn. These balls are sequentially removed in the following manner: At each selection, a given ball in the urn is chosen with a probability equal to its weight divided by the sum of the weights of the other balls that are still in the urn. Let I1,I2,…,In denote the order in which the balls are removed—thus I1,…,In is a random permutation with weights.
(a) Give a method for simulating I1,…,In.
(b) Let Xi be independent exponentials with rates wi,i=1,…,n. Explain how Xi can be utilized to simulate I1,…,In.
17. Order Statistics: Let X1,…,Xn be i.i.d. from a continuous distribution F, and let X(i) denote the ith smallest of X1,…,Xn,i=1,…,n. Suppose we want to simulate X(1)<X(2)<⋯<X(n). One approach is to simulate n values from F, and then order these values. However, this ordering, or sorting, can be time consuming when n is large.
(a) Suppose that λ(t), the hazard rate function of F, is bounded. Show how the hazard rate method can be applied to generate the n variables in such a manner that no sorting is necessary.
Suppose now that F-1 is easily computed.
(b) Argue that X(1),…,X(n) can be generated by simulating U(1)<U(2)<⋯<U(n)—the ordered values of n independent random numbers—and then setting X(i)=F-1(U(i)). Explain why this means that X(i) can be generated from F-1(βi) where βi is beta with parameters i,n+i+1.
(c) Argue that U(1),…,U(n) can be generated, without any need for sorting, by simulating i.i.d. exponentials Y1,…,Yn+1 and then setting
U(i)=Y1+⋯+YiY1+⋯+Yn+1,i=1,…,n
Hint: Given the time of the (n+1)st event of a Poisson process, what can be said about the set of times of the first n events?
(d) Show that if U(n)=y then U(1),…,U(n-1) has the same joint distribution as the order statistics of a set of n-1 uniform (0,y) random variables.
(e) Use part (d) to show that U(1),…,U(n) can be generated as follows:
Step 1: Generate random numbers U1,…,Un.
Step 2: Set
U(n)=U11/n,U(n-1)=U(n)(U2)1/(n-1),U(j-1)=U(j)(Un-j+2)1/(j-1),j=2,…,n-1
18. Let X1,…,Xn be independent exponential random variables each having rate 1. Set
W1=X1/n,Wi=Wi-1+Xin-i+1,i=2,…,n
Explain why W1,…,Wn has the same joint distribution as the order statistics of a sample of n exponentials each having rate 1.
19. Suppose we want to simulate a large number n of independent exponentials with rate 1—call them X1,X2,…,Xn. If we were to employ the inverse transform technique we would require one logarithmic computation for each exponential generated. One way to avoid this is to first simulate Sn, a gamma random variable with parameters (n,1) (say, by the method of Section 11.3.3). Now interpret Sn as the time of the nth event of a Poisson process with rate 1 and use the result that given Sn the set of the first n-1 event times is distributed as the set of n-1 independent uniform (0,Sn) random variables. Based on this, explain why the following algorithm simulates n independent exponentials:
Step 1: Generate Sn, a gamma random variable with parameters (n,1).
Step 2: Generate n-1 random numbers U1,U2,…,Un-1.
Step 3: Order the Ui,i=1,…,n-1 to obtain U(1)<U(2)<⋯<U(n-1).
Step 4: Let U(0)=0,U(n)=1, and set Xi=Sn(U(i)-U(i-1)),i=1,…,n.
When the ordering (step 3) is performed according to the algorithm described in Section 11.5, the preceding is an efficient method for simulating n exponentials when all n are simultaneously required. If memory space is limited, however, and the exponentials can be employed sequentially, discarding each exponential from memory once it has been used, then the preceding may not be appropriate.
20. Consider the following procedure for randomly choosing a subset of size k from the numbers 1,2,…,n: Fix p and generate the first n time units of a renewal process whose interarrival distribution is geometric with mean 1/p—that is, P{interarrival time=k}=p(1-p)k-1,k=1,2,…. Suppose events occur at times i1<i2<⋯<im⩽n. If m=k, stop; i1,…,im is the desired set. If m>k, then randomly choose (by some method) a subset of size k from i1,…,im and then stop. If m<k, take i1,…,im as part of the subset of size k and then select (by some method) a random subset of size k-m from the set {1,2,…,n}-{i1,…,im}. Explain why this algorithm works. As E[N(n)]=np a reasonable choice of p is to take p≈k/n. (This approach is due to Dieter.)
21. Consider the following algorithm for generating a random permutation of the elements 1,2,…,n. In this algorithm, P(i) can be interpreted as the element in position i.
Step 1: Set k=1.
Step 2: Set P(1)=1.
Step 3: If k=n, stop. Otherwise, let k=k+1.
Step 4: Generate a random number U, and let
P(k)=P([kU]+1),P([kU]+1)=k.Go tostep 3.
(a) Explain in words what the algorithm is doing.
(b) Show that at iteration k—that is, when the value of P(k) is initially set—that P(1),P(2),…,P(k) is a random permutation of 1,2,…,k.
Hint: Use induction and argue that
Pk{i1,i2,…,ij-1,k,ij,…,ik-2,i}=Pk-1{i1,i2,…,ij-1,i,ij,…,ik-2}1k=1k!by the induction hypothesis
The preceding algorithm can be used even if n is not initially known.
22. Verify that if we use the hazard rate approach to simulate the event times of a nonhomogeneous Poisson process whose intensity function λ(t) is such that λ(t)⩽λ, then we end up with the approach given in method 1 of Section 11.5.
*23. For a nonhomogeneous Poisson process with intensity function λ(t),t⩾0, where ∫0∞λ(t)dt=∞, let X1,X2,… denote the sequence of times at which events occur.
(a) Show that ∫0X1λ(t)dt is exponential with rate 1.
(b) Show that ∫Xi-1Xiλ(t)dt,i⩾1, are independent exponentials with rate 1, where X0=0.
In words, independent of the past, the additional amount of hazard that must be experienced until an event occurs is exponential with rate 1.
24. Give an efficient method for simulating a nonhomogeneous Poisson process with intensity function
λ(t)=b+1t+a,t⩾0
25. Let (X,Y) be uniformly distributed in a circle of radius r about the origin. That is, their joint density is given by
f(x,y)=1πr2,0⩽x2+y2⩽r2
Let R=X2+Y2 and θ=arctanY/X denote their polar coordinates. Show that R and θ are independent with θ being uniform on (0,2π) and P{R<a}=a2/r2,0<a<r.
26. Let R denote a region in the two-dimensional plane. Show that for a two-dimensional Poisson process, given that there are n points located in R, the points are independently and uniformly distributed in R—that is, their density is f(x,y)=c,(x,y)∈R where c is the inverse of the area of R.
27. Let X1,…,Xn be independent random variables with E[Xi]=θ,Var(Xi)=σi2i=1,…,n, and consider estimates of θ of the form ∑i=1nλiXi where ∑i=1nλi=1. Show that Var∑i=1nλiXi is minimized when
λi=(1/σi2)/∑j=1n1/σj2,i=1,…,n.
Possible Hint: If you cannot do this for general n, try it first when n=2.
The following two problems are concerned with the estimation of ∫01g(x)dx=E[g(U)] where U is uniform (0,1).
28. The Hit–Miss Method: Suppose g is bounded in [0,1]—for instance, suppose 0⩽g(x)⩽b for x∈[0,1]. Let U1,U2 be independent random numbers and set X=U1,Y=bU2—so the point (X,Y) is uniformly distributed in a rectangle of length 1 and height b. Now set
I=1,ifY<g(X)0,otherwise
That is, accept (X,Y) if it falls in the shaded area of Figure 11.7.
(a) Show that E[bI]=∫01g(x)dx.
(b) Show that Var(bI)⩾Var(g(U)), and so hit–miss has larger variance than simply computing g of a random number.
29. Stratified Sampling: Let U1,…,Un be independent random numbers and set U¯i=(Ui+i-1)/n,i=1,…,n. Hence, U¯i,i⩾1, is uniform on ((i-1)/n,i/n). ∑i=1ng(U¯i)/n is called the stratified sampling estimator of ∫01g(x)dx.
(a) Show that E[∑i=1ng(U¯i)/n]=∫01g(x)dx.
(b) Show that Var[∑i=1ng(U¯i)/n]⩽Var[∑i=1ng(Ui)/n].
Hint: Let U be uniform (0,1) and define N by N=i if (i-1)/n<U<i/n,i=1,…,n. Now use the conditional variance formula to obtain
Var(g(U))=E[Var(g(U)∣N)]+Var(E[g(U)∣N])⩾E[Var(g(U)∣N)]=∑i=1nVar(g(U)∣N=i)n=∑i=1nVar[g(U¯i)]n
30. If f is the density function of a normal random variable with mean μ and variance σ2, show that the tilted density ft is the density of a normal random variable with mean μ+σ2t and variance σ2.
31. Consider a queueing system in which each service time, independent of the past, has mean μ. Let Wn and Dn denote, respectively, the amounts of time customer n spends in the system and in queue. Hence, Dn=Wn-Sn where Sn is the service time of customer n. Therefore,
E[Dn]=E[Wn]-μ
If we use simulation to estimate E[Dn], should we
(a) use the simulated data to determine Dn, which is then used as an estimate of E[Dn]; or
(b) use the simulated data to determine Wn and then use this quantity minus μ as an estimate of E[Dn]?
Repeat for when we want to estimate E[Wn].
*32. Show that if X and Y have the same distribution then
Var((X+Y)/2)⩽Var(X)
Hence, conclude that the use of antithetic variables can never increase variance (though it need not be as efficient as generating an independent set of random numbers).
33. If 0⩽X⩽a, show that
(a) E[X2]⩽aE[X],
(b) Var(X)⩽E[X](a-E[X]),
(c) Var(X)⩽a2/4.
34. Suppose in Example 11.19 that no new customers are allowed in the system after time t0. Give an efficient simulation estimator of the expected additional time after t0 until the system becomes empty.
35. Suppose we are able to simulate independent random variables X and Y. If we simulate 2k independent random variables X1,…,Xk and Y1,…,Yk, where the Xi have the same distribution as does X, and the Yj have the same distribution as does Y, how would you use them to estimate P(X<Y)?
36. If U1,U2,U3 are independent uniform (0, 1) random variables, find P∏i=13Ui>0.1.