A Questio Output Aalysis Let X be the radom variable Result from throwig a die 5.. Questio: What is E (X? Would you throw just oce ad take the result as your aswer? Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto What Are We Doig Wrog? Example We have bee makig a serious mistake i our simulatios We have made oe observatio oly Example - the legth of the queue i the bak: Cosider our bak example: Observe the average queue legth < T < Choose differet sets of radom umbers Obs#/SimpleQueueM/Queue#NMea Obs#/SimpleQueueM/Queue#NMea Obs#/SimpleQueueM/Queue#NMea.5.5.5.5.5 6 8 6 8.5.5.5.5.5 6 8 6 8.5.5.5 6 8 6 8 Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto
Example What Are We Doig Wrog? Cosider our bak example Choose differet sets of radom umbers Observe the queue legth at T = Results:,,, 7,,,, 5 Real systems behave radomly They cotai radom variables Our simulatio results are also radom They deped o radom umbers Ruig a simulatio meas takig oe sample of a RN Which is the "right" aswer? We eed a more sophisticated approach! Itroductio to Simulatio WS/ - L 7 5/ Graham Horto Itroductio to Simulatio WS/ - L 7 6/ Graham Horto Some Defiitios Some Defiitios Cosider a radom variable Y We have: var( ay = a var( Y Take a set of observatios Y i, i =... Mea: Y Sample variace S : The Y = i S S var( Y = var( = Y i ( Y i Y Also: var( Y + Y = var( Y + var( Y + cov( Y, Y IID = "Idepedet ad Idetically Distributed" Y, Y IID var( Y + Y = var( Y + var( Y Itroductio to Simulatio WS/ - L 7 7/ Graham Horto Itroductio to Simulatio WS/ - L 7 8/ Graham Horto
Some Defiitios Termiatig Simulatios Bias: Give a value q ad a estimator I geeral, we have E ( θ ˆ = θ + b (i.e. the estimator is biased The bias ca also be multiplicative: E ( θˆ = B θ May statistical methods assume b= (B= θˆ A termiatig simulatio is oe... which rus up to a specified time which has kow iitial coditios i which the iitial coditios are importat Examples: Will the satellite survive for 5 years? How full is the bak hours after opeig time? Itroductio to Simulatio WS/ - L 7 9/ Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto No-Termiatig Simulatios Studet's t-distributio A o-termiatig simulatio is oe... which rus for a idefiite period i which the iitial coditios are ot importat i which the steady-state behaviour is of iterest Itroduced by W. Gosset (a.k.a. "Studet" Has oe parameter f ("degrees of freedom" Used for hypothesis testig Tables of values are available.6 Examples: Ay cotiuously ruig system Computer cetre, hospital,....5.... - - - - Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto
Studet's t-distributio Give: A measure of the real system q A estimator θˆ for q Make the ull hypothesis The value θ θˆ t = σˆ( θˆ H is t-distributed with d.o.f. : E( θ = θˆ Choose a level of sigificace α Rearrage t α /, f + tα /, f to obtai the cofidece iterval θˆ σˆ ( θˆ θ θˆ σˆ( θˆ ˆ ˆ ( ˆ t α /, f θ θ + σ θ tα /, f Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto What are we doig? What are we doig? θ θˆ σˆ( θˆ ~ t f α/ α/ t α/,f α/ α/ θˆ σˆ ( θˆ t α /, f Itroductio to Simulatio WS/ - L 7 5/ Graham Horto Itroductio to Simulatio WS/ - L 7 6/ Graham Horto
How to obtai σˆ ( θˆ? Begi with S var( Y = var( Usig θˆ we obtai Y = i σ Therefore we have Y i θˆ = var( θˆ = var( ( S σˆ ( θˆ (whe Y i are IID Y i Improvig accuracy: S We have σˆ ( θˆ If we wish to halve the width of the the c.i....... we must use samples! Accuracy is expesive i simulatio! Itroductio to Simulatio WS/ - L 7 7/ Graham Horto Itroductio to Simulatio WS/ - L 7 8/ Graham Horto Bias due to Autocorrelatio A cofidece iterval is oly accurate if: θˆ is a ubiased estimator of q σˆ ( θˆ is a ubiased estimator of σ ( θˆ Cosider the Y i from oe simulatio ru: If the observatios are ot idepedet...... the the estimator will be biased Positive autocorrelatio Negative autocorrelatio Itroductio to Simulatio WS/ - L 7 9/ Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto
Bias due to Autocorrelatio Idepedet Replicatios Positive autocorrelatio... leads to overestimatio of S leads to over-optimistic cofidece itervals Example: Most queues Negative autocorrelatio... leads to uderestimatio of S leads to uder-optimistic cofidece itervals Example: Some ivetory systems Do't use time series for cofidece itervals! The method of idepedet replicatios: Ru the simulatio R times Use idepedet sets of radom umbers Make the observatios Y r, r=...r Compute θˆ ad S from the Y r Compute a cofidece iterval from θˆ ad S Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto No-Termiatig Simulatios Iitial Bias Difficulties with o-termiatig simulatios: Iitial bias How log to ru the simulatio? Tradeoff betwee replicatio ad duratio I a o-termiatig simulatio We are iterested i the steady-state behaviour The iitial values will usually be utypical Example: Queue i bak (startig empty: Obs#/SimpleQueueM/Queue#NMea.5.5.5.5.5 6 8 6 8 Itroductio to Simulatio WS/ - L 7 / Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto
Iitial Bias Iitial Bias Solutio: Delete values from trasiet phase Choose T after trasiet phase is over Observe from T to T E How to choose T (ad T E? How log is the trasiet phase i a o-termiatig simulatio?.5.5.5 Trasiet phase T Steady-state phase T E.5 T? 5 5 5 Itroductio to Simulatio WS/ - L 7 5/ Graham Horto Itroductio to Simulatio WS/ - L 7 6/ Graham Horto Iitial Bias Esemble Averages A difficult questio! Usig just oe ru to fid T is dagerous 7 Compute esemble averages 6 5 Perform idepedet replicatios Compute average values across replicatios T? 6 8 6 8 Itroductio to Simulatio WS/ - L 7 7/ Graham Horto Itroductio to Simulatio WS/ - L 7 8/ Graham Horto
Esemble Averages Esemble Averages Perform idepedet replicatios to obtai Compute esemble averages: Y r,i i =..., r =...R Compute average values across replicatios Y i = R r= Yr, i i = K Test sequece Y i for ed of trasiet phase 7 6 5 Ru Ru Ru Ru Mea 6 8 6 8 Itroductio to Simulatio WS/ - L 7 9/ Graham Horto Itroductio to Simulatio WS/ - L 7 / Graham Horto No-Termiatig Simulatios Icreasig R will make the c.i. arrower It will ot reduce the iitial bias, i.e....we will get a better c.i. aroud q + b! Computig time tradeoff is ecessary betwee...icreasig T E ad icreasig R Solutio: R > 5 is ot useful Itroductio to Simulatio WS/ - L 7 / Graham Horto