2WB05 Simulation Lecture 7: Output analysis Marko Boon http://www.win.tue.nl/courses/2WB05 December17,2012 Outline 2/33 Output analysis of a simulation • Confidence intervals • Warm-up interval • Common random numbers DepartmentofMathematicsandComputerScience Output analysis of a simulation 3/33 Confidence intervals , ,..., µ Let X X X be independent realizations of a random variable X with unknown mean and unknown 1 2 n variance σ2. Sample mean n 1 (cid:88) X¯(n) = X i n i=1 Sample variance n 1 (cid:88) S2(n) = (X − X¯(n))2 i n − 1 i=1 ¯( ) µ Clearly X n is an estimator for the unknown mean . µ How can we construct a confidence interval for ? DepartmentofMathematicsandComputerScience Confidence intervals 4/33 Central limit theorem states that for large n (cid:80)n X − nµ i=1 √i σ n σ ( ) is approximately a standard normal random variable, and this remains valid if is replaced by S n . Hence, let zβ = (cid:56)−1(β) (e.g., z1−0.025 = 1.96), then (cid:80)n X − nµ P(−z1−α/2 ≤ i=1( )i√ ≤ z1−α/2) ≈ 1 − α S n n or equivalently (cid:18) ( ) ( )(cid:19) S n S n P X¯(n) − z1−α/2 √ ≤ µ ≤ X¯(n) + z1−α/2 √ ≈ 1 − α n n DepartmentofMathematicsandComputerScience Confidence intervals 5/33 Conclusion An approximate 100(1 − α)% confidence interval for the unknown mean µ is given by ( ) S n X¯(n) ± z √ 1−α/2 n µ As a consequence, to obtain one extra digit of the parameter , the required simulation time increases with approximately a factor 100. DepartmentofMathematicsandComputerScience Confidence intervals 6/33 100 confidence intervals for the mean of uniform random variable on (−1,1); each interval is based on 100 observations. 0.3 0.25 0.2 0.15 0.1 0.05 0 -0.05 -0.1 -0.15 -0.2 -0.25 0 10 20 30 40 50 60 70 80 90 100 DepartmentofMathematicsandComputerScience Confidence intervals 7/33 Remark: If the observations X are normally distributed, then i (cid:80)n X − nµ i=1 i√ ( ) S n n has for all n a Student’s t distribution with n − 1 degrees of freedom; so an exact confidence interval can be obtained by replacing z1−α/2 by the corresponding quantile of the t distribution with n − 1 degrees of freedom. DepartmentofMathematicsandComputerScience Confidence intervals 8/33 Remark: ,..., Recursive computation of the sample mean and variance of the realizations X X of a random variable X: 1 n n − 1 1 X¯(n) = X¯(n − 1) + X n n n and n − 2 1 S2(n) = S2(n − 1) + (cid:0)X − X¯(n − 1)(cid:1)2 n n − 1 n for n = 2,3,..., where X¯(1) = X , S2(1) = 0. 1 DepartmentofMathematicsandComputerScience Warm-up interval 9/33 Problem of the initialization effect We are interested in the long-term behaviour of the system and maybe the choice of the initial state of the simulation will influence the quality of our estimate. One way of dealing with this problem is to choose N very large and to neglect this initialization effect. However, a better way is to throw away in each run the first k observations. DepartmentofMathematicsandComputerScience Warm-up interval 10/33 , ,..., Let W W W be realizations of waiting times in a single run, and suppose we want to estimate the 1 2 N ( ) steady-state mean waiting time E W , defined as E(W) = lim E(W ) j j→∞ by the sample mean N 1 (cid:88) ¯ W = W N j N j=1 DepartmentofMathematicsandComputerScience
Description: