remove initial bias from steady-state stochastic simulation · simulation begins, the queues are in...

87
Remove Initial Bias From Steady-State Stochastic Simulation Laura de Jesus dos Santos Varela Barroso Thesis to obtain the Master of Science Degree in Telecommunications and Informatics Engineering Supervisors: Prof. Maria Isabel da Conceic ¸˜ ao Santos Reis dos Santos Prof. Pedro Manuel Guerra e Silva Reis dos Santos Chairperson: Prof. Ricardo Jorge Fernandes Chaves Supervisor: Prof. Maria Isabel da Conceic ¸˜ ao Santos Reis dos Santos Members of the Committee: Prof. Francisco Jo˜ ao Duarte Cordeiro Correia dos Santos October 2018 Examination Committee

Upload: others

Post on 03-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Remove Initial Bias From Steady-State StochasticSimulation

Laura de Jesus dos Santos Varela Barroso

Thesis to obtain the Master of Science Degree in

Telecommunications and Informatics Engineering

Supervisors: Prof. Maria Isabel da Conceicao Santos Reis dos SantosProf. Pedro Manuel Guerra e Silva Reis dos Santos

Chairperson: Prof. Ricardo Jorge Fernandes ChavesSupervisor: Prof. Maria Isabel da Conceicao Santos Reis dos Santos

Members of the Committee: Prof. Francisco Joao Duarte Cordeiro Correia dos Santos

October 2018

Examination Committee

Page 2: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards
Page 3: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Acknowledgments

I want to thank my parents for their constant support, teachings, encouragement and affection over the

years in college, and for helping me along this path, through its ups and downs. This is for them, With

this, I hope to finish one more life goal and I would not do it without them.

To my grandparents Jose Joao, Suzete and Dolores, although they are no longer present, I would like to

thank them for the opportunity, support and affection they have given me throughout their lives.

I would like to thank my dissertation supervisors, Professor Maria Isabel Reis dos Santos and Professor

Pedro Reis dos Santos for the patience and the knowledge they have provided and for having given

unrelenting support throughout this stage, which would not have been done without their help.

To my work colleagues, especially Miguel Almeida for the great opportunity, patience, and teaching.

To all my friends from the heart that I have done over the years in college, Rui Barradas and Ana Rita

Pires for being excellent godfathers, Ricardo Almeida whose friendship is priceless, Joao Tomazio ”Zio”

for being always present, Tiago Fernandes for being the most understanding and chilled friend, Joao

Leite who always makes me laugh with jokes about ”casa dos frangos”, Joao Pinto who is the most

relaxed person in the world and I would not have done ACED without his help, Antonio Freire for being

most of time in a good mood and cheering up everyone, Luıs Pereira for helping me in courses like SDis,

Guilherme Andrade for being the most honest person I’ve known, Francisco Silva for always putting me

in a good mood with ”Capitao Falcao” movie jokes and photos of puppies, Laura Silva who has always

been an excellent friend and was always ready to listen, Daniel Alves for 3 years of patience, motivation

and affection, Mario Pinto for being the proof that is possible to exist a friendship between students from

Taguspark and from Alameda, and to my godchildren who are like younger brothers to me.

To all of you - Thank you very much.

Page 4: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards
Page 5: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Abstract

The study of simulation models of real systems is used with the intent to provide assistance for de-

cisions, and more information about the behavior regarding the design of these systems. When the

simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they

move towards the steady-state phase. It is known that the observations collected during the transient

periods do not characterize the steady-state system and, consequently, it is important to discard the

initial observations, known as initial bias. The main purpose of this project is to study the main topics

in stochastic simulation output analysis, more specifically study a way to remove the initial bias in order

to have more precise results that characterize the system. A review of methods for determining the

warm-up period is provided and also a critique of the methods is provided with respect to their simplicity,

ease of implementation, accuracy, overestimation and need to estimate parameters.

Keywords

Stochastic simulation; initial bias; warm-up period; precision of simulation results; stopping rules for

steady-state simulation

iii

Page 6: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards
Page 7: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Resumo

O estudo de modelos de simulac ao de sistemas reais e utilizado com a intenc ao de fornecer apoio a

decisao e mais informac oes sobre o comportamento em relac ao ao desenho desses sistemas. Quando

a simulac ao comeca, as filas estao numa fase nao estacionaria e a medida que a simulac ao avanca,

elas movem-se em direc ao a fase de estado estacionario. Sabe-se que as observac oes recolhidas ao

longo dos perıodos de transic ao nao caracterizam o sistema em estado estacionario e, consequente-

mente, e importante descartar as observac oes iniciais, conhecidas como vies inicial. O principal obje-

tivo deste projeto e estudar os principais topicos em analise de resultados em simulac ao estocastica,

mais especificamente estudar diversas maneiras de remover o vies inicial, a fim de ter resultados mais

precisos que caracterizam o sistema. Uma revisao dos metodos para determinar o perıodo de aque-

cimento e fornecida e tambem uma crıtica dos metodos em relac ao a sua simplicidade, facilidade de

implementac ao, precisao, sobrestimac ao e necessidade de estimar parametros.

Palavras Chave

Simulac ao estocastica; vies inicial; perıodo de aquecimento; precisao dos resultados da simulac ao;

regras de paragem para simulac ao de estado estacionario

v

Page 8: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards
Page 9: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Contents

1 Introduction 1

1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Structure of the Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Related Work 6

2.1 Stochastic Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Steady-State Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Initial Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.4 Graphical Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.4.1 Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.4.2 SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.5 Statistical Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5.1 Kelton and Law Regression Method . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5.2 Randomization Tests for Initialization Bias . . . . . . . . . . . . . . . . . . . . . . . 15

2.6 Heuristic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.6.1 Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.6.2 Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.7 Queuing Model M/M/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.8 Comparison between Matlab and other simulation software . . . . . . . . . . . . . . . . . 20

2.8.1 Arena . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.8.2 SIMUL8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.8.3 MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 Architecture 24

3.1 Systems to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.2 Implementation of Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.3 Results of interest and performance measures . . . . . . . . . . . . . . . . . . . . . . . . 26

vii

Page 10: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

3.4 Evaluation Parameters for the Quality of the Algorithms . . . . . . . . . . . . . . . . . . . 27

3.4.1 Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

3.4.2 Simplicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.4.3 Parameters Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.5 Work Evaluation Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

4 Implementation 29

4.1 M/M/1 System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.2 Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.3 SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.4 Kelton and Law Regression Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

4.5 Randomization Tests for Initialization Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

4.6 Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.7 Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

4.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5 Design 45

5.1 Design process in Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

5.2 Design process in SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.3 Design process in Kelton and Law Regression Method . . . . . . . . . . . . . . . . . . . . 51

5.4 Design process in Randomization tests for initialization bias . . . . . . . . . . . . . . . . . 55

5.5 Design process in Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . 57

5.6 Design process in Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

5.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

6 Conclusion 61

6.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6.2 Welch’s Method vs. SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6.3 Kelton and Law Regression Method vs. Randomization Tests for Initialization Bias . . . . 63

6.4 Conway Rule vs. Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . . 63

6.5 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

A Code for M/M/1 68

viii

Page 11: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

List of Figures

3.1 M/M/1 system representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.1 M/M/1 system simulation with λ=50 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4.2 SPC output in M/M/1 system simulation with λ=80 . . . . . . . . . . . . . . . . . . . . . 35

4.3 Kelton and Law Regression Method output in M/M/1 system simulation with λ=95 . . . . 37

5.1 Welch’s Method output in M/M/1 system simulation with λ=90 . . . . . . . . . . . . . . . 47

5.2 ”Zoom-in” Welch’s Method output in M/M/1 system simulation with λ=90 . . . . . . . . . 48

5.3 SPC Method output in M/M/1 system simulation with λ=80 . . . . . . . . . . . . . . . . . 49

5.4 SPC Method output in M/M/1 system simulation with λ=80 . . . . . . . . . . . . . . . . . 50

5.5 Kelton and Law Regression Method output in M/M/1 system simulation with λ=50 . . . . 51

5.6 Kelton and Law Regression Method output in M/M/1 system simulation with λ=80 . . . . 52

5.7 Kelton and Law Regression Method output in M/M/1 system simulation with λ=90 . . . . 53

5.8 Kelton and Law Regression Method output in M/M/1 system simulation with λ=95 . . . . 54

ix

Page 12: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

x

Page 13: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

List of Tables

5.1 Table of Discarded Bias on M/M/1 with Welch’s Method . . . . . . . . . . . . . . . . . . 47

5.2 Table of Discarded Bias on M/M/1 with SPC’s Method . . . . . . . . . . . . . . . . . . . 50

5.3 Table of Discarded Bias on M/M/1 with Kelton and Law Regression Method . . . . . . . 54

5.4 Table of results on M/M/1 with Yucesan Method for several λ values . . . . . . . . . . . 55

5.5 Table of Discarded Bias on M/M/1 with Kelton and Law Regression Method . . . . . . . 56

5.6 Table of counts on M/M/1 with Crossing of the Means Rule for λ=50 . . . . . . . . . . . 57

5.7 Table of counts on M/M/1 with Crossing of the Means Rule for λ=80 . . . . . . . . . . . . 57

5.8 Table of counts on M/M/1 with Crossing of the Means Rule for λ=90 . . . . . . . . . . . . 57

5.9 Table of counts on M/M/1 with Crossing of the Means Rule for λ=95 . . . . . . . . . . . . 57

5.10 Table of Discarded Bias on M/M/1 with Conway Rule . . . . . . . . . . . . . . . . . . . . 59

5.11 Comparisson Welch’s Method vs. SPC Method . . . . . . . . . . . . . . . . . . . . . . . . 60

5.12 Comparisson Kelton and Law Regression Method vs. Randomization Tests for Initializa-

tion Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

5.13 Comparisson Crossing of the Means Rule vs. Conway Rule . . . . . . . . . . . . . . . . . 60

xi

Page 14: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

xii

Page 15: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Listings

4.1 Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.2 Auxiliar Function of Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

4.3 SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.4 Kelton and Law Regression Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

4.5 Randomisation Test for Initialization Bias (Yucesan Method) . . . . . . . . . . . . . . . . . 39

4.6 Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.7 Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

A.1 M/M/1 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

A.2 M/M/1 auxiliar function for replications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

xiii

Page 16: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

xiv

Page 17: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

1Introduction

Contents

1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Structure of the Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1

Page 18: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

John von Neumann was one of the pioneers of the concept of simulation. In the 1940s, he aimed to

develop several simulations of a model and collect the statistic results in order to determine the behavior

of a real-life system. Later that method was named “Monte Carlo Method”, as it uses randomly generated

numbers to simulate behaviors and realize its statistical characteristics. These situations happen in the

casinos, especially in the roulettes and dice, and so the method was named after the city Monte Carlo,

in Monaco, which is known by its casinos.

Some techniques used in simulations sometimes come from real-life models found in several areas. In

telecommunications, stochastic discrete event simulations have been vastly used to analyze and plan

new communication networks as they offer performance modeling flexibility, without the restriction of

computer and time resources and costs. Stochastic simulations are a powerful tool for exploring and

predicting the behavior of stochastic dynamic systems as telecommunication networks. In fact, stochas-

tic discrete-event simulation has already become a commonly used tool, adopted by scientists and engi-

neers in this area, contributing to many published research results. These simulations also contributed

to make appropriate assumptions about the network’s internal mechanisms, limitations, stochastic char-

acteristics of processes which will be simulated [24].

Since random processes are simulated, any stochastic simulation needs to be seen as a (simulated)

statistical experiment and, therefore, it needs to have several methods of analysis of (random) simulation

output data [23]. Regarding the input data analysis used to run a simulation, customer mean interarrival

times is also a variable and the arrival rate of a Poisson process is an example of a parameter [17].

Let’s suppose the simulation generates results for a univariate response of interest denoted by Y. In

other words, there is univariate analysis which explores a variable in a data set, in separate ways and

it observes the range of values and also the main tendency of the values, so it describes the pattern of

response to the variable, like in the M/M/1 queuing system, the response we can observe can be the

average waiting time in the queue or the average number of clients in the queue.

Regarding the output data of the simulation, the output analysis is the modeling stage where, for exam-

ple, the replications are designed into a graphical format, and the focus is the determination of output

statistics of the simulation. Later in this project, there will be a description of other methods to analyze

the output data. The output analysis implies three stages: replication design -it allows good design of

simulation replications and obtains the most statistical information from the observations without using

many computational resources. The focus is also to minimize the number of replications and their length,

and still obtain reliable results; estimation of performance metrics -replication statistics give the informa-

tion for computing point estimates and confidence intervals for system parameters of interest. Most

issues are about the size of the sample to be collected and the independence of observations used to

2

Page 19: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

compute statistics; system analysis and experimentation where statistical estimates help to interpret and

understand the system’s behavior and generate performance predictions under several situations, such

as different input parameters (parametric analysis), and scenarios of operation [25].

There are two types of simulation regarding output data analysis: terminating simulation and non-

terminating simulation. This project aims the non-terminating simulation, which is the case of the M/M/1

queuing model simulation, since it is the analysis of the queue’s length in a system with a single server,

a largely studied theme regarding the telecommunications area. Non-terminating simulation is a system

that is always running, it runs continuously. A steady-state simulation is a simulation whose objective is

to study long-run behavior of a non-terminating system. In a non-terminating simulation, we have the

transient state and we also have the steady-state, where it shows the distribution of the random variable

from a particular point will be approximately the same as each other and it is independent from the initial

conditions [19].

Many approaches can be used to analyze the output data. Most of the used methods are focused

on removing the initial bias from a steady-state simulation, which means that it is much required to

overcome the initial transient problem, the warming up the model that is being used. The main theory

is to delete a reasonable number of observations from the beginning of the run and use the rest of

the observations to estimate the values of interest. The present work aims to understand the initial

bias and the conditions of a steady-state simulation that are sometimes contaminated and lead to the

wrong conclusions of the studied system. This bias lead to inaccurate results when building confidence

intervals and other statistical measures.

1.1 Motivation

The need to eliminate the initial bias from steady-state simulation is a widely known challenge in the

output simulation analysis area. The main reason is because non-terminating simulations do not have

pre-defined run lengths or initial conditions. The processes start without restrictions, which leads to

the appearance of bias in steady-state parameter estimates. Currently, there are methods to remove

the initial bias, but there isn’t a generally accepted method which performs suitably for all applications.

Additionally, there is some lack of detail of the initial transient problem in practice. As a result, simulation

models could be incorrectly used.

3

Page 20: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

1.2 Objectives

This project analyzes the effectiveness of several techniques in eliminating initial bias from steady-state

stochastic simulations. Several methods will be discussed and will be compared in detail to review

their performance. The work relies on the analysis of simulation output with the purpose of removing

contaminated observations (initial bias) from the steady-state.

After removing the initialization bias, it is possible to make inferences in the simulation and, finally, make

the correct comparisons between the theoretical values and the practical values in the M/M/1 queue,

which is the stochastic model studied in this work. This work will study the accuracy of the methods

and techniques used to remove the initial bias from the simulation. Since the initial transient state

characteristics sometimes are different from the steady-state characteristics, the warm-up length of the

simulation must be also calculated with these methods in order to avoid the main problem of initialization

bias.

Several solutions have been proposed for the detection, and removal, of the initial bias from the transient

phase. Also, the determination of the warm-up period and the steady-state conditions is also crucial,

followed by the deletion of the collected warm-up data. During a run, while the simulation is running,

and the values of performance measures are being measured, the quality of the estimation is of great

importance. This quality is proportional to the number of measured samples, but only when those

samples come from unbiased observations of the stochastic simulation.

Since there is no standard setup of state variables for a stochastic simulation, it sometimes starts empty

or starts with default state variables. This leads to systematic bias in the results, which fades as the

simulation run becomes longer, and in this way the estimated result will be closer to the real value if this

initial phase with bias is ignored. So this project is focused on properly choosing the initial conditions

and the main purpose is to reduce considerably the initial bias. So, in summary, the main challenge of

this project is to determine when the stochastic simulation reaches a steady-state.

On the other hand, if we discard more samples, the impact of the initial bias will be lower, but on the other

hand, with less functional samples, it will lead to a higher variance of the estimated result [4]. There

have been various methods that have been suggested in diverse scenarios and applications. Many

methods are known to be widespread and are nowadays being used in several simulation software

tools. Nonetheless, these methods need to be assessed, and compared [12]. The objective of this

project is to detect and remove the initial bias and also provide a comparative analysis between various

transient detection and removal methods. This not only helps in the evaluation of multiple algorithms, but

also eliminates the need for separate implementations. The main objective is to understand the methods

4

Page 21: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

and compare their performance in a modern computing environment, and to be a basis to support the

progress of new advanced algorithms int the future.

1.3 Structure of the Document

In chapter 2, the related work is laid out to set the context, which includes a study of the system and the

methods that are used.

In Chapter 3, the architecture that will be implemented in this work is described. Also, a methodology

for evaluating it is presented.

In Chapter 4, the process of performing the work is described and the collection and processing of data

to be used is explained.

In Chapter 5, the design of the solution itself is carried out, as well as its evaluation.

Finally, in chapter 6, the conclusions drawn from the assessment of each method and system are pre-

sented, together with proposals for future research.

5

Page 22: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

2Related Work

Contents

2.1 Stochastic Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Steady-State Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Initial Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.4 Graphical Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2.5 Statistical Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.6 Heuristic Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.7 Queuing Model M/M/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.8 Comparison between Matlab and other simulation software . . . . . . . . . . . . . . 20

2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6

Page 23: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

In this chapter, some contextual information about concepts and methods that are relevant in this work is

set. We will give a notion of stochastic simulation, steady-state simulation, initial bias, graphical methods,

heuristic methods and statistical methods regarding the output analysis.Finally, a comparative analysis

will be included.

It is of great importance to study stochastic simulations in the area of telecommunications because it

is extensively used to analyze and design new communication networks.The main advantage is that

it gives flexibility of performance modeling at any level of detail, which is commonly restricted by the

computational resources of the computers.

The identification and study of techniques that determine when a stochastic simulation has reached the

steady-state was highly important. Therefore, it became necessary to identify and eliminate the initial

transient of a simulation and also to determine performance measures.

2.1 Stochastic Simulation

In a discrete-time event simulation, a simulation either can be deterministic or stochastic. If a simulation

model does not contain any random elements, it is deterministic. In deterministic models, the output

is univocally determined by the set of simulation input values. Nevertheless, several systems have

to be modeled as having at least some random input elements, and these are the root of stochastic

simulation models. A stochastic simulation is a compilation of random variables that are related with

certain probabilities and then ordered over time. These stochastic processes either can be discrete or

continuous in time.

Based on a stochastic model, it is created a stochastic simulation that gives a projection which is based

on a set of random values. This projection can be an estimation of a system’s behavior since many

real-world models of experiences in several areas are too complex to be analyzed with mathematical

techniques and they are often time consuming, expensive, or merely impossible to execute.

The main advantages of using stochastic simulation is that it is possible to describe most complex, real-

world systems with stochastic elements and evaluate them analytically. Also, simulation is often the

only possible way of investigation; stochastic simulation allows one to estimate the behavior of a system

under some pre-defined set of operating conditions; it is easier to maintain a much better control over

experimental conditions than would be possible when working with the system itself. On the other hand,

there are some disadvantages regarding stochastic simulation. Each run of a stochastic simulation can

7

Page 24: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

only translate into estimates of a system’s real characteristics for a distinct set of input parameters. Also,

independent runs of the simulation require a study of all the different set of input parameters that are

going to be used. This is not as practical and optimized as it is desired since there is not a standard set

of input parameters. On the contrary, when a set of input parameters is reached and it is appropriate, it

can result in observations more accurate and exact of the system’s characteristics. So, if an “accurate”

analytical model is easily developed, it will generally be preferred to a simulation model.

Finally, one great disadvantage is the considerable volume of numbers originated from the simulation

study that often creates a big tendency to give a greater confidence in a study results than is justified. If

an “accurate” representation of the system’s behavior is not achieved, then the simulation’s results will

not provide an helpful information regarding the actual system. So, as it was said in the beginning of this

section, a stochastic process is a compilation of similar random variables which are organized over time

and are all defined on a common sampling area [1, 25].

Due to the focus of this project being in the area of telecommunications, we consider a single-server

queuing system; the M/M/1 queue with independent and identically distributed interarrival times A1,

A2,..., and independent and identically distributed service times S1, S2,..., and customers served in a

FIFO manner [18].

2.2 Steady-State Simulation

Simulations can be analyzed as being either terminating or non-terminating. A terminating simulation

runs for a certain duration of time TE , where E is a given event (or a set of events) which concludes

the simulation. Such simulation starts at time Ti under established initial conditions and stop at the time

TE . An example would be a commercial establishment, for example a bank, that is open from 9 a.m. to

5 p.m. , so the focus is to measure the quality of customer service in this specified 8 hours. Here the

initial condition is the number of customers present at time E[t] = 0 (which is to be specified). In this

same example, a kind of measure that can be used is the number of transactions that occurred within

that finite time period.

Non-terminating simulation is a system that is running continuously in time. A steady-state simulation is

a simulation whose purpose is to study the long-run behavior of a non-terminating system. An example

is a continuous process with no ending conditions, like the traffic flow on a network. In this project, the

steady-state parameters of significance are estimated from non-terminating simulations. There are two

strategies used to calculate the steady-state mean value of the performance measure of interest [17, 25]:

8

Page 25: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

1. Fixed batch size – An individual run of arbitrary length is ordered and a confidence interval is con-

structed about the sample mean or other measures of interest.

2. Sequential procedures – Simulation length is sequentially incremented until an “acceptable” confi-

dence interval is reached.

This project is focused on fixed sample size procedures that can be used after the simulation has been

performed for a pre-defined amount of time, long enough to allow the model to reach a steady-state.

There are many fixed batch size procedures that can be used after the run of simulation has been done

for a pre-defined amount of time and cycles, and long enough to allow the M/M/1 model to reach the

steady-state and those procedures are the main topic of this project.

Most network simulations integrate stochastic responses of interest (for example, the mean time in the

system, the mean time in a queue, the mean number of clients in a queue and the mean number of

clients in the system and many other simulation behavior characteristics) due to the intrinsically variable

constitution of the network. Observations of the simulation lead to parameter estimates and they cannot

be a exact representation of the behavior of the steady-state, as the steady-state distribution is unknown.

Since characteristics of the real-world systems change over time and do not have a true steady-state

distributions, it is necessary to make inferences about the stochastic process to later analyze a set of

the simulation results. An example is to suppose that the stochastic process is covariance-stationary.

This is characterized by Law and Kelton, where µ represents the steady-state average [17]:

µ = limi→∞

E[Yi] or µ = limm→∞

1

m

m∑i=1

Yi (2.1)

Being steady-state does not imply that the random variables will take on the same values every time

but it does mean they will have nearly the same distribution. The rate of convergence of the transient

distribution depends on the initial parameters and conditions. On the other hand steady-state distribution

does not.

The definition of steady-state used in this project is when the characteristics of the simulation model,

obtained after a long run of the simulation, with a length where the output is “almost without the influence

of initial conditions”. Since it is up to the user to decide the run length and other parameters, the definition

of steady-state is subjective and it is very dependent on the user’s interpretation of “almost without the

9

Page 26: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

influence” [5, 6].

It is of great interest to test several performance measures since each individual performance measures

could reach steady-state at different times. So it is important to review in detail each performance

measure to study initialization bias and to use a “warm-up” length that is acceptable for all of them. It

should be mentioned that other performance metrics can be used to test the steady state, for example

the queue length. However, future experiments should be initiated to study the potential benefits of

alternative measures or combinations of measures [8].

2.3 Initial Bias

It is of great importance to increase the credibility of the results of stochastic simulation studies without

leaving behind their stochastic nature. Also important, is the need of a proper statistical analysis of

simulation results.

Telecommunications is an area in which dynamic systems with random data and results are becoming

extremely common. Although there has been a great advance in the simulation techniques and methods,

the results are merely random samples. So, the studies about those results are not taken seriously

without a proper statistical analysis. A profound knowledge of the behavior of the studied systems is

only gained through a correct and proper analysis of the results. In other words, the main focus is to

gain an insight and not just to see the numbers.

In a stochastic simulation, a single cycle (or execution) of the system can produce a large amount of

results. If the random nature of the results is ignored, it is simpler to toss a coin and see if it is “heads”

or “tails”, instead of using a simulation program which consumes time, money and resources. In a

situation where the same simulation program is executed, and each run produces different results, it is

fundamental to have statistical inferences.

In this section, it is only discussed steady-state simulations with the purpose of a better understanding

of the M/M/1 waiting queue after a long period of time. When the simulation starts, the queue is in

a non steady-state phase, known as the warm-up period. When the simulation is settled, it moves

asymptotically towards the steady-state phase. Remember that different parameters and different initial

conditions lead to steady-state with different rates [3].

Once the observations collected through the transient periods do not characterize the steady-state, it is

logical to discard the initial observations, known as initial bias, before going through an analysis of the

results. It is needed to have a specification of the initial conditions and parameters in each run of the

10

Page 27: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

program in a stochastic simulation model. There are several ways to choose the initial conditions, for

example, they can be chosen randomly according to a joint probability of their occurrence. However, this

practice is very unlikely to happen because it is impractical. Due to the complications of finding initial

conditions appropriate to every case, when the program starts running, it starts in a non-steady-state

phase. When that phase is over, the warm-up period, then the program evolves to a steady-state phase

with statistical equilibrium [15].

To understand the whole process related to the initial bias, let’s explain the meaning of statistical equi-

librium. Consider a stochastic process with the results Y1, Y2,... Suppose Fi (y‖ci) = P Yi ≤y‖ci for i

= 1, 2,... where y is a real number and ci is a representation of the initial conditions.

The function Fi (y‖ci) the transient distribution function of the results in the moment i, given the initial

conditions ci. Which means Fi (y‖ci) depends of i and ci. If y and ci have fixed values, then the

probabilities F1 (y‖ci), F2 (y‖ci),... are just following one after the other, a succession of numbers. If

Fi (y‖ci) → F(y ) when i → ∞ for every y and for any ci ,then it is possible to say that F (y) is the

steady-state distribution function of the output data process Y1, Y2,... Thus, there is one l such that the

distributions from this point will be approximately equal. So steady-state means that random variables

Yl+1, Yl+2 will have approximately the same distribution [11, 17].

It is important to collect all data outside the warm-up period because they contribute to the characteriza-

tion and analysis of the equilibrium state. What is needed is precisely to discard the initial bias from the

warm-up period before making any statistical analysis, so that it is possible to draw correct and reliable

conclusions related to the system’s behavior when it enters to the equilibrium state. It is not advisable

to dismiss the importance of the initial bias as it may result in significant bias in the results and change

means [26]. However, not taking into account part of the results can cause an increase in the variance

of the estimators.

To identify the initial bias in a stochastic simulation, first it is required to identify the warm-up period, so

then it is possible to make a proper analysis. There are several methods and combination of techniques

to determine the transient period. The most important will be described later in this project.

2.4 Graphical Methods

The goal of this project is to determine the warm-up length so that it is then possible to remove the initial

bias. Throughout the years there were several studies that came up with several methods that determine

the warm up length.

Graphical approaches rely upon the visual analysis of time-series of the simulation output. They go from

11

Page 28: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

barefaced inspection of the simulation output from the user’s vision, to the partitioning of the data into

batches and the calculation of moving averages [10].

2.4.1 Welch’s Method

Regarding the graphical methods that are the subject of this section, the Welch’s Method is the simplest

and the most common graphical technique used for determining the warm-up length. This method

requires several replications. The Welch’s Method is explained in the following steps as given in Law

and Kelton [17, 28]:

1. Make n replications of the simulation where each has a run lengthm. Let Yji be the ith observation

from the jth replication. Thus i takes values from 1 to m and j from 1 to n.

2. Determine the ensemble averages over the replications. There will be Yi’s where:

Y i =1

n

n∑j=1

Yji for i = 1, 2, ...,m (2.2)

3. Define a moving average Yi(w) to smooth the oscillations with high frequency in Y 1 , Y 2, ..., Y m .

Where w is the window and is a positive integer. w is less than or equal to m/4. Yi(w) is as follows:

1

2i+ 1

i−1∑s=−(i−1)

Y i+s for i = 1, 2, ..., w (2.3)

1

2w + 1

w∑s=−w

Y i+s for i = w + 1, w + 2, ...,m− w (2.4)

4. Plot Y i(w) for i = 1, 2,..., m − w and choose L to be the value of i beyond which Y i(w) seems to

be converged.

For the Welch’s Method to work, it needs the specification of three parameters. In other words, it need

the run lengthm, the number of replications n and the window size w. There are some recommendations

on choosing the parameters n, m and w:

• Initially, start with n replications but with m as large as practical. Also, m should be larger enough

to allow occasional events (for example, machine breakdowns) to occur a reasonable number of

times.

12

Page 29: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• Plot Yi(w) for considerable times of the window w and choose the smallest value of w for which the

corresponding plot looks “reasonably smooth”. Then, this plot is used to determine the warm-up

length l.

• If there is no satisfactory value of w in the previous step, it will be needed to make additional

replications of length m.

The greatest difficulty when applying Welch’s Method is that it requires a large number o of replications

n when the process Y 1, Y 2,... is highly variable [20].

2.4.2 SPC Method

Statistical Process Control (SPC) is another graphical method to analyze the output data of a stochastic

simulation. In SPC there are these main concepts: “common” or “inherent” causes are sources of

variation that are unavoidable, for example small variations, caused by the machine’s performance. In

these circumstances the process is assumed to be varying according to some fixed distribution about a

constant mean. And this other concept “special” causes of variation can be corrected or eliminated. In

these circumstances the process ceases to vary according to some fixed distribution about a constant

mean. When special causes of variation occur, the process is said to be “out of control”. The purpose of

SPC is to determine when a process is going out of control, that is, there is the presence of initial bias

that affect the process, so the process may need to be corrected.

There is a close relationship between the concepts of SPC and the warm-up period in steady-state

stochastic simulation output analysis. A model that is in steady-state can vary about a constant mean

according to some fixed distribution, while the transient period does not. As such, a simulation that is in

steady-state could be considered to be “in control”, while during a transient state it can be considered to

be “out of control”. So SPC can be used to detect when a model is in steady-state, and when it is not.

The method is now described in these steps:

1. This method requires multiple replications. Let Yij denote the observation taken from each replica-

tion, where i is the number of the observation and j is the number of the replication. Then it is required

to calculate the ensemble averages (this is a similar process to step 2 in Welch’s Method). Ensemble av-

erages Y i : i = 1, 2, ...,m are batched in b batches of size k. The means of the batches are represented

as ¯Yi, x = 1, 2, ..., i . It is recommended a 20 batch means. The resulting time series after batching is

represented as:

13

Page 30: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Y (k) = ¯Y1(k), ..., ¯Yb(k) (2.5)

2. A control chart must be constructed with the above time series. The estimates of population mean µ

and standard deviation σ are then calculated from the last half of the series Y (k). After that, the control

limits are calculated with the formula:

CL = µ± zσ√

b/2, z = 1, 2, 3 (2.6)

After the control chart is constructed with the three control limits, the mean µ and the time series Y (k),

it is time to check if the system is said to be “out-of control”. Steady state is reached when the process

is in-control and remains in-control. It is also important to check if the rules below are being followed:

• A point plots outside a 3-σ control limit.

• Two out of three consecutive points plot outside a 2-σ control limit.

• Four out of five consecutive points plot outside a 1-σ control limit.

• Eight consecutive points plot on one side of the mean.

• Initial points all plot to one side of the mean (as per expected bias).

• The warm-up period for the model can be selected by identifying the point at which the time-series

data is in-control and remains in-control.

The SPC method identifies the initial bias with great clarity. In the SPC method there are rules that main-

tain some management and restrictions on the control chart to see if the system is in-control and stays

that way, giving more guidance to the user. This method can be an adequate approach for identifying

the warm-up period and then proceed for the initial bias removal.

One of the advantages of the SPC method is that is based upon visual inspection of a time-series of

the data. So the user is able to identify any changes in patterns in the simulation output and to check if

the system does not reach a true steady-state. Once again, the rules are very strict when determining

when a model is in steady-state, although these may need some analysis and classification due to the

probabilistic nature of statistical analysis [9].

14

Page 31: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

On the other hand, there are some weaknesses in this method. It needs very rigorous assumptions,

especially regarding normality and independence in the data, which implies the use of batch means

method to address the problem. However, some simulation output may not be sufficient. Another dis-

advantage is that much of the output data that goes further the initial transient may still be needed to

determine the warm-up period, both in terms of multiple replications and run-length. So, these data is

still needed when assessing the system’s performance [22].

2.5 Statistical Methods

2.5.1 Kelton and Law Regression Method

To solve the problem of the initial transient, Kelton and Law address to that problem with regression

analysis [16]. Their main assumption is that in a time-series of batch means, if the sequence of batch

means that succeeds the initial transient can be approximated to a straight line with a zero slope, then

the initial transient has ended after batch b0. It is also presumed that the correlation between batches

may be significant, so Kelton and Law use the generalized least square regression procedure, which

supports autocorrelation in the regression model.

In order to fit the regression line, the method starts from the end of the series and then moves the sector

backwards until the slope of the line is undoubtedly different from zero. If there is not a zero slope in the

line that is initially fitted, the replication length must be is increased. However, the number of batches is

kept fixed.

Indeed, there are some problems with this method. In the first place, the assumption that the data

converge to the steady-state mean monotonically, but it may not happen. This reduces drastically the

method’s applicability and performance. The second problem is that the method requires the estimation

of many parameters. The authors suggest some values, but they may not be useful in all situations.

Finally, the use of the least square regression procedure that is much generalized turns the method

relatively complex [18].

2.5.2 Randomization Tests for Initialization Bias

This method was present by Yucesan in 1993 to detect the initial bias and it is based on the random

shuffling of batched data and testing for the significance in the difference of two means. The primary

advantage of this method is that no assumptions are required. The null assumption for this method is

that there is no initialization bias in the output mean. These are steps that are needed to perform the

method:

15

Page 32: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• The simulation need to run for a length of time m hours. Let Yi be the ith observation from the

simulation output which is run for m hours.

• It is obtained an output time series Y1, Y2,..., Ym.

• The data is put into b batches of length k.

• Then b batch means Y 1 , Y2, ..., Y b. are obtained.

• The batch means are split into two groups. In the first iteration, the first group needs to include the

first batch mean and, for the second group, it must contain remaining b− 1 batch means.

• In each iteration, the grand means of the two groups must be analyzed and compared. A statistic

test is used to observe if there is a significant change in the mean between the two groups; the

statistic test used by Yucesan is the absolute value of the difference between the grand means of

the two groups. If the difference is different from zero between the two grand means (to verify the

significance a distribution of difference is required, since it is unknown, then it is used randomiza-

tion) different from zero between the two grand means, the null hypothesis described earlier in this

method is rejected. By using randomization, an empirical distribution is obtained and the original

observed difference is seen far in the tail.

• If the hypothesis made is abandoned, the groups must be rearranged; so the second batch is

added to the first group and the second group will contain b − 2 batch means and the last step

needs to be repeated

• If the hypothesis was accepted, then the group 2 data is the steady state simulation output.

Having no assumptions about the distribution of the data is one of the greatest advantages of this

method. Furthermore, only a single run is required. However, there are some disadvantages with the

method. In the first place, when shuffling the batches of data, it is required a great volume of calculations

and this makes the procedure execution much slower. The problem is also aggravated as more shuffles

are required for a better result. Secondly, this method assumes that the data are uncorrelated. This is

accomplished by grouping the data into batches [30].

16

Page 33: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

2.6 Heuristic Methods

While graphical methods rely on visual analysis and human judgment, the heuristic methods described

provide very exact rules for determining when the initial bias has been removed. It is worth nothing

that some of the graphical procedures can be adapted to turn into heuristic methods by the addition of

stopping rules [29].

2.6.1 Conway Rule

The method’s author Conway suggested the following rule to truncate the initial data with the aim to

reduce initial bias. “Truncate a series of measurements until the first of the series is neither the maximum

nor the minimum of the remaining set.”

This is executed in the initial runs to decide upon a stabilization period. After that, the period is deleted

from the result of each run. The method’s algorithm is constructed using the steps [9]:

1. It is required to decide n andm the number of preliminary replications and the length of the preliminary

