Si
Simulation
l ti Run
R Statistics
St ti ti
Consider a single-server system in which the
arrivals occur with a Poisson distribution and the
service time has an exponential distribution.
Suppose the study objective is to measure the mean
waitingg time, defined as the time entities spend
p
waiting to receive service and excluding the service
time itself.
This system is commonly denoted by M/M/1 which
indicates; first , that the inter-arrival time is
distributed exponentially; second that the service
ti
time is
i distributed
di t ib t d exponentially;
ti ll and,d third,
thi d that
th t
there is one server. The M stands for Markovian,
which implies an exponential distribution. 17
Si
Simulation
l ti Run
R Statistics
St ti ti
In a simulation run, the simplest approach is to
estimate the mean waiting time by accumulating the
waiting time of n successive entities and dividing by
n.
This measure, the sample mean, is denoted by x(n)
to emphasize the fact that its value depends upon
the number of observations taken.
If xi (i=1,2,….,n)
(i=1 2 n) are the individual waiting times
(including the value 0 for those entities that do not
have to wait), then
1 n
x(n) xi
n i 1 18
Si
Simulation
l ti Run
R Statistics
St ti ti
Whenever a waiting line forms, the waiting time of
each entity on the line clearly depends upon the
waiting time of its predecessors.
predecessors
Any series of data that has this property of having
one value affect other values is said to be
autocorrelated.
The sample mean of autocorrelated data can be
shown to approximate a normal distribution as the
sample size increases.
19
Si
Simulation
l ti Run
R Statistics
St ti ti
1n
The equation x(n) xi remains a satisfactory
n i1
estimate for the mean of autocorrelated data.
A simulation
i l ti run is i started
t t d with
ith the
th systemt in
i some
initial state, frequently the idle state, in which no
service is being given and no entities are waiting.
The early arrivals then have a more than normal
probability
b bilit off obtaining
bt i i service
i quickly,
i kl so a sample l
mean that includes the early arrivals will be biased.
20
Si
Simulation
l ti Run
R Statistics
St ti ti
For a given sample size starting from a given initial
condition, the sample mean distribution is
stationary; but , if the distributions could be
compared for different sample sizes, the distribution
would be slightly different.
The following figure is based on theoretical results,
which shows how the expected value of sample
mean depends upon the sample length, for the M/M/1
system, starting from an initial empty state, with a
server utilization of 0.9.
21
Si
Simulation
l ti Run
R Statistics
St ti ti
22
Replications
p of Runs
The precision of results of a dynamic stochastic
can be increased byy repeating
p g the experiment
p
with different random numbers strings.
For each replication of a small sample size, the
sample mean is determined.
The sample means of the independent runs can
be further used to estimate the variance of
distribution. Let X ij be the ith observation in jth run,
then the sample
p mean and variance for the jth run
are:
23
R li ti
Replications off Runs
R
n
1
x j ( n ) x ij
n i 1
n
1
s
2
j
n 1 i 1
[ xij x j ( n )] 2
24
Replications
p of Runs
When we have similar means and variances for m
independent measurements,
measurements then by combining
them, the mean and variance for the population
can be obtained as:
25
R li ti
Replications off Runs
R
p
1
x x j ( n)
p j 1
p
1
s j ( n)
2 2
s p j 1
26
R li ti
Replications off Runs
R
The following figure shows the result of applying the
procedure to experimental results for the M/M/1
system.
27
Replications
p of Runs
28
Replications
p of Runs
This variance can further be used to establish the confidence interval for p-1 degrees
of freedom.
The length of run of replications is so selected that all combined it comes to the
sample size N. i.e. p.n=N.
By increasing the number of replications and shortening their length of run, the
confidence interval can be narrowed.
But due to shortening of length of replication the effect of starting conditions will
increase.
The results obtained will not be accurate, especially when the initiazation of the runs
is not proper.
Thus,, a compromise
p has to be made.
There is no established procedure of dividing the sample size N into replications.
However, it is suggested that the number of replications should not be very large, and
that the sample means should approximate a normal distribution.
29
Eli i ti
Elimination off Initial
I iti l Bias
Bi
Two general approaches can be taken to remove the bias:
the system can be started in a more representative state
that the empty state, or the first part of the simulation can
be ignored.
ignored
The ideal situation is to know the steady state
distribution for the system
system, and select the initial
condition from that distribution.
In the study previously discussed, repeated the
experiments on the M/M/1 system, supplying an initial
waiting line for each run, selected at random from the
known steady state distribution of waiting line.
30
Eli i ti
Elimination off Initial
I iti l Bias
Bi
The case of 40 repetitions of 320 samples, which
previously resulted in a coverage of only 9% was
improved to coverage of 88%
88%.
The more common approach to removing the initial
bias is to eliminate an initial section of the run.
The run is started from an idle state and stopped
after a certain period of time.
31
Eli i ti
Elimination off Initial
I iti l Bias
Bi
The run is then restarted with statistics being
gathered from the point of restart.
It is usual to program the simulation so that
statistics are gathered from the beginning, and
simply wipe out the statistics gathered up to the
point of restart.
No simple rules can be given to decide how long an
interval should be eliminated.
32
Eli i ti
Elimination off Initial
I iti l Bias
Bi
The disadvantage of eliminating the first part of a
simulation run is that the estimate of the variance,
needed to establish a confidence limit,
limit must be
based on less information.
The reduction in bias, therefore, is obtained at the
price of increasing the confidence interval size.
33
R f
Reference
Geoffrey Gordon, System Simulation,
Chapter
p 14,, analysis
y of simulation output
p
34