IEOR 4404
Assignment #9 Solutions
Simulation
December 6, 2008
Prof. Mariana Olvera-Cravioto
Page 1
Assignment #9 Solutions
1. Five elements, numbered 1, 2, 3, 4, 5, are initially arranged in a random order (i.e., the initial
ordering is a random permutation of 1, 2, 3, 4, 5). At each stage one of the elements is selected
and put at the front of the list. That is, if the present order is 2, 3, 4, 1, 5 and element 1 is chosen,
then the new ordering is 1, 2, 3, 4, 5. Suppose that each selection is, independently, element
i
with
probability
p
i
, where
p
1
=
1
15
,
p
2
=
2
15
,
p
3
=
3
15
,
p
4
=
4
15
,
p
5
=
5
15
. Let
L
j
denote the position of the
j
th
element to be selected, and let
L
=
100
∑
j
=1
L
j
. We are interested in using simulation to estimate
E
[
L
].
(a) Explain how we could use simulation to estimate
E
[
L
].
(b) Compute
E
[
N
i
], where
N
i
is the number of times element
i
is chosen in the 100 selections.
(c) Let
Y
=
5
∑
i
=1
iN
i
. Do you think
Y
is positively or negatively correlated with
L
?
(d) Develop a simulation study to estimate
L
, using
Y
is a control variable.
Proof: (a) The algorithm,
(i) Simulate a random permutation of 1, 2, 3, 4, 5
(ii) Repeat the 100 selections according to
p
’s, and record
L
=
100
∑
j
=1
L
j
.
(iii) Go back to (1), and replicate
n
times.
(iv) Estimate
E
[
L
] by the sample mean of the
n
replications.
(b) Notice that
N
i
is the number of times element
i
is chosen, which has nothing to do with
positions.
E
[
N
i
] = 100
p
i
(c) We test the correlation by simulation.
nb
simu = 100;
for i = 1:nb
simu
L = 0;
Y = 0;
permutation = randperm(5);
for k = 1:100
temp = rand;
if temp
<
1/15
selection = 1;
elseif temp
<
3/15;
selection = 2;
elseif temp
<
6/15;
selection = 3;
elseif temp
<
10/16;