replications, respectively.

2. Then it is computed y+jr and y−jr with the following formulas:

y+jr = max(yjl : l = r, ...,m) j = 1, ...n (2.7)

y−jr = min(yjl : l = r, ...,m) j = 1, ...n (2.8)

3. For r = 1, 2, ...,m it is required to determine tj such that tj=min y−jr < yjr < y+jr appears for the first

time.

4. The truncation point t∗ is then estimated and is given by max t1, t2, t3,..., tn .

This is a very simple method and it is not dependent on any presumptions or the estimation of param-

eters with the exception of the number of replications. This method was tested by Gafarian on M/M/1

system data and concluded that it underestimated the warm-up period for high utilization of the server

rates, and overestimated it for low utilization of the server rates [9].

This rule implements a series of measurements until the first of the series is neither the maximum nor

the minimum of the remaining set of the simulation data.

17

Page 34: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

2.6.2 Crossing of the Means Rule

The author Fishman explains this rule. While the simulation output data is being generated, a running

cumulative mean is being calculated. A count, represented by ω, is the result of the number of times

the output data cross the cumulative mean. The higher the value of that count ω, the more confidence

exists in the fact that the initial bias has been successfully removed. The warm-up period is the number

of observations at which ω is reached.

The pre-specified value depends on the user. The method’s algorithm is based on steps given [7].

1. The simulation output is generated Y1, Y2,...,Ym.

2. The number of times the series crosses the mean is given by ω.

3. Then the calculation of Ω1, Ω2,..., Ωj is made, such that at l the number of crossings is equal to the

pre-defined number.

This rule is very easy and simple to implement, however there is a key problem when it comes to

determine an appropriate value of the parameter ω at which the initial bias is assumed to have been

removed.

Regarding the use of this rule at queuing systems, it is very conservative and overestimates the warm-up

period for low traffic intensities no matter which ω is selected.

2.7 Queuing Model M/M/1

Queuing systems can be found in several applications when modeling and analyzing computer and

communication systems. The study of queuing systems is highly related to the importance of quality of

service in the network and its optimization. The busy period and the waiting time in a queue system play

an important role in the understanding of various queuing systems and their management.

The M/M/1 queuing model is the simplest queuing model in queuing theory. It represents the queue

length in a system having a single server and this system assumes a Poisson arrival process where both

the arrival time and service time are exponentially distributed. The first M denotes the arrival process

as a Markovian one, which means a Poisson process with a fixed arrival rate λ; the second M denotes

the service time distribution as being Markovian with average service time 1/µ; the number 1 represents

the number of servers present on the service station [27].

18

Page 35: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

An M/M/1 queue is considered to be a stochastic process and its state space is defined at the set

0, 1, 2, 3, ... where each value is a correspondence of the number of clients in the system, including those

who are currently in service.

- Let λ be the arrivals rate that reaches the system according to a Poisson process and moves the

process from state i to i+ 1.

- Let µ be the service times with an exponential distribution in the M/M/1 queue. The mean service time

is determined with 1/µ.

This model with only one server serves its clients one at a time according to a FIFO discipline (“first in,

first out” discipline, a method for organizing and manipulating a data buffer, where the oldest (first) entry‘

or ’head’ of the queue, is processed first). When the job is over, the client leaves the queue.

The buffer has infinite size, so there is no limit regarding the number of requests it can accommodate.

A Markov chain is defined as “where a Markov chain stochastic model describing a sequence of possible

events in which the probability of each event depends only on the state attained in the previous event”.

The M/M/1 model is described as a continuous time Markov chain with transition rate matrix Q on the

state space 0,1,2,3,..., with Q defined by [2]:

Q =

−λ λ · · · · · · · · ·µ −(µ + λ ) λ · · · · · ·· · · · · · µ −(µ + λ ) λ· · · · · · · · · · · · · · ·

(2.9)

Carrying out the steady-state analysis of the M/M/1 system, the model is considered stable only if λ <

µ, which translates into the arrival rate λ must be less than the maximum rate service µ. If, on average,

requests arrive faster than the job is done, then the queue will grow indefinitely long and the system will

not have a stationary distribution. The stationary distribution is the limiting distribution for large values of

t.

There are several performance measures that are used for the analysis of the M/M/1 queue. Mainly, the

measure of the utilization of the buffer, who is defined by ρ = λ / µ and it is required that ρ is below 1 for

the queue to be stable. ρ represents the average server occupancy. Another performance measure that

is of great interest in this project is the number of clients in the system which is given by the probability

that the stationary process is in state i (which means it contains i customers, including those in service)

19

Page 36: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

is given by π = (1− ρ)ρi.

There is a geometric distribution in the number of customers in the system with the parameter (1 − ρ) .

Also the average number of clients in the system is given by ρ(1− ρ) and the variance of the number of

clients in the system is given by ρ(1− ρ)2.

2.8 Comparison between Matlab and other simulation software

In this study of a discrete-event simulation, there is the need for a comparison between simulation soft-

ware’s. Many features are needed like generating random numbers or random variates from a specified

probability and collecting output statistics and reporting the results, so it is important to contribute with

a good comparison to the studied area and to considered which is the proper software to use in this

project. There is also a discussion about the advantages and disadvantages of using a simulation pack-

age instead of using a programming language to build the intended simulation model.

When selecting a software to run the simulation, one must consider that it needs to be flexible enough

to run smoothly without erroneous results. There are a number of advantages when using a simulation

package instead of a programming language:

• Simulation packages can provide many features that are needed when building a simulation model,

so time is not spent programming basic functionalities and increasing the total cost.

• Simulation packages also provide an intuitive framework for simulation modelling.

• Simulation model modifications are easier to make and maintain when written in simulation pack-

ages.

• It is easier to detect errors because simulation packages check automatically potential types of

errors.

On the other hand, many programming languages are used to write simulation models. There are some

advantages while doing this:

• The programming language that is being used is well-known by the modelers.

20

Page 37: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• A simulation model well-written in C, C++, or Java may require less execution time than a model

developed in a simulation package. This happens because simulation packages are designed to

address a great variety of systems with one set of modeling constructs.

• Programming languages allow more programming flexibility than some simulation packages.

• Software upfront cost is generally lower.

Law and Kelton consider prudent to give more consideration to the use of simulation packages. In the

previous course “Projecto de Engenharia de Telecomunicacoes e Informatica”, some work was made

using simulation packages (Matlab) and it is wise to keep using the same environment [17].

To run a simulation in this project, there are many software features that are critical to the well-functioning

of the execution:

• General capabilities – modeling flexibility, as the capability to model a system that can perform with

any level of complexity. Another relevant feature is ease of use. A simulation package that has

graphical user interface that is easy to learn and use.

• Hardware and software requirements – the chosen software must be available and compatible with

the used computers used in this project. The memory (RAM) required to run the software must be

taken into consideration as well as the required operating system (OS).

• Statistical Capabilities – running a stochastic simulation, requires a statistical study of the output

results.

• Output graphics – The software must be able to provide a variety of graphics and other software

packages. Since there are graphical methods used in this project, it is important to have graphics

that are a good representation of output data.

After discussing the advantages and disadvantages of simulation packages and programming languages

and emphasizing the main features required in this project, we move to briefly describe some simulation

packages that were considered:

21

Page 38: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

2.8.1 Arena

Arena is a simulation package marketed by Rockwell Automation (Wexford, Pennsylvania) that is com-

monly used for applications such as manufacturing, supply chains, and health care. The main interesting

point about this software is that there are an unlimited number of random-number streams available. The

user has access to standard theoretical probability distributions and has a built-in capability for modeling

nonstationary Poisson processes. It also includes an easy mechanism to make independent replications

of a system during a simulation and to obtain point estimates and confidence intervals for performance

measures of interest.

2.8.2 SIMUL8

SIMUL8 simulation software is used to simulatesystems that involve processing of discrete entities at

discrete times. It allows the user to create a model of a system and takes into account real life constraints

(like RAM capacity), and other factors affecting the total performance and efficiency of the simulation.

Through this model it is possible to test real scenarios in a virtual environment, for example to simulate

planned function and load of the system, change parameters affecting system performance, carry out

extreme-load tests, verify by experiments the proposed solutions and select the optimal solution. The

outputs of SIMUL8 simulation are ”hard data”, values and statistics of performance parameters and

metrics of the production system [13, 14].

2.8.3 MATLAB

MATLAB is a multi-paradigm numerical computing environment. It was developed by MathWorks, and

this software allows matrix manipulations, plotting of functions and data, implementation of algorithms,

creation of user interfaces, and interfacing with programs written in other languages, including C, C++,

C, Java, Fortran and Python. Although the main intention of this software was for numerical computing,

an optional toolbox uses an additional package, Simulink, that adds graphical multi-domain simulation

and model-based design for dynamic and embedded systems.

2.9 Summary

A number of methods were selected for detecting initial bias and were described in the previous sections

under three groups: graphical methods, statistical methods and heuristic methods.

22

Page 39: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

The graphical methods are generally the simplest and easiest methods and they rely on minor assump-

tions, sometimes none. This type of methods only require a few simple calculations, so they can easily

be implemented. Nevertheless, there is some difficulty when estimating parameters for some of the

graphical methods, with very few guidance.

Since there is subjectivity in these approaches, the conclusions may vary and differ from user to user.

Also because the use of cumulative statistics have the tendency to overestimate the warm-up period, it

may affect the accuracy of some of the methods.

The heuristic methods require few parameters to be estimated and they don’t need any assumptions.

The existence of a clear set of rules to determine the warm-up period is a great benefit over the graph-

ical methods, because it takes out the subjectivity and makes the methods propitious to automation,

therefore giving greater ease of implementation. However, there are some difficulties in capturing the

patterns of the data without a graphical aid.

The two statistical methods described earlier in this project require some complex operations. Law and

Kelton regression method requires the estimation of many parameters and it is highly dependent on

assumptions that are very restrictive. The randomization tests for initialization bias involve demanding

computations and it is much likely they give a conservative estimate of the warm-up period.

23

Page 40: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

3Architecture

Contents

3.1 Systems to use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.2 Implementation of Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.3 Results of interest and performance measures . . . . . . . . . . . . . . . . . . . . . . 26

3.4 Evaluation Parameters for the Quality of the Algorithms . . . . . . . . . . . . . . . . 27

3.5 Work Evaluation Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

24

Page 41: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

3.1 Systems to use

When designing the solution, the need arises to use one or more systems that can support what was

intended to implement, in this case, the methods referred in Chapter 3. There are systems widely used

and known in the field of simulation, that allow the study of the behavior of the stochastic simulations to

be used. The M / M / 1 system models the arrival rate of customers to the queue based on the process

of Poisson and assumes that:

• The service rate has an exponential and constant distribution;

• There is a single server;

• The capacity of the queue is infinite;

• The number of users is unlimited.

Through the arrival rate and the service rate of the system, it is possible to calculate the most diverse

answers. The system utilization factor, the percentage of time the server is occupied, is calculated by the

expression ρ = λ / µ. Actually, ρ is one of the characteristics of an M/M/1 system, since the individual

values of λ and µ function only as scale factors. In the case of ρ being greater than 1, it means that the

arrival rate is higher than the service rate, so the system does not reach the statistical equilibrium, and

the number of clients in the system will grow indefinitely. As such, the case of an arrival rate being lower

than the service should be considered in this work.

These type of systems have theoretical formulas for various parameters, which become an important

way of comparison during the experimental run.

A representation of the system is represented in Figure 3.1:

3.2 Implementation of Methods

For the methods implementation, it is intended to apply the rules and principles for each method pre-

sented in Chapter 3. The first part involves the specific implementation of the each method. Then,

25

Page 42: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 3.1: M/M/1 system representation

the next phase concerns the execution of the M/M/1 simulation with each method applied and obtain-

ing of the results. This involves an adjustment process, which is an iterative process, since it involves

systematic experiments in the search for the best fit in each method.

In this work, it will be used the M/M/1 system as a base for the study, starting with the arrival rates of

λ = 50, λ = 80, λ = 90, and λ = 95. It is important to note that these values are base values and may be

adapted to each method, in order to have a more fit study within each technique.

In order to carry out the validation, it will be used a set of metrics, namely:

• Cross-validation, to evaluate the precision of the method, comparing the known theoretical values

with the practical values;

