R代写 - AMA541/518 Midterm

Write or print your solutions in A4-size paper, convert to one pdf file and submit on blackboard.
The test is between 7:30pm-9:30pm, and you have 30 minutes (due 10:00pm) to upload your solutions.
1. (20 marks) 36 two-digit decimal numbers as shown below are claimed to be generated from a
random process.
48 79 74 73 72 08 64 80 91 38 88 09
31 53 88 97 96 86 01 69 12 75 10 60
36 80 66 39 94 97 61 73 84 89 18 26
Apply the runs test of serial independence, test whether the above 36 numbers are serial inde-
pendent. Set α = 0.05.
2. (20 marks) 36 two-digit decimal numbers as shown below are claimed to be generated from a
random process.
36 80 66 39 94 97 61 73 84 89 18 26
02 04 37 95 48 06 30 00 18 03 30 28
55 59 71 42 14 96 55 98 59 96 01 36
Apply the Good’s serial test to test whether the above generated 36 two-digit numbers are
consecutively independent or not at α = 0.05. Using the intervals: 00-24, 25-49, 50-74, 75-99.
3. (40 marks) Generate two random observations for each of the following probability density
functions: (a-d) by the Inverse Transformation Method; (e) by the polar method, with and
without trigonometric functions, two ways. Each time starts from 696.
(a) An exponential distribution with λ = 3.
(b)
f(x) =
{
e−

x
2

x
x > 0
0, elsewhere
(c) A gamma distribution with α = 3, and λ = 1/4.
(d) A Poisson distribution with µ = λt = 5.
(e) A normal distribution with mean µ = 5 and standard deviation σ = 3.
Using the following three-digit random decimal numbers in their given order:
696 403 304 462 435 630 231 613 459 433
697 901 121 191 739 728 447 406 223 095
925 385 822 147 924 321 238 423 356 909
188 046 922 640 704 732 574 827 835 222
4. (20 marks) A one-pump gas station is always open and has two types of customers. A red
car arrives every 30 minutes (exactly), with the first red car arriving at time 15 minutes. The
distributions of the interarrival time (the time span between two consecutive arrivals) of green
cars, and the service time for both kinds of cars are listed below. The first green car arrives at
time 0.
1
interarrival time (mins) probability
3 12%
4 15%
5 20%
6 30%
7 23%
service time (mins) probability
3 23%
4 30%
5 18%
6 15%
7 14%
A car arriving to find the pump idle goes right into service, and green cars arriving to find the
pump busy join the end of a single queue. A red car arriving to find the pump busy, however,
goes to the front of the line, ahead of any green cars in line. [If there are already other red cars
at the front of the line, assume that an arriving red car gets in line ahead of them as well. If a
red car and a green car arrive exactly at the same time, the red car is served first. Initially the
system is empty and idle, and the simulation is to run until exactly 10 cars (of any type) have
completed their delays in queue. Find the average waiting time of the 10 cars.
Use the following numbers uniformly distributed on 00–99, to generate the arrival time and
service time. Please use the random numbers in a parsimonious way: if there is no need to use
a random number, do not use it.
18, 23, 34, 72, 82, 43, 97, 28, 85, 00, 87, 71, 40, 32, 85, 14, 52, 60, 95, 63.
2