Spring Semester, 2021 M. Carchidi
———————————————————————————————————————
Problem #1 (15 points) - An Empirical Continuous Distribution
Data have been collected on service times at a drive-in bank window at the Shady Lane
National Bank. This data are summarized into time intervals as follows.
Interval (seconds) Frequency
15-30 10
30-45 20
45-60 25
60-90 35
90-120 30
120-180 20
180-300 10
It is desirable to run a simulation using these service times and we want the service times
to be continuous from 0 to 300 seconds. Using a linear interpolation scheme, develop a
random-variate generator for this service-time distribution.
———————————————————————————————————————
Problem #2 (15 points) - Simulate the Random Variable
Suppose that the lifetime of a device is to be modeled by the random variable X having pdf
2
fx e −4x 3xe −2x
over the range space 0 ≤ x. Develop a method for generating a random sample for X,
given two random numbers R 1 and R 2 from U0, 1. Run a simulation checking your result
against EX and X.
———————————————————————————————————————
Problem #3 (15 points) - A Discrete Distribution
Develop a random-variate generator for a discrete random variable X with pmf
px 22x 1 2
x x 1
for x 1, 2, 3, … . Your final answer should involve the ceiling function and you may use
the identity
2x 1 1 − 1
2 2 2
x x 1 x x 1 2
when computing Fx. You should check your answer by computing EX and comparing
it to a simulation.
———————————————————————————————————————
,———————————————————————————————————————
Problem #4 (15 points) - Generating Random Samples
Consider a single-channel queue having customer interarrival times given by the pdf
6x 2 125 − x 3
fx
15625
for 0 ≤ x ≤ 5 minutes, and service times distributed as given by the
2x 2 2x 3
gx
135
for 0 ≤ x ≤ 3 minutes. Run a simulation of 2000 customer arrivals and use your
simulation to calculate: (a) the average customer waiting time, (b) the probability that a
customer must wait, (c) the fraction of the time the server is idle, (d) the average service
time, (e) the average time between arrivals, (f) the average time a customer spends in the
system, (g) the average number of customers in the system, and (h) the average number of
customers waiting in line. Note that you need not compute the theoretical values here.
———————————————————————————————————————
Problem #5 (20 points) - An Unusual Random Variable
Suppose that a random variable X has a pdf given by
0, for x ≤ −a
fx bx a/a, for −a ≤ x ≤ 0
be −x , for 0 ≤ x
where a, b and are positive constants with ab 2. A typical plot of this is shown in the
following figure.
Typical Plot of fx versus x
Determine how to sample X given a random number R U0, 1 and run a 2000 Sample
Monte-Carlo Simulation checking your result against EX and X.
———————————————————————————————————————
2
, ———————————————————————————————————————
Problem #6 (20 points) - An Acceptance-Rejection Algorithm
a.) (10 points) Develop an acceptance-rejection algorithm for generating a continuous
random variable X having pdf
1 1
fx x 1 − x
for 0 , and 0 x 1 and zero otherwise. For example, a plot of f versus x for 3
and 1 for 0 ≤ x ≤ 1 is shown in the figure below.
y 2.0
1.5
1.0
0.5
0.0
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
Plot of f versus x using 3 and 1
If 1000 samples of X are desired, on average, how many times must your algorithm be
repeated ?
b.) (10 points) Assuming that 3 and 1, test your algorithm developed in part (a)
using an EXCEL spreadsheet by comparing the simulated mean and standard deviation
(using 1000 values for R 1 and 1000 values for R 2 ) to the theoretical values of
EX and EX 2 − EX 2 .
Also check that your simulated value of c computed in part (a) agrees with the theoretical
value of
fx
c max .
0≤x1 gx
———————————————————————————————————————
3