• Variance, to observe more clearly the difference between the estimated values and the actual

values.

3.3 Results of interest and performance measures

During the implementation phase of the solution, it is important to know the answers which are of interest

an that we want to get from the systems we are going to use.

There are some results of interest that can also represent some system evaluation measures:

26

Page 43: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• Time in system

• Percentage of server usage

• Number of clients in the system

Regarding, for example, the time in the system, it describes the time from the moment the customer

enters the system until the time of the dispatch. The term ”client”, in queuing systems, is a generic term,

which may refer to, for example, processes that are waiting for the processor, packets arriving at a router,

or even people who are waiting to be served at a supermarket.

All of these responses becomes important, as they allows us to evaluate the system’s performance.

Once the results of interest have been selected, it is important to choose which measures of performance

will be used on the data collected from these results. In this case, the measures of performance that are

going to be used are the average, and the maximum value of the output of each method applied on a

M/M/1 system.

3.4 Evaluation Parameters for the Quality of the Algorithms

Although ”quality” is a rather subjective topic, it is important to give some notions of parameters that

evaluate the method’s quality.

There are some criteria proposed that represent one of the possible ways for quantifying the performance

of the implemented algorithms, with a possibility of comparing them with each other, since the methods

are divided in three different categories (graphical, heuristic and statistic). Here, we will also specify

some criteria to evaluate the the algorithm under consideration. These are elaborated below [21]:

3.4.1 Cost

The cost parameter is evaluated by calculating the amount of time required for the following three oper-

ations:

• Computing time for the algorithm itself i.e., the computational efficiency.

• Computing time for collecting the output data before estimating the truncation point, and, then

posteriorly discarding the initial bias.

27

Page 44: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• Computing time associated with a bias in the determination of the truncation point.

Although this is not a very exact parameter, the cost score will vary based on the algorithms that are

being executed and the respective input model used, so we can concluded regarding this topic, since

reducing computational costs is one of the objectives of this work.

3.4.2 Simplicity

Simplicity indicates how easy to understand the algorithm is, by programmers with less domain knowl-

edge. The higher the simplicity, the higher the understanding and the easy implementation by a non-

expert. The factors considered for the assignment of the simplicity to each method are: the conceptual

complexity, the extent of mathematical formulae used, and the number of calculations that had to be

made.

3.4.3 Parameters Estimation

The parameter estimation is based on the percentage of the total number of parameters in the algorithm

which are assumed. This is very important because the more parameters are required in the algorithm,

the riskier the algorithm may be in the case of wrong estimations

3.5 Work Evaluation Methodology

The evaluation of the work to be carried out is in the determination of an adequate method for removing

initial bias, considering the arrival rate and if it is a long, medium or short run simulation. For the

evaluation of this work, the proposed methodology is to test the methods referred, and, subsequently, to

test and verify several parameters adjustments. Once the methods are found to meet the requirements

and defined objectives, a comparison is made between the approaches used, with the purpose to verify

whether, in fact, the bias was successfully removed without disturbing the simulation.

3.6 Summary

The architecture of this work was presented along with an explanation of the system that is used and a

range of results of interest and characteristics of evaluation of these same results. A detailed description

of the system is made, along with an explanation of the operation and the description of the metrics made

to validate the results of interest. Finally, after the presentation of the architecture, the methods will be

present and adjusted, in the next chapter.

28

Page 45: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4Implementation

Contents

4.1 M/M/1 System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.2 Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.3 SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.4 Kelton and Law Regression Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

4.5 Randomization Tests for Initialization Bias . . . . . . . . . . . . . . . . . . . . . . . . 39

4.6 Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

4.7 Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

4.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

29

Page 46: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

In this chapter, we describe the process of implementing the work to be developed. Furthermore, the

collection and treatment of the results that will be used will be carried out.

4.1 M/M/1 System

The plan to perform the analysis of the results in the M/M/1 system is as follows:

• Simulate the system using Matlab;

• Use Matlab to process the results from the output data of the simulations, and, remove the initial

bias using each method.

After the simulation of the M/M/1 system, the result is a set of files, where each file corresponds to a

value ρ (utilization factor) that will to be studied within the system. Each of these files contains the time

registered in the system for the different clients o each replication. Other parameters like the number of

replications and the number of clients will contribute to this set of files as follows:

• The number of replications was set to 20, except when the method does not need any replications.

• The number of clients is intended to be 500.000, although it has high computational costs. Other

tested values are 50.000 and 5.000.

4.2 Welch’s Method

Welch’s Method is a graphical procedure, so it is up to the user to decide the warm-up length by observ-

ing a graph of averaged values over time. Thus there is some subjectivity involved in this procedure.

The steps and equations for calculating Welch’s Method are listed below:

• A number of replications rep ≥ 20 is performed, each of length win, where win is the window size

and it is much larger than the anticipated truncation point. The observations are averaged over all

replications at each time-step to create the average process.

30

Page 47: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

• The moving averages are plotted for several values of widow size, win .

• The arrival rate is defined by λ, and the values in this project varied between 50% and 99%,

adapting to the method, to study its effectiveness in bias removal.

• If no value of w is satisfactory, the number of replications must be increased.

• The truncation point is selected visually from the moving averages plot.

Based on computing resources, it was proposed by Welch to start with rep = 10 replications. In this

case, it was decided to use 20 replications. The generated plots are visually inspected and if the moving

averages do not sufficiently converge to a constant value, more replications are performed.

An example graphical output for Welch’s Method is shown in Figure 4.1. In this example the window

size and the number of replications were both increased until the graphic became sufficiently smooth,

resulting in a window size of 500 with 20 replications and 50000 clients for an arrival rate of 50

31

Page 48: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 4.1: M/M/1 system simulation with λ=50

32

Page 49: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

The code used to perform this method is presented below:

Listing 4.1: Welch’s Method

1

2 % calculates moving averages welsh(1983, p.292)

3 % ym -- replicas averages

4 % w -- welch's window size

5 function [ yw ] = welch(ym, w)

6 len = size(ym, 1);

7 for i = 1:w

8 yw(i) = mean(ym(1:2*i-1));

9 end

10 for i = w+1:len-w

11 yw(i) = mean(ym(i-w:i+w));

12 end

Listing 4.2: Auxiliar Function of Welch’s Method

1 % auxiliar fucntion of welch's method

2 function [ wsys wque ] = dowelch(cli, lambda, rep, win)

3 if nargin < 1 cli=55000; end

4 if nargin < 2 lambda = 50; end

5 if nargin < 3 rep= 20; end

6 if nargin < 4 win=500; end

7 [ tsys tque ] = mm1rep(cli, lambda, rep);

8

9 wsys = welch( reshape(mean(tsys),[],1), win );

10 wque = welch(reshape(mean(tque),[],1), win );

11

12 plot (wsys);

33

Page 50: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.3 SPC Method

As was said, the SPC method is a statistical method whose purpose is to minimize the variations in a

simulation. In particular, the SPC method used here is the control hart, which with an upper and lower

control limit quantifies the bounds of natural variation. This implementation determines the mean and

variance based on the mean observations over the replications.

• The number of replications rep, the arrival rate λ and the number of clients cli was defined previ-

ously while running aM/M/1 simulation. Later, a complete discussion regarding these parameters

and values is provided.

• Based on the given parameters and the given rules mentioned on section 2.4.2, and also with the

visual aid of the upper and lower control limit, it is possible to visually understand when the system

is ”under control” according to theoretical prepositions of this method.

An graphical output example for SPC Method is shown in Figure 4.2. The implementation of this method

resulted in a plot with a window size according to the number of clients cli, with 20 replications. In

Chapter 5, a complete discussion about the chosen parameters and values is also provided.

The code used to perform this method is presented below:

Listing 4.3: SPC Method

1

2 % determine the mean and variance based on the mean observations over the

3 % replications.

4 % draw mean and 1x, 2x, 3x standard deviation values

5 % tsys(nreps:nobs) matrix

6 function [ m2, s2 ] = SPC(tsys)

7 cli=size(tsys,2);

8 data=mean(tsys);

9 m2=mean(data(int32(cli/2):cli));

10 s2=var(data(int32(cli/2):cli));

11 plot(1:cli, data, [1 cli], [m2 m2], '-.', ...

12 [1 cli], [ m2+sqrt(s2) m2+sqrt(s2) ], [1 cli], [m2-sqrt(s2) m2-sqrt(s2)], ...

13 [1 cli], [ m2+2*sqrt(s2) m2+2*sqrt(s2) ], [1 cli], [m2-2*sqrt(s2) m2-2*sqrt(s2)], ...

14 [1 cli], [ m2+3*sqrt(s2) m2+3*sqrt(s2) ], [1 cli], [m2-3*sqrt(s2) m2-3*sqrt(s2)])

34

Page 51: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 4.2: SPC output in M/M/1 system simulation with λ=80

35

Page 52: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.4 Kelton and Law Regression Method

Kelton and Law use the least square regression procedure for a first degree polynomial and determine

its slope. The steps for implementing this method are listed below:

• The function receives as parameters a matrix tsys witch is a matrix of the number of replications

and the number of observations (clients), and also receives the window size, which must be equal

to the number of observations. The function returns the slope of the function in each coordinate.

• The parameter tsys results from an execution of an M/M/1 simulation with the number of repli-

cations rep, the arrival rate λ and the number of clients cli defined previously. In Chapter 5, a

complete discussion regarding these parameters and values is provided.

• The returned value ans, the closer it is to zero, the greater the confirmation that the initial transient

has ended with the sequence of batch means that succeeds the initial transient can be approxi-

mated to a straight line with a zero slope.

An example of this method is shown in Figure.4.3 , where it is very explicit the least square regression in

several points of the plot, for an arrival rate of 95, with 10000 clients, using a window size of 1000, which

results in 10 batches and 10 slope values. Also, there is an output of a vector of values that represent

the slope for each batch. In this example, the values were :

[0.1776;−0.0132;−0.0546; 0.0049; 0.0010;−0.0287;−0.0069; 0.0659;−0.0700;−0.0020 ]

In visual and numerical terms, it can be seen that the initial bias is in the first batch, which is the one

what contains the highest slope.

36

Page 53: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 4.3: Kelton and Law Regression Method output in M/M/1 system simulation with λ=95

37

Page 54: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

The code used to perform this method is presented below:

Listing 4.4: Kelton and Law Regression Method

1 % Kelton and Law use the least square regression procedure for a first

2 % degree polynomial and determine its slope.

3 % tsys(nreps,nobs) : matrix of observations for all replications

4 % win : window size

5 % returns : d(slopes), x,y (slope segment coordinates)

6 function [ d x y ] = LawKelton(tsys, win)

7 cli=size(tsys,2);

8 x = [];

9 y = [];

10 d = [];

11

12 %for i = 1:win:(size(mean(tsys)(:))-win)

13 for i = 1:win:(cli-win+1)

14 m = mean(tsys);

15 p = polyfit((1:win)/win, m(i:(i+win-1)), 1);

16 d = [ d p(1) ];

17 x = [ x i i+win ];

18 y = [ y polyval(polyfit(i:(i+win-1), m(i:(i+win-1)), 1), [i i+win]) ];

19 end

20 plot(1:cli, mean(tsys), x, y);

38

Page 55: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.5 Randomization Tests for Initialization Bias

For the method Randomization Tests for Initialization Bias, also known as Yucesan Permutation Test, a

function was developed in Matlab. The implementation of this function is as follows:

• This method requires 6 parameters: yucesan (y, b, m, corr, NS, NL) where y is the vector of

the observations collected (the dimension must be at least b), b is the number of initial lots,mis the

initial size of the lots, corr is the value of the maximum correlation allowed between lots, NS is the

number of shuffles, and NL is the desired level of significance.

• The result of this function determines the number of observations that must be present in each

batch, as well as the number of observations that must be removed (corresponding to the initial

bias). The value of the variable corr is used as a threshold, since it is intended that the value of

the correlation between the different batches is as low as possible.

• Since y is a vector of the collected observations (there is no need for replications in this method),

it was previously executed an M/M/1 simulation with the number of replications rep defined as

1, the arrival rate λ and the number of clients cli. In Chapter 5, a complete discussion regarding

these values is provided, since choosing these values is a challenge in this particular method.

The code used to perform this method is presented below:

