COMP9334 Revision Questions for Week 5A (Solution)
Question 1
(a) A program that implements the transient removal procedure in Section 9.5.1 Law and Kelton can be found in week5A_q1_a.py. You can vary the value of w. You should adjust w until you get a smoothed curve. There are no hard rules are to how to choose w. This is done by trial-and-error.
We start with w = 10. The result is plotted in the Figure 1. You see a lot of oscillation in the graph so we will need to increase the value of w to smooth it out.
Let us try w = 100. The result is plotted in Figure 2. The graph is still oscillatory but less.
Let us try w = 500. The result is plotted in Figure 3. The graph is a smoother but it still oscillates. It is difficult to get the ideal shape where the graph rises up initially and then settles down to a steady state value. From Figure 3, you can see that the curve oscillates around a value of 3.3. That is probably the mean value. Based on that, the suggestion is to cut away the first 1000 points.
window size w = 10
8
6
4
2
0 2500 5000 7500 10000 12500 15000 17500 20000
Figure 1: Question 1a. w = 10
1
window size w = 100
5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5
(b) Since we have decided to take the first 1000 data points as the transient. For each replication, we compute the mean over 19000 data points (i.e. from data point 1001 to 20,000). The mean response times given by the 5 replications are: 3.488, 3.3309, 3.2025, 3.3242 and 3.2356.
The sample mean and sample standard deviation are calculated to be, respectively, 3.3163 and 0.1110. Since there are 5 replications, to compute the 90% confidence in- terval, we need to the value of t4,0.95 which is 2.132. The 90% confidence interval is
therefore3.3163¡À2.1320.1110 =[3.2105,3.4221]. 5
Some of these calculations can be found in the file week05A_q1_b.py
0 2500 5000 7500 10000 12500 15000 17500 20000
Figure 2: Question 1a. w = 100
¡Ì
2
4.0 3.5 3.0 2.5 2.0 1.5
window size w = 500
0 2500 5000 7500 10000 12500 15000 17500 20000
Question 2
Figure 3: Question 1a. w = 500
(a) The 95% confidence interval is [4.7776, 5.8791]
(b) The 90% confidence interval is [4.8966, 5.7601]
(c) The 95% confidence interval has a wider range. Note that the data that are available for computing both 90% and 95% confidence intervals are the same. With a given amount of information, if you wish to make a prediction which is correct with a higher probability, e.g. 95% confidence rather than 90% confidence, then you need to use an interval which is wider. Let us use an analogy to explain this. Let us say that you want to guess the number that may come out from a throw of a fair die. If you want to get the number correct with probability 23 , you may say the number is in the interval [1, 4]. If you want to get the number correct with probability 13, you may say the number is in the interval [1, 2].
As a remark, if your goal in simulation is to have a more precise estimate of the mean response time. What you want to do is to make the confidence interval narrow enough. This is achieved by either simulating longer or using a greater number of independent replications.
3