Listing 4.5: Randomisation Test for Initialization Bias (Yucesan Method)

1 function [ out, rho, ms, sl, split ] = yucesan(y,b,m,corr,NS,SL)

2 % This function implements the Yucesan test for detecting the length of the initial

3 % transient phase by randomization. (see Naval Res. Logistics, 40 (1993), 643-663)

4 %

5 % The parameters are:

6 % y - vector of the collected observations (size may be greater than b*m)

7 % b - the number of batches

8 % m - the initial batch size (number of observations)

9 % corr - maximal serial correlation among batches

10 % NS - number of shuffles (must be significantly smaller than b!)

39

Page 56: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

11 % SL - desired signifcance level

12 %

13 % Returns:

14 % rho - Achieved maximal serial correlation among batched

15 % ms - Batch size

16 % sl - Lowest significance level obtained

17 % split - Number of batches to be removed

18 % out = split*ms - Observations to be removed

19 %

20 ok = 0;

21 minrho=1;

22 minbs=m;

23 sz=size(y,1);

24 for ms=m:100:sz/b

25 Z=zeros(1,b);

26 for i=1:b,

27 Z(i) = mean(y((i-1)*ms+1:i*ms));

28 end

29 rho=sum((Z(1:b-1)-mean(Z)) .* (Z(2:b)-mean(Z))) / sum((Z-mean(Z)).ˆ2);

30 if abs(rho) <= corr

31 rho = abs(rho);

32 ok = 1;

33 break

34 end

35 if minrho > abs(rho)

36 minrho = abs(rho);

37 minbs = ms;

38 end

39 end

40 if ok == 0

41 fprintf(2, 'threshold(%G) serial correlation among batches not achieved...

42 for %G observations per batch\n', corr, ms);

43 ms = minbs;

44 rho = minrho;

45 if corr ~= 0

46 out=-1;

47 return

48 end

40

Page 57: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

49 end

50 fprintf(2,'%G observations in each batch (corr = %G)\n', ms, rho);

51

52 minsl=1;

53 minsp=b;

54 for split=1:b-1 % number of batches in the hypotetical initial transient (set G1)

55 T = abs( mean(Z(1:split)) - mean(Z(split+1:b)) );

56 nge = 0;

57 for shuffle=1:NS

58 Zsh = Z(randperm(b));

59 Tsh = abs( mean(Zsh(1:split)) - mean(Zsh(split+1:b)) );

60 if Tsh >= T

61 nge = nge + 1;

62 end

63 end

64 sl = (nge+1)/(NS+1);

65 %fprintf(2, '%G = %G significance level with...

66 %G batched in first set\n', sl, SL, split);

67 if SL > sl

68 out = split*ms;

69 fprintf(2, 'remove %G observations (from %G batches ...

70 of %G observations)\n', out, split, ms);

71 return

72 end

73 if sl < minsl

74 minsl = sl;

75 minsp = split;

76 end

77 end

78 fprintf(2, 'signifcance level (%G) not reached\n', SL);

79 fprintf(2, 'lowest signicance level obtained ...

80 (%G) for %G batches of %G observations\n', minsl, minsp, ms);

81 sl = minsl; % Lowest significance level obtained

82 split = minsp; % Number of batches to be removed

83 out = split*ms; % Observations to be removed

84 if SL ~= 0

85 out = -1;

86 end

41

Page 58: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.6 Conway Rule

The main goal of this method is to truncate the initial data with the aim to reduce initial bias. This is

executed in the initial replications, and, after that, the period of the initial bias is deleted from the result

of each run. It will be followed the suggestion of 20 replications (it can vary around that value) and the

number of clients will vary from 5000 to 500000.

This rule implements two measurements mentioned in section 2.6.1, until the first of the series is neither

the maximum nor the minimum of the remaining set of the simulation data.

The code used to perform this method is presented below:

Listing 4.6: Conway Rule

1 % Conways's rule for individual observations

2 % tsys(nreps,nobs) : matrix of observations for all replications

3 % returns : bias(observation number)

4 function bias = Conway (v)

5 bias = 0;

6 for i = 1:size(v,1)

7 t(i) = max( [ find(v(i,:)==min(v(i,:))) find(v(i,:)==max(v(i,:))) ] );

8 end

9 bias = max(t);

42

Page 59: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.7 Crossing of the Means Rule

In this method, the simulation output data is being generated, and, at the same time there is a cumulative

mean that is also being calculated. A count is made of the number of times the output data crosses

the cumulative mean. This method determines the number of mean crosses, and stops when those

crosses reach a pre-defined threshold and returns the observation number. So, the challenge of this

method is to determine the most adequate value of the threshold for each situation, in other words, for

each arrival rate that is being studied. This method does not need any replications. There are some

recommendations from the author of this method, Fishman, when choosing an adequate parameter.

Those suggestions will be followed, and will vary around these recommended values and it will be

adapted to each situation, so it is possible to reach viable results to take conclusions about this method’s

performance. The higher the number of crosses (with a specific threshold), the greater the confidence

that the initial bias has ended.

The code used to perform this method is presented below:

Listing 4.7: Crossing of the Means Rule

1 % determine the number of mean crosses

2 % stop when crosses reaches threshold and return the observation number

3 % tsys(nreps,nobs) : matrix of observations for all replications

4 % if threshold is negative, count all crosses

5 % returns : t(observation after threshold crosses), cnt(number of crosses)

6 function [ t, cnt ] = CrossMean(tsys, threshold)

7 sum=tsys(1);

8 cnt=0;

9 above=0;

10

11 for t = 2:size(tsys,2)

12 sum = sum + tsys(t);

13 if (above == 0 & tsys(t) > sum/t) | (above == 1 & tsys(t) < sum/t)

14 cnt = cnt + 1;

15 above = 1 - above;

16 if threshold == cnt

17 return

18 end

19 end

20 end

43

Page 60: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

4.8 Summary

The algorithm of the methods has been described in this chapter in a more technical detail. The code of

each method was presented, specifying the parameters associated to each one, followed by a discussion

of the possible values for the parameters and presentation of examples of output of each method.

44

Page 61: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5Design

Contents

5.1 Design process in Welch’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

5.2 Design process in SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

5.3 Design process in Kelton and Law Regression Method . . . . . . . . . . . . . . . . . 51

5.4 Design process in Randomization tests for initialization bias . . . . . . . . . . . . . . 55

5.5 Design process in Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . 57

5.6 Design process in Conway Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

5.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

45

Page 62: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

In this chapter the design of the solution will be carried out, the adjustment process itself in each method.

As previously mentioned, the adjustment of the parameters in each method is required to understand

which method is the most adequate for each situation.

5.1 Design process in Welch’s Method

Before the adjustment of each method, it was necessary to do a previous study of this method’s behavior

with certain pre-defined parameters. Matlab offers a plot function which allows us to visually understand

where the initial bias has ended. In this section several graphics will be presented in order to understand

which input values are the most adequate to use in this method.

The following parameters were used in Matlab for an initial study:

dowelch(5500, 50, 20, 500)

The result is shown in Figure 5.1 , which is an output of an M/M/1 simulation with this method applied

with 5000 clients, 500 size window, 20 replications and arrival rate of 90%.

If we ”zoom-in” the x-axis of the plot, it is possible to observe more clearly where the bias ends, as it is

possible to see in Figure 5.2

Applying the method with several arrival rates, maintaining 20 replications, allows us to observe the initial

bias, and select how many clients to discard. Also, knowing previously some theoretical measures, it is

easier to do the comparison with the values obtained in the experience. The results are in Table 5.1.

This method has gained wide acceptance due to its simplicity, assumptions and ease of implementation.

Its accuracy has shown also to be good. But, since the method is based on the use of cumulative

statistics, it may be somewhat conservative, overestimating the warm-up period [9]. Observing the

practical values, with and without bias, it can be verified that the system behaves near-expected, and it

may be possible to state that the initial bias no longer contaminates the system values.

46

Page 63: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 5.1: Welch’s Method output in M/M/1 system simulation with λ=90

λ Nº of Clients Discarded ”bias” Theoretical tsys Practical tsys Practical tsys w/o Bias50 50000 20 0.02 0.02002 0.0202180 50000 70 0.05 0.04745 0.0511990 50000 170 0.10 0.10340 0.1019095 50000 550 0.20 0.18460 0.20720

Table 5.1: Table of Discarded Bias on M/M/1 with Welch’s Method

47

Page 64: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 5.2: ”Zoom-in” Welch’s Method output in M/M/1 system simulation with λ=90

48

Page 65: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5.2 Design process in SPC Method

Also for this method, Matlab offers a plot function which allows us to visually understand where the initial

bias has ended. Following the authors suggestion to use several replications, this parameter was set to

20 in every simulation with different arrival rates and number of clients.

For a warm-up of this method’s study, the first simulations had parameters such as the arrival rate set at

50 and the number of clients set to 5000, in order to gain initial understanding of the functioning of this

method. The second simulations had as parameters the arrival rate set at 80 and the number of clients

set at 50000, with the purpose to study a system with high traffic intensity. This second case can be seen

on Figure 5.3.

Figure 5.3: SPC Method output in M/M/1 system simulation with λ=80

If we ”zoom-in” the same graphic, it can be seen the initial bias before reaching 100 clients in Figure 5.4.

49

Page 66: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 5.4: SPC Method output in M/M/1 system simulation with λ=80

Applying the method with several arrival rates, also maintaining 20 replications, allows us to observe the

initial bias, and select how many clients to discard and we can observe the theoretical and practical bias

. The results are in Table 5.2: :

λ Nº of Clients Discarded ”bias” Theoretical tsys Practical tsys Practical tsys w/o Bias50 50000 220 0.02 0.0198 0.0205780 50000 300 0.05 0.0589 0.0524990 50000 2700 0.10 0.0949 0.0989095 50000 3100 0.20 0.2342 0.19220

Table 5.2: Table of Discarded Bias on M/M/1 with SPC’s Method

With the SPC method to set upper and lower limits, it can be seen graphically that there are clients whose

system time (tsys) exceeds the limits and, therefore, the rules imposed by the method are not always

fulfilled. The rule mentioned before ”A point plots outside a 3-σ control limit” is one of the main rules that

is not being satisfied, since it is possible to observe in the graphic that more than one point plots outside

that limit. On the other hand, it is possible to observe that the practical values are reasonable, with and

without bias, in comparison to the known theoretical value. Comparing the theoretical values with the

practical values without initial bias, allows us to observe that the method performed well, especially in

M/M/1 with arrival rates of 90% and 95%.

50

Page 67: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5.3 Design process in Kelton and Law Regression Method

This method is about observing if the slope at each batch is close to zero. The closer it is, the greater

the confidence that the warm-up phase is ending, and that the system is reaching the steady-state.

For each arrival rate, we have a table of vector to see which ones are closer to zero. It is important to

emphasize that the number of slopes in the vector varies according to the number of clients divided by

the size of each batch and is therefore variable and adapted to each situation.

For λ=50, the regression method is applied in every batch and it is represented in Figure 5.5:

Figure 5.5: Kelton and Law Regression Method output in M/M/1 system simulation with λ=50

Also, for this arrival rate, we have the slopes vector:

[−0.0012; 0.0004; 0.0031; 0.0014; 0.0024;−0.0013;−0.0009; 0.0005; 0.0025; 0.0011 ]

51

Page 68: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

For λ=80, the regression method is applied in every batch and it is represented in Figure 5.6:

Figure 5.6: Kelton and Law Regression Method output in M/M/1 system simulation with λ=80

For this arrival rate, we have the slopes vector with less number of values due to the window adjustment

to see the initial bias:

[−0.0206;−0.0050;−0.0090;−0.0027; 0.0011 ]

For λ=90, the regression method is applied in every batch and it is represented in Figure 5.7:

Once again, for this arrival rate, we have the slopes vector with less number of values due to the window

adjustment, and, also, due to the adjustment in the number of clients for a better visualization

52

Page 69: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 5.7: Kelton and Law Regression Method output in M/M/1 system simulation with λ=90

[0.0680; 0.0109;−0.0370;−0.0421; 0.0028;−0.0091; 0.0040;−0.0053 ]

Finally, for λ=95, the regression method is applied in every batch and it is represented in Figure 5.8:

Once again, for this arrival rate, we have the slopes vector with less number of values due to the window

adjustment, and, also, due to the adjustment in the number of clients for a better visualization of the

initial bias:

[0.0184; 0.0174; 0.0971; 0.0063;−0.0305;−0.0659;−0.0499; 0.1177;−0.0992;−0.0980; 0.0203; 0.0155 ]

Applying this method with several arrival rates, considering that the batch size is relevant, it is possible

to observe the initial bias, and select how many batches (of variable size number of clients) can be

discarded and we can observe the theoretical and practical bias . The results are in Table 5.4:

53

Page 70: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Figure 5.8: Kelton and Law Regression Method output in M/M/1 system simulation with λ=95

Regarding the elimination of the initial bias and the estimation of the warm-up period, this method had a

good performance in most of the cases. It should be noted that although there was a large slope in the

first batches, during the operation of the M/M/1 system it was also possible to observe graphically that

there were linear regressions with a high slope, something that can be explained by disturbances that

can happen during the functioning of the system.

It may be concluded that this method works well to remove the initial bias, although it is more general and

less detailed, unless there is a larger study on the size of the batches, which results in a vector of slopes

with greater number of values to analyze, which makes the analysis of this method more complex.

λ Nº of Clients Discarded Batches Theoretical tsys Practical tsys Practical tsys w/o Bias50 50000 1 (±500clients) 0.02 0.02245 0.0203580 50000 1 (±1000clients) 0.05 0.0578 0.0514490 50000 1 (±1200clients) 0.10 0.1125 0.1032095 50000 2 (±2000clients) 0.20 0.2438 0.20360

Table 5.3: Table of Discarded Bias on M/M/1 with Kelton and Law Regression Method

54

Page 71: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5.4 Design process in Randomization tests for initialization bias

The input of this function is as follows:

yucesan (y, b, m, corr, NS, NL)

In this input, the y parameter is the vector of the observations collected (the dimension must be at least

b) and it is collected by running a M/M/1 simulation with a defined number of clients and an arrival

rate value, b is the number of initial lots, m is the initial lot size, corr is the maximum correlation value

allowed between lots and the value suggested was 0.05 or 0.1, NS is the number of shuffles which the

suggested value was the maximum possible, for example 9999, and, finally, NL is the desired level of

significance, which was recommended to be 0.1.

The result of this function describes the number of observations that must be present in each batch, as

well as the number of observations that must be removed, which corresponds to the initial bias. The

parameter corr is used as a threshold, since it is intended that the value of the correlation between lots

should be as low as possible.

As was said before, this method presents some problems when it comes to providing the initial pa-

rameters, which may be difficult to choose in the beginning. For example, the choice of the number of

batches and their size can be a problem, since the value of the correlation between the lots is dependent

of this choice and this value needs to be low enough to ensure the highest independence between the

observations of the different batches.

This process was repeated for all arrival rates defined previously that were value of interest. In table 5.6

are presented the input parameters and the initial bias that this methods recognizes.

λ b size m size Number of clients Initial bias50 50 50 50000 75080 50 50 50000 110090 15 15 50000 170095 10 10 50000 2800

Table 5.4: Table of results on M/M/1 with Yucesan Method for several λ values

The values of b and m have to be always adapted to each situation to achieve viable results, so they are

not always constant.

55

Page 72: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Applying this method with several arrival rates, considering that the batch size is relevant, it is possible

to observe the initial bias, and select how many batches (of variable size number of clients) can be

discarded and we can observe the theoretical and practical bias . The results are in Table 5.5:

λ Nº of Clients Discarded ”bias” Theoretical tsys Practical tsys Practical tsys w/o Bias50 50000 750 0.02 0.02525 0.0211080 50000 1100 0.05 0.0628 0.0497090 50000 1700 0.10 0.1415 0.1018095 50000 2800 0.20 0.2551 0.18800

Table 5.5: Table of Discarded Bias on M/M/1 with Kelton and Law Regression Method

It should be noted that, for higher arrival rates, the initial number of observations per batch has to be

reduced. Only then it is possible to reach the stipulated value for the correlation between the lots, so the

greater the number of observations per batch, the greater the correlation between them. In relation to

the observations that should not be used when analyzing the results, the initial bias, it can be possible

to verify that its value increases as the value of the arrival rate increases. This allows us to conclude

that, as we increase the utilization factor of the system, the longer it takes to stabilize, that is, to enter its

stationary state.

Studying the results presented in Table 5.5, it is clear that this method discards more initial bias than

others, like in Welch’s method. This method’s results showed that it did not always give particularly “safe”

estimates of the length of the initial transient phase, especially in a system with low traffic intensity. It is

possible to conclude that, in those cases, there was wome overestimation of the warm-up phase.

56

Page 73: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5.5 Design process in Crossing of the Means Rule

This method determines the number of mean crosses, and stops when those crosses reach a pre-

defined threshold, returning the observation number. The challenge of this method is to determine

which threshold is the most adequate for each situation. This method does not need any replications.

The author of this method, Fishman, recommends the threshold to be set at 25 for high arrival rates, and

the threshold to be set at 7 for low arrival rates, so this parameters will vary around these values and it

will be adapted to each situation.

For λ=50, the number of crosses observed is in Table 5.6:

50 35 25 15 55000 clients 159 118 88 43 9

Table 5.6: Table of counts on M/M/1 with Crossing of the Means Rule for λ=50

For λ=80, the number of crosses observed is in Table 5.7:

75 50 35 25 15 550000 clients 625 460 306 192 54 15

Table 5.7: Table of counts on M/M/1 with Crossing of the Means Rule for λ=80

For λ=90, the number of crosses observed is in Table 5.8:

75 50 35 25 15 550000 clients 847 628 449 255 83 16

Table 5.8: Table of counts on M/M/1 with Crossing of the Means Rule for λ=90

For λ=95, the number of crosses observed is in Table 5.9:

75 50 35 25 15 550000 clients 2693 2094 1466 960 116 26

Table 5.9: Table of counts on M/M/1 with Crossing of the Means Rule for λ=95

57

Page 74: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

The conclusions to be drawn from this method are made differently from the rest, because here we are

not explicitly told how much ”data” to remove, so that the system is free of the initial bias, but it is said

that the warm-up phase ends, or rather, the confidence that the warm-up phase has ended is higher as

the cross number becomes higher (within reliable intervals), taking into account the threshold set for a

certain arrival rate.

58

Page 75: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

5.6 Design process in Conway Rule

The Conway Rule is described as: in a time-series of a certain number of observations, the warm-up

period is the first point in the series that is neither the maximum nor the minimum of the remaining

observations. This rule is applied to the data from a series of replications, and the length of the warm-up

is selected from the replication that has the maximum warm-up period.

In the Table 5.10, for each arrival rate, it is shown where is the truncation point, which indicates the size

of the warm-up phase.

λ Nº of Clients Truncation Point Theoretical tsys Practical tsys Pratical tsys w/o Bias50 50000 4976 0.02 0,02127 0.0246680 50000 4988 0.05 0,04983 0.0538790 50000 4801 0.10 0,09299 0.1109195 50000 4991 0.20 0,15449 0.15908

Table 5.10: Table of Discarded Bias on M/M/1 with Conway Rule

From the results that can be observed in the table above, it can be seen that the truncation point is

much above than the previous methods point out. This may indicate that there is an overestimation in

situations of low traffic intensity and high traffic intensity as to where the warm-up phase actually ends,

which decreases the accuracy of this method.

This method indicated an extremely high truncation point for the considered arrival rates, which leads to

the conclusion that it is not a suitable method for the removal of the initial bias.

5.7 Summary

In this chapter, there was a study in each method to make an adjustment of the parameters of each one.

All outputs and results were analyzed, followed by a discussion of results. All methods were evaluated

on a ”Good”, ”Fair” and ”Poor” scale for features such as simplicity, precision, overestimation, parameter

estimation, and ease of implementation. The scores are based on a subjective assessment by the

author, and so should only be taken as indicative.

In terms of the categories, the graphical methods are the simplest methods and they are reliant on

very few assumptions.They can easily be implemented in a spreadsheet, although a difficulty is the

requirement to estimate parameters for some of the methods, with little guidance. The accuracy of

these methods is questionable, largely because they stand on subjective assessments.

59

Page 76: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

The heuristic approaches are again largely assumption free and require few parameters to be estimated.

Although not as simple, or transparent, as the graphical methods, they are generally not too difficult for

the analyst. The use of clear rules to determine the warm-up period provides an advantage over the

graphical methods, removing the subjectivity. The accuracy of the methods is variable and depends

upon the nature of the simulation output.

The two statistical methods involve quite complex procedures. The regression method requires many

parameters to be estimated and depends upon some restrictive assumptions. The randomisation tests

involve many computations. The accuracy of both approaches had a good performance.

The results are presented in the following tables and they provide a summary comparison of the methods

for estimating the warm-up period.

Welch’s Method SPC MethodAccuracy Good FairEase of Implementation Good GoodOverestimation Good FairParameters Estimation Fair GoodSimplicity Good Fair

Table 5.11: Comparisson Welch’s Method vs. SPC Method

Kelton and Law Regression Method Randomization Tests for Initialization BiasAccuracy Good GoodEase of Implementation Good FairOverestimation Fair PoorParameters Estimation Fair PoorSimplicity Good Poor

Table 5.12: Comparisson Kelton and Law Regression Method vs. Randomization Tests for Initialization Bias

Crossing of the Means Rule Conway RuleAccuracy Fair PoorEase of Implementation Good FairOverestimation Fair PoorParameters Estimation Poor GoodSimplicity Good Fair

Table 5.13: Comparisson Crossing of the Means Rule vs. Conway Rule

60

Page 77: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

6Conclusion

Contents

6.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6.2 Welch’s Method vs. SPC Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

6.3 Kelton and Law Regression Method vs. Randomization Tests for Initialization Bias 63

6.4 Conway Rule vs. Crossing of the Means Rule . . . . . . . . . . . . . . . . . . . . . . . 63

6.5 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

61

Page 78: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

6.1 Summary

This document describes a set of methods for detecting and removing the initial bias. They were divided

into three groups: graphical methods, heuristic methods and statistical methods. The advantages and

disadvantages of each method have been discussed. In this chapter, it will be concluded which method

fits better in those three types.

This investigation of the initial transient phase detection problem included a comparative study of two

methods in each of the three mentioned groups . The methods were implemented and their performance

investigated through the use of simulation studies in the M/M/1 queuing system.

After observing the results and comparing the practical values with the theoretical values, from which it

was possible to discuss the results, the parameters used and the conclusions obtained, here the final

conclusions will be drawn regarding the six methods that were studied.

6.2 Welch’s Method vs. SPC Method

Although the SPC method has very strict rules regarding the acceptance of the fact that the system

is ”in control” in visual terms, Welch’s method is more clear and explicit in relation to the initial bias

visualization in the M/M/1. This system is quite simple, so the visual aid to identify the initial bias is

the main source of this conclusion.Also, the practical results, in comparison with the theoretical values,

were not inappropriate, but rather viable. As we can observe, as the arrival rate increases, the number

of discarded data also increases but this increase is not extraordinary, maintaining a coherence that the

theoretical information about the method had confirmed. Welch’s method revealed to be useful to the

purpose, without overestimation of the truncation point.

Welch’s method does require the estimation of a number of parameters: run length, number of repli-

cations and specifically the window size. But, the parameters can only be estimated by trial and error,

which contributes to the user gaining insight regarding the topic of the initial bias, which is different tha

has a lot of contrast with the SPC method that, despite the rules being clear, comes with very restricted

and rigorous assumptions.

The only objection which can be relevant regards automating the identification of the initial bias. Both

methods requires the user to judge the smoothness and flatness of a moving average plot.

62

Page 79: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

6.3 Kelton and Law Regression Method vs. Randomization Tests

for Initialization Bias

Although these two methods fall into the category of ”Statistical Methods”, they are quite different. In

terms of output, the rules defined by the ”Kelton and Law Regression Method” give much more support

in discarding the batches which contain the initial bias.

For instance, the Kelton and Law Regression Method is considered to be complex to code and the large

number of parameters that require estimation ends up by withdrawing the focus on the identification of

the bias itself. Also, the shuffling of the batches of data requires a significant volume of calculations,

making the execution of the procedure slow.

6.4 Conway Rule vs. Crossing of the Means Rule

Given the observed results, the Crossing of the Means Rule was the one that presented the best perfor-

mance, even with the subjectivity associated to the threshold defined before the simulation, but chosen

according to the author’s suggestion. The method performed as expected and it was mentioned previ-

ously in [9, 20], in which the number of crosses increased, thus giving more confidence that the initial

bias had in fact ended.

For example, observing the results of the Conway Rule, there was a great overestimation in those

results, over the remaining other methods. This may be due to the fact that the method involves two

rules that restrict very much the choice of how far the warm-up phase goes, and it turns out to be,

therefore, a rather meticulous way to choose the truncation point that has diminished the performance

of this method.

So, within the category of ”Heuristic Methods”, the Crossing of the Means Rules was the one which

better accomplished the removing of the initial bias, considering the less ”good performance” presented

by the Conway Rule.

6.5 Future Work

Graphical methods revealed to be useful as the user involvement in the estimation of the warm-up

period can be seen as advantageous. The heuristic methods have the advantage of providing specific

63

Page 80: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

and rigorous rules for determining the warm-up period, making automation of the procedure possible.

As a suggestion, it would be beneficial to incorporate one or more methods in a hybrid framework with

a chosen truncation method. An example would be to incorporate Welch’s Method with Kelton and Law

Regression Method, both with visual aid of the system’s behavior but with very different rules when

determining how much data should be discarded.

It is still a challenge to determine the accuracy and generality of the different approaches, and decide

which fits best the intention of the user. Most of the literature search, and most of the evidences suggests

that the most commonly used methods are the simple time-series inspection or Welch’s method, both of

which have their shortcomings, although it was proven that Welch’s Method had a good performance.

Finally, the development of new methods should continue. The aim should be to develop methods

that are effective in terms of the criteria set out, like simplicity, ease of implementation of the method,

accuracy, assumptions needed, and parameter estimation.

A number of methods for determining the warm-up period or detecting the initial bias have been de-

scribed under three headings: graphical methods, heuristic methods, and statistical methods. The

advantages and disadvantages of each method have been discussed. It is clear that no single method

can be recommended, although there are better suggestions than other. It is still recommended that a

number of methods are employed if an accurate estimate of the warm-up period is required for future

projects.

64

Page 81: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Bibliography

[1] Barradas, R.: Construcao de metamodelos de simulacao estocastica utilizando splines (Oct 2015)

[2] Cash, C.R., Nelson, B.L., Dippold, D.G., Long, J.M., Pollard, W.P.: Evaluation of tests for initial-

condition bias. In: Proceedings of the 24th Conference on Winter Simulation. pp. 577–585. WSC

’92, ACM, New York, NY, USA (1992)

[3] Charnes, J.: Statistical analysis of output processes. In: Proceedings of the 25th Conference on

Winter Simulation. pp. 41–49. WSC ’93, ACM, New York, NY, USA (1993)

[4] Fishman, G.: Bias considerations in simulation experiments. Operations Research 20, 685–790

(1972)

[5] Fishman, G.: Concepts and Methods of Discrete Event Digital Simulation. John Wiley and Sons,

New York, NY, USA (1973)

[6] Fishman, G.S.: Principles of Discrete Event Simulation. John Wiley and Sons, New York, NY, USA

(1978)

[7] Fishman, G.S., Wang, V.G.: Antithetic variates revisited. Communications of the ACM 26, 964–971

(1983)

[8] Fishman, G.S., Schruben, L.W., Kelton, W.D., Welch, P.D.: The initial transient in steady state simu-

lation (panel discussion). In: Proceedings of the 13th Conference on Winter Simulation - Volume 1.

pp. 113–120. WSC ’81, IEEE Press, Piscataway, NJ, USA (1981), chairman-Lavenberg, Stephen

S.

[9] Gafarian, A.V., Anker, C.J., Morisaku, T.: Evaluation of commonly used rules for detecting steady

state in computer simulation. In: Proceedings of the 32Nd Conference on Winter Simulation. pp.

511–529. WSC ’00, Naval Research Logistics Quarterly (1978)

[10] Goldsman, D., Tokol, G.: Output analysis: Output analysis procedures for computer simulations.

In: Proceedings of the 32Nd Conference on Winter Simulation. pp. 39–45. WSC ’00, Society for

Computer Simulation International, San Diego, CA, USA (2000)

65

Page 82: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

[11] Grassmann, W.: Initial bias and estimation error in discrete event simulation. In: Proceedings of

the 14th Conference on Winter Simulation - Volume 2. pp. 377–384. WSC ’82, Winter Simulation

Conference (1982)

[12] Grassmann, W.: When, and when not to use warm-up periods in discrete event simulation. In:

Simutools ’09: Proceedings of the 2nd International Conference on Simulation Tools and Tech-

niques. pp. 1–6. ICST (Institute for Computer Sciences, Social-Informatics and Telecommunications

Engineering), ICST, Brussels, Belgium, Belgium (2009)

[13] Hobson-Rohrer, M.: Take your process off the page with simul8 simulation software. In: Proceed-

ings of the 2013 Winter Simulation Conference: Simulation: Making Decisions in a Complex World.

pp. 4108–4108. WSC ’13, IEEE Press, Piscataway, NJ, USA (2013)

[14] Hobson-Rohrer, M.: Take your process off the page with simul8 simulation software. In: Proceed-

ings of the 2013 Winter Simulation Conference: Simulation: Making Decisions in a Complex World.

pp. 4108–4108. WSC ’13, IEEE Press, Piscataway, NJ, USA (2013)

[15] Kimbler, D.L., Knight, B.D.: A survey of current methods for the elimination of initialization bias

in digital simulation. In: Proceedings of the 20th Annual Symposium on Simulation. pp. 133–152.

ANSS ’87, IEEE Computer Society Press, Los Alamitos, CA, USA (1987)

[16] Law, A.: Statistical analysis of simulation output data. Operations Research 31(6), 983–1029 (1983)

[17] Law, A.: Simulation Modeling and Analysis. McGraw-Hill, New York, NY, USA, fifth edn. (2015)

[18] Law, A., Kelton, W.: Simulation Modeling and Analysis. McGraw-Hill, New York, NY, USA, third edn.

(2000)

[19] Law, A.: Statistical analysis of simulation output data: The practical state of the art. In: Proceedings

of the Winter Simulation Conference. pp. 65–74. WSC ’10, Winter Simulation Conference (2010)

[20] Mahajan, P., Ingalls, R.: Evaluation of methods used to detect warm-up period in steady state

simulation. In: Proceedings of the 36th Conference on Winter Simulation. pp. 663–671. WSC ’04,

Winter Simulation Conference (2004)

[21] Nagaraj, S., Zimmermann, A.: fdrit- an evaluation tool for transient removal methods in discrete

event stochastic simulations. In: Proceedings of the 10th EAI International Conference on Perfor-

mance Evaluation Methodologies and Tools on 10th EAI International Conference on Performance

Evaluation Methodologies and Tools. pp. 38–43. ICST (Institute for Computer Sciences, Social-

Informatics and Telecommunications Engineering), ICST, Brussels, Belgium, Belgium (2017)

66

Page 83: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

[22] Robinson, S.: New simulation output analysis techniques: A statistical process control approach

for estimating the warm-up period. In: Proceedings of the 34th Conference on Winter Simulation:

Exploring New Frontiers. pp. 439–446. WSC ’02, Winter Simulation Conference (2002)

[23] Santos, M.: Simulacao estocastica com acontecimentos discretos. pp. 338–344 (Mar 2003)

[24] Santos, M.: Nonlinear regression metamodels: a systematic approach. International Journal of

Simulation & Process Modelling 5(3), 241–255 (2009)

[25] Taylor, S.: Analyzing methods of mitigating initialization bias in transportation simulation models

(2010)

[26] Voss, P., Haddock, J., Willemain, T.: Estimating steady state mean from short transient simula-

tions. In: Proceedings of the 28th Conference on Winter Simulation. pp. 222–229. WSC ’96, IEEE

Computer Society, Washington, DC, USA (1996)

[27] Wang, J.: Timed Petri Nets - Theory and Application. McGraw-Hill, Florida, FL, USA (1998)

[28] Welch, P.: The statistical analysis of simulation results. In: Lavenberg, S.S. (ed.) Computer Perfor-

mance Modeling Handbook, pp. 268–328. Academic Press, New York, NY, USA (1983)

[29] White, Jr., K., Cobb, M., Spratt, S.: A comparison of five steady-state truncation heuristics for

simulation. In: Proceedings of the 32Nd Conference on Winter Simulation. pp. 755–760. WSC ’00,

Society for Computer Simulation International, San Diego, CA, USA (2000)

[30] Yucesan, E.: Randomization tests for initialization bias in simulation output. Naval Research Logis-

tics 40, 643–663 (1993)

67

Page 84: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

ACode for M/M/1

68

Page 85: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Listing A.1: M/M/1 function

1 % clients : simulation length (number of observations)

2 % lambda : average arrival rate (lambda=70)

3 % miu : average service rate (miu=100)

4 % Returns : observations of time in system(tsys), time in queue(tque),

5 % number of clients in system(nsys) number of clients in queue(nque),

6 % time of last client.

7 function [ tsys tque nsys nque tnow ] = mm1prs (clients, lambda, miu)

8 if nargin < 2 lambda = 70; end

9 if nargin < 3 miu = 100; end

10

11 % theoretical

12 rho = lambda/miu

13 tsys = 1 / ( miu - lambda )

14 tque = rho / ( miu - lambda )

15 nsys = lambda / ( miu - lambda )

16 nque = rhoˆ2 / ( 1 - rho )

17

18 %output

19 tsys = [];

20 tque = [];

21 nsys = [];

22 nque = [];

23

24 % constants

25 ARRIVAL = 12;

26 SERVICE = 21;

27 FREE = 16;

28 BUSY = 61;

29

30 % init

31 ncli = 0; % number of clients in system

32 tnow = 0; % system time

33 server = FREE;

34 queue = [];

35 evts = [ tnow ARRIVAL 0 ]'; % first event

36

37 % loop

69

Page 86: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

38 while size(evts,2) > 0

39 evts = sortrows(evts')';

40 tnow = evts(1,1);

41 type = evts(2,1);

42 tarr = evts(3,1);

43 evts = evts(:,2:end); % remove from event list

44

45 if type == ARRIVAL

46 if clients == 0 continue; end % no more arrivals

47 clients = clients - 1;

48 ncli = ncli + 1; % another client in the system

49 nsys = [ nsys ncli ];

50 evts = [ evts [ tnow + exprnd(1/lambda) ARRIVAL 0 ]' ];

51

52 if server == FREE

53 tque = [ tque 0 ];

54 server = BUSY;

55 evts = [ evts [ tnow + exprnd(1/miu) SERVICE tnow ]' ];

56 else

57 queue = [ queue tnow ]; % enqueue

58 nque = [ nque size(queue,2) ];

59 end

60

61 else % type == SERVICE

62 ncli = ncli - 1; % another client leaves the system

63 nsys = [ nsys ncli ];

64 tsys = [ tsys tnow-tarr ];

65

66 if size(queue,2) == 0 % empty

67 server = FREE;

68 else % remove from queue and service the client

69 tque = [ tque tnow-queue(1) ];

70 evts = [ evts [ tnow + exprnd(1/miu) SERVICE queue(1) ]' ];

71 queue = queue(2:end); % dequeue

72 nque = [ nque size(queue,2) ];

73 end

74 end

75 end

70

Page 87: Remove Initial Bias From Steady-State Stochastic Simulation · simulation begins, the queues are in a non steady-state phase and when the simulation is settled, they move towards

Listing A.2: M/M/1 auxiliar function for replications

1 % Build a matrix of 'rep' replications, one on each line, for the

2 % time in system (tsys) and time in queue (tque) of an M/M/1.

3 % cli : simulation length (number of observations)

4 % lambda : average arrival rate (average service rate: mu=100)

5 % rep : number of replications

6 % Returns : tsys(rep,cli), tque(rep,cli)

7 function [ tsys tque ] = mm1rep(cli, lambda, rep) %run mm1 simulation given number of clientes, lambda and lambda

8 for i=1:rep

9 [sys que] = mm1prs(cli, lambda);

10 tsys(i,:)=sys';

11 tque(i,:)=que';

12 end

71