6. Output Analysis
How to draw statistically valid conclusions from simulation output: transient versus steady-state behavior, confidence intervals for terminating simulations, and initial-data deletion, replication/deletion, batch means, regenerative and sequential methods for steady-state parameters.
flowchart LR
ID(["input distributions"]) --> RV["random variates (rv's)"] --> P["simulation program"] --> Y["output random variables Y₁, Y₂, …"]
The inputs are random, so the outputs are random variables too. A performance measure is a statistic, i.e. a function of the output r.v.s:
Wrong procedure in practice: perform a single simulation run of arbitrary length and treat the simulation estimates as the true characteristics of the system. Why it is wrong:
- One run gives one realization of , which is a random variable: a different seed gives a different answer, and a single number says nothing about how far it may be from the truth.
- Within a run the ’s are not i.i.d. (see the example below), so the formulas of §2.6, which need i.i.d. data, cannot be applied to them.
- With an arbitrary run length, the result can depend heavily on the initial conditions (§6.1).
Q: What is the correct way to estimate the true performance of the system based on simulation outputs?
Ex: queueing simulation. = the delay of the -th customer. Lindley’s equation (§2.5):
where is the service time of customer and the interarrival time between customers and .
The ’s are not i.i.d.:
- Not independent: is computed from . A customer who waits long is usually followed by another who waits long (positive correlation).
- Not identically distributed: always (the system starts empty), is often , and the distribution of keeps changing with (§6.1).
Solution: perform multiple replications, i.e. independent runs, each with the same initial conditions but its own independent random numbers (e.g. a different stream per run, §3.3).
| output process | ||||
|---|---|---|---|---|
| run 1 | ||||
| run 2 | ||||
| run |
= the -th observation in run , a random observation obtained from a particular run. Along a row (within one run) the observations are dependent. Down a column (fixed , different runs), are i.i.d., because the runs are independent copies of the same experiment. So
and the usual i.i.d. statistics (CIs, §2.6) apply to each column.
Idea: use the observations in multiple runs to draw statistical inference about .
6.1. Transient and Steady-State Behavior of a Stochastic Process
Output process with , where and is the initial condition (e.g. the number of customers present at time 0).
The fact that is different for different ’s is called the transient behavior; is the transient distribution of . If there is a c.d.f. such that
then is called the steady-state distribution, and is the steady-state random variable.
This is convergence in distribution (weak convergence, §2.4): . What it means, and what it does not:
- The limit does not depend on : every initial condition leads to the same steady-state distribution. But how fast approaches does depend on .
- Strictly, is only reached as . In practice there is a such that for all , and steady state is said to “start” around .
- Steady state does not mean that the ’s stop changing or become equal within a run. It means that they have (approximately) the same distribution; they are still dependent on each other.
E.g. M/M/1 queue with (arrival rate 1, mean service time 0.9), averaged over 20,000 replications. Started empty and idle, the mean delay rises from 0; started with a long first wait, it falls. Both approach the same steady-state mean , but only after several hundred customers. (The average delay of the first 25 customers from an empty start is about 2.12: a transient quantity, far from 8.1. It reappears in §6.3.2.)
6.2. Types of Simulations
- terminating
- nonterminating
- steady-state parameters: ; characteristics of , e.g. , ,
- steady-state cycle parameters
Terminating simulation
- There is a natural event that determines the length of each simulation run.
- Ex: simulate the operation of a retail store over an 8-hr shift; = {8 hours of simulated time have elapsed}.
- Ex: a manufacturer receives a contract to produce 100 planes; = {100 planes have been completed}.
- It never reaches steady state, and it does not need to: the run stops at , and the behavior up to , transient part included, is exactly what is being measured.
- Both the initial conditions and the stopping event should be representative of the real system (e.g. the store opens empty every morning, so each run starts empty).
Nonterminating simulation
- Any system that operates continuously, with no natural event to stop a run (e.g. a production line running around the clock).
- Interested in long-run / steady-state behavior.
- The initial condition does not matter: the steady-state distribution is the same for every (§6.1).
- Question: how long should the simulation be performed to ensure that the influence of the initial condition can be ignored? (In the figure of §6.1, several hundred customers.)
- When the system is cyclic, we are interested in steady-state cycle parameters.
Ex: , where = server utilization in hour of an 8-hr shift at a bank (one that operates continuously, shift after shift). The hourly utilizations follow the same pattern in every shift (busy hours, quiet hours), so never settles into one distribution: there is no steady state. Instead, look at whole cycles (shifts):
The cycle averages can have a steady-state distribution, and
6.3. Statistical Analysis for Terminating Simulations
Make independent replications of a terminating simulation: each replication starts with the same initial conditions, stops at the event , and uses its own independent random numbers. Let be the performance measure from replication , i.e. a random variable computed from the outputs of run , for example
(one per row of the replication table at the start of the chapter). Since the replications are independent copies of the same experiment,
are i.i.d.
Estimating means
Goal: to estimate .
is an unbiased estimator for .
A CI for is
(Case 2 of §2.6.1). It is exact if the ’s are normal, and approximate otherwise (see §6.3.2). Here
is the sample variance of the ’s.
Ex: ten independent replications of a single-server queue model; = the average delay in queue in replication :
For : , , , half-width , so a 90% CI is approximately .
6.3.1. Interpretation
“I am 95% sure that covers ”? No.
is an estimate: a fixed interval computed from one set of replications. is a fixed (unknown) number, so either covers or it does not; nothing random is left. The formula is an estimator: a random interval, because and are random quantities. If the whole procedure is repeated many times (each time with new replications), you get , , …, and 95% of these intervals cover . The 95% describes the procedure, not one particular interval.
6.3.2. Quality of CIs
The CI assumes normal ’s; when they are not normal, the actual coverage can be below . To check, use test models whose is known.
Ex: an M/M/1 queue (, starting empty and idle; = average delay in queue of the first 25 customers in replication ):
Construct 500 90% CIs for estimating , each CI constructed based on simulation replications, and count the percentage of these 500 intervals that actually cover .
| actual coverage (500 CIs) | simulation (20,000 CIs) | |
|---|---|---|
| 5 | 88% | 83.5% |
| 10 | 86% | 85.8% |
| 20 | 89% | 88.1% |
| 40 | 92% | 89.1% |
Ex: reliability example: a system of three components that fails when component 1 fails or when both components 2 and 3 have failed; the component lifetimes are i.i.d. Weibull (shape 0.5, scale 1). = time to failure of the system in replication , and (exactly ). Perform the same experiment:
| actual coverage (500 CIs) | simulation (20,000 CIs) | |
|---|---|---|
| 5 | 71% | 71.4% |
| 10 | 75% | 75.9% |
| 20 | 80% | 80.1% |
| 40 | 84% | 83.7% |
A coverage value based on only 500 intervals is accurate to about (the standard error of a proportion near 0.9 from 500 trials is ). So the small ups and downs in the first table (88% → 86% → 89% → 92%) are within this noise; with 20,000 intervals the coverage rises steadily toward 90% as grows.
The reliability coverage is lower. Why is there such a big difference?
Fact: the quality of the confidence interval depends on both and the nature of . If itself is the average of a large number of quantities, then the resulting CI in general has good coverage.
Why: the -interval is exact only for normal ; otherwise it relies on the CLT to make approximately normal, and the further the distribution of is from normal (especially the more skewed it is), the larger must be. In the M/M/1 example, is an average of 25 delays and is already fairly close to normal (skewness 1.7). In the reliability example, is a single time to failure, not an average: most systems fail almost immediately but a few last very long (skewness 5.3), far from normal.
(The 25 delays within a run are positively correlated, so averaging them helps less than averaging 25 independent values would, but it still helps.)
6.3.3. Obtaining a specified precision
In the CI :
- is the center;
- is the coverage probability;
- is the sample size (number of replications);
- is the half-width of the CI, because the CI is . The half-width measures the precision: the smaller, the more precise.
If I increase ( goes down), the tail area gets smaller, so the critical value is pushed to the right:
However, if gets larger, the interval becomes wider and the precision is lower. If the range is too large, it is not informative: e.g. a 100% CI for a salary is , which is useless.
So for a fixed , more confidence costs precision. The way to get both is to increase : the half-width shrinks like (made precise in the procedures below).
Ex: two systems
- M/M/1, 2. M/D/1 (deterministic: every service time equals the mean service time of system 1). I want to do a comparison. Let = average delay in queue in the -th system, or . Estimating is the comparison: which system has the smaller delay? Do this by simulation.
Make replications of each system. Replication gives and ; let
The replications are independent, so are i.i.d. with mean : this is exactly the setting of §6.3 (estimating means) with replaced by . So is an unbiased estimator of , and with the sample variance of the ’s, a
95% CI for is
and where it lies relative to 0 gives the answer:
- The CI lies entirely to the right of 0: , i.e. , so system 2 has the smaller expected delay. The difference is statistically significant.
- The CI lies entirely to the left of 0: , so system 1 has the smaller expected delay.
- The CI contains 0: statistically insignificant. The data are consistent with , so we cannot tell which system is better. This does not show that ; the interval may simply be too wide. The remedy is a smaller half-width, i.e. more replications. How many? That is what the procedures below answer.
E.g. both queues with (arrival rate 1, mean service time 0.9), started empty; = average delay of the first 25 customers. With replications of each system: , , half-width , so the 95% CI is . It contains 0: statistically insignificant (case 3), even though the true difference is (system 2 is better).
Procedures for determining the number of replication runs
First case: and (the desired half-width) are fixed; determine . Set the half-width equal to ,
and solve for :
Both sides contain ( and depend on it), so in practice: make pilot replications, use in place of , take the smallest with , and make more replications. (For large , , which gives directly.)
Second case: is fixed; reduce the half-width from (obtained with replications) to . What is the additional number of replications needed?
Assume (both estimate the same variance) and . Dividing,
E.g. halving the half-width () needs , i.e. more replications. In fact decreases as grows, so this rule errs on the safe side.
E.g. (continued: , target half-width ):
- First case, with the pilot : the smallest with is (there , and ).
- Second case, from with to : , i.e. about 132 more replications. More than 109, because the rule keeps at instead of letting it drop to about .
Running replications gives , , half-width , and the 95% CI . It lies entirely to the right of 0 (case 1): the M/D/1 queue has the smaller expected delay. (The half-width came out below the target 0.5 because the pilot’s happened to be high: the procedures are only as good as the pilot’s variance estimate.)
Third scenario: precision is given in terms of the relative error. Fix and the relative error ; determine . Set the half-width relative to the size of the estimate equal to :
What it means: the half-width is required to be at most a fraction of the estimate itself, so the CI is ; with , “ is estimated to within about ”. This is useful when you do not know the scale of in advance: an absolute half-width is very precise if but useless if , while a relative error scales automatically. It is the first case with replaced by , and it is solved the same way, using and from a pilot run.
E.g. M/M/1 alone, : a pilot of replications gave and . For and the target half-width is , and the smallest with is (formula: ). In a simulation check, with 282 replications was within 10% of in 96% of repetitions.
Two cautions. (1) The relative error is measured against , not the unknown ; to guarantee , the textbook uses the slightly smaller adjusted value in the formula. (2) Do not use a relative error for a quantity that may be close to 0, such as above: as , the target half-width and the required explodes.
Common random numbers. Above, the two systems used independent random numbers. Feeding both systems the same interarrival times in each replication (common random numbers, §4.2.1 advantage 4) makes and positively correlated (here the correlation is about 0.5), and
drops from 3.79 to 2.23 in this example. Since the required is proportional to the variance (first case), that is about 40% fewer replications for the same half-width.
6.3.4. Choosing initial conditions in terminating simulations
The initial conditions affect the results of a terminating simulation, so they must be representative of the real system (§6.2). In general there are two approaches.
Ex: estimate the expected average delay in queue of bank customers who arrive and complete their delays between noon and 1 pm.
Noon to 1 pm is the lunch rush, so at noon the bank is usually already busy. Starting the simulation empty and idle at noon would miss the customers already waiting then, and would underestimate the delays (as in the figure of §6.1, a queue started empty has smaller delays for a while).
Approach 1: start the simulation empty at 9 am (when the bank really opens, so “empty” is realistic), run the model for 3 hrs, reset the statistical counters at 12:00 noon and collect data for the next hr. The 9 am to noon part is a warm-up that builds up a realistic state at noon; its statistics are discarded.
Approach 2: collect data on the number of customers present at 12 noon (over many days), use the data to fit a distribution, and draw from that distribution to initialize the simulation at noon in each replication; then collect data from noon to 1 pm.
- Approach 1 needs no extra data, but every replication spends 3 simulated hours only to reach noon, and the arrivals during those hours must be modeled correctly (e.g. with a time-varying arrival rate, §4.6).
- Approach 2 saves those 3 hours, but needs real data on the state at noon, and the number of customers may not describe the whole state (e.g. how much service the customers already in service still need; for exponential service times this does not matter, by the memoryless property).
In both approaches the replications stay i.i.d.: in approach 2, each replication draws its own initial number of customers independently.
6.3.5. Summary for terminating simulations
- We must perform multiple independent simulation runs (replications); a single run is not enough (start of this chapter).
- It is important to control the precision of the estimator, i.e. determine (§6.3.3).
- Initial conditions must be carefully chosen (§6.3.4).
6.4. Statistical Analysis for Steady-State Parameters (Non-Terminating)
Let be the output r.v.s of a nonterminating simulation. converges to in distribution; more formally,
where is the transient distribution of (written in §6.1) and is the steady-state distribution.
, , are called steady-state parameters (§6.2): they are characteristics of the steady-state distribution . Goal: estimate a steady-state parameter, e.g. the steady-state mean
Why is it difficult?
- Problem of initial transience: , because the early ’s come from transient distributions . So for the plain average of a run, , we get : is a biased estimator of (initialization bias). E.g. for the M/M/1 queue of §6.1 started empty (): , , . The bias shrinks only slowly as the run gets longer.
- Within one run the ’s are correlated, so the i.i.d. CI of §2.6 cannot be applied to them directly. (§6.4.2–§6.4.4 are three ways around this.)
6.4.1. Initial-data deletion
Given observations of a run, delete the first observations and use
The deleted observations are the warm-up period (the same idea as the warm-up in approach 1 of §6.3.4); would give back the plain average .
Is this a better estimator? Why? The deleted observations are the ones most affected by the initial condition ( always, is often , …), i.e. the ones whose means are farthest from . If the process is (approximately) in steady state after observation , every remaining has , so : the bias is (almost) removed. The price: averages only observations instead of , so its variance is larger. So it is better in bias, worse in variance.
Want . How to choose ? Trade-off:
- if is small ⇒ high bias (transient observations are still included);
- if is large ⇒ high variance (only a few observations are left).
E.g. the M/M/1 queue above, runs of length (bias computed numerically, standard deviations from 100,000 simulated runs):
| bias | standard deviation of | |
|---|---|---|
| 0 | 3.3 | |
| 100 | 3.4 | |
| 250 | 3.6 | |
| 500 | 3.9 | |
| 1000 | 4.7 | |
| 1500 | 5.9 |
The bias matters more than these numbers suggest, because the variance can be reduced by making more runs and the bias cannot. With independent runs, the estimates of the runs are i.i.d., so they can be averaged and turned into a CI as in §6.3 (the replication/deletion approach, §6.4.2). Averaging divides the variance by , but the expectation stays for every , so more runs only shrink the CI around the wrong value. E.g. with , the 95% CI covered in 83% of experiments with runs, 68% with and 26% with ; with it covered in about 93% of experiments for both and . So choose just large enough that the bias is negligible. That is what Welch’s procedure is for.
It is very difficult to determine from a single replication, because the observations are so variable: a value of that works well for one replication may be very bad for another. So Welch’s procedure uses several replications.
Welch’s procedure (for determining ). Welch’s procedure chooses so that for . The idea is to perform multiple runs, average across runs and then within runs (over neighboring observations) to construct a moving average process, plot the result and “eyeball” the value of .
- Make runs of the simulation (), each of length ( much larger than the anticipated ). As in the table at the start of the chapter, = the -th observation of run :
- Average across runs (down each column):
Also , since the runs are independent. So the averaged process has the same transient mean curve as a single run, which is what we want to see, but only of the variance.
3. Construct a moving average process. still fluctuates a lot from one to the next; averaging neighboring values smooths out these fast fluctuations but keeps the slow trend . Specify the window (an integer, ) and let
For , is the simple average of the values centered at . For there are only values to the left of , so the window shrinks to values on each side: values, still centered at , so that the smoothed curve is not shifted. E.g. , , . For there are fewer than values to the right, so is not defined there.
- Plot for and eyeball a cutoff value for : e.g. the value of such that beyond , does not change much (it appears to have converged).
E.g. the M/M/1 queue of §6.1 (, started empty), , . This queue is very variable: with runs the moving average still swings between roughly 4 and 12, too much to see where it levels off, so runs were made. rises until about and after that only fluctuates around a constant level, so take . Since this is a test model, the choice can be checked: the bias of is only , against without deletion (table above).
Choosing and : plot for several values of and use the smallest for which the plot is reasonably smooth. If is too small, the plot is ragged and it is hard to see where it levels off; if is too large, the rise is smeared out and the shape of the transient is lost. If no gives a smooth plot, make more runs and repeat step 2 with all of them ( shrinks). Eyeballing is subjective; when in doubt, take a little larger, since extra variance can be fixed with more runs but bias cannot.
6.4.2. Replication/deletion approach for means
Once a good cutoff value (warm-up period) has been determined, the analysis proceeds like the terminating-simulation analysis of §6.3:
- make independent replications, each of length and each with warm-up period ;
- compute the mean and variance estimates across replications;
- construct confidence intervals;
- often, use pilot runs to determine the warm-up period (Welch’s procedure, §6.4.1) and then throw away the first observations from the new production runs.
In formulas: from replication keep only the observations after the warm-up and average them,
then compute and from , and the CI for is
Why this works: the ’s are i.i.d., because the runs are independent copies of the same experiment (same initial conditions, separate random-number streams), and , because the warm-up period was deleted. So the ’s play exactly the role of the ’s of §6.3, and everything there applies: the CI, its interpretation (§6.3.1), its quality (§6.3.2), and the procedures for choosing for a desired precision (§6.3.3). The correlation within a run no longer causes trouble: it is hidden inside each , and only the ’s, one per run, enter the CI.
The production runs should be much longer than the warm-up (); they can be longer than the pilot runs.
E.g. the M/M/1 queue (, started empty, ) with from Welch’s procedure. production runs of length gave
, , half-width , so the 95% CI is , which covers . Repeating the whole experiment 2000 times, the CI covered in 91.6% of experiments with and 93.6% with (without deletion, : 89.0% and 89.2%). The remaining shortfall from 95% is the skewness of the ’s, as in §6.3.2.
Pros and cons:
- + Simple: it is the familiar i.i.d. analysis, and the ’s are truly independent.
- − Every run has to pass through the transient: observations are thrown away (here out of ).
- − If is chosen too small, the remaining bias is in every and does not average out over the runs (§6.4.1).
The second point motivates the batch means method: use one run, so the transient is passed only once.
6.4.3. The batch means method
The batch means method is the most popular alternative to replication/deletion. The idea is to perform one very long simulation run and estimate the steady-state parameters from that single run by dividing the output into batches.
Make one simulation run of length , with very large. Divide the observations into batches of size , so that :
(Here is the number of batches, not the number of runs: there is only one run.) Let
be the sample mean of the observations in the -th batch. Then are the batch means. Let
be the grand sample mean. This is used as a point estimator of . Note that
since all batches have the same size, the average of the batch means is just the average of all observations. Batching does not change the point estimate; it is needed only to estimate its variance.
When is large, the influence of the initial condition dies out: the biased early observations are only a small fraction of the observations. (One can also delete a warm-up period first and batch the rest, as in the figure and the example below.)
If is large enough, then the batch means will be approximately uncorrelated and approximately normally distributed. Why:
- Uncorrelated: and are correlated, but the correlation dies out as the lag grows. Two neighboring batches are correlated only through the observations near their common boundary (the end of one batch and the beginning of the next). When is much longer than the “memory” of the process, these are a small part of each batch, so the correlation between batch means is small.
- Normal: each batch mean is an average of observations; by a central limit theorem for correlated observations, it is approximately normal for large (the same reason as in §6.3.2, where an that is an average of many observations gave good coverage).
For normal random variables, uncorrelated plus jointly normal implies independence. Thus, for sufficiently large , it is reasonable to treat the batch means as i.i.d. normal random variables and construct confidence intervals for exactly as in §6.3, with the batch means in the role of the ’s. An estimate of the variance (of one batch mean) is
and the CI for is
Why not simply treat the observations themselves as i.i.d., and use their sample variance divided by ? Because they are positively correlated, is much larger than (positive covariances add to the variance of a sum: , §2.3), so that CI would be far too narrow. In the M/M/1 example below (), the naive i.i.d. 95% CI has an average half-width of only 0.05, while the actual standard deviation of is 0.49: the naive standard error is about 19 times too small, and the naive CI covered in only 9% of experiments. Batching fixes this because each batch mean already contains the effect of the correlation within its batch.
Choosing the batch size. The advantage of batch means is that the initial transient is encountered only once. The difficulty is choosing the batch size (for a fixed , choosing is the same as choosing the number of batches ):
- If is too small, the batch means are highly correlated and can be a poor estimator. (Positively correlated batch means look less spread out than independent ones would, so underestimates the variance and the CI is too narrow.)
- If is too large, there are fewer batches and the variance of the variance estimator is large: is based on only a few batch means and is large, so the CI is wide and unstable.
A rule of thumb is that there is little benefit from more than 30 batches, but there should not be fewer than 10:
Why: M/M/1 (), warm-up 600 deleted, then one run of cut into batches; 2000 repetitions, 95% CIs:
| batches | batch size | correlation of neighboring batch means | average half-width | coverage | |
|---|---|---|---|---|---|
| 5 | 24,000 | 0.01 | 2.776 | 1.26 | 94.2% |
| 10 | 12,000 | 0.02 | 2.262 | 1.04 | 93.3% |
| 20 | 6,000 | 0.01 | 2.093 | 0.97 | 93.4% |
| 30 | 4,000 | 0.03 | 2.045 | 0.95 | 93.2% |
| 50 | 2,400 | 0.05 | 2.010 | 0.92 | 93.0% |
| 100 | 1,200 | 0.11 | 1.984 | 0.86 | 91.1% |
| 300 | 400 | 0.33 | 1.968 | 0.71 | 85.3% |
| 600 | 200 | 0.51 | 1.964 | 0.58 | 76.9% |
From 5 to about 20–30 batches, the CI gets narrower (the critical value drops from 2.78 to about 2.05, and is based on more batch means) at no cost in coverage. Beyond about 30, hardly changes any more (it is already close to ), so there is little left to gain; the further narrowing comes from correlated batch means making too small, and the coverage drops.
E.g. one run of the M/M/1 queue: warm-up 600 deleted, then in batches of : , , half-width , so the 95% CI is , which covers .
6.4.4. Regenerative method
The regenerative method is similar in spirit to batch means. It tries to construct independent replications from a single run, using regeneration points. The difference: batch means cut the run at fixed places (every observations), so the pieces are only approximately independent; the regenerative method cuts the run at random places chosen so that the pieces are exactly i.i.d.
A regeneration point is a random time at which the process probabilistically restarts itself: from that time on, the process behaves (in distribution) exactly as if it had just been started, independently of what happened before. The process between two successive regeneration points is called a regeneration cycle.
Ex: single-server queue. A customer who arrives to an empty system finds the same situation every time: nobody waiting, the server idle, and the customer starts service at once. Everything after that (the following interarrival times and service times) is new and independent of the past. So the arrival times of customers who find the system empty are regeneration points. In terms of the delays, these are exactly the customers with . A run started empty has , so it starts at a regeneration point.
Suppose the output process has regeneration points
At each regeneration point, the process after is independent of the process prior to . Let
be the length of the -th cycle (the number of observations in it), and let
be the sum of the observations in the -th cycle.
In the queue, cycle consists of the customers served in one busy period: = number of customers served in the busy period, = their total delay. A cycle with is a customer who arrives to an empty system and leaves before the next arrival, so .
Then
are i.i.d. bivariate random variables: different cycles are independent copies (each cycle starts from a fresh restart), but within a cycle and are dependent (a long busy period, large , also has large delays, large ).
By the renewal-reward theorem,
This is the long-run average cost or reward per unit time: each cycle earns a “reward” and takes “time” (counted in observations). Why it holds: over the first cycles there are observations with total , so their average is
by the SLLN (§2.4) applied separately to the i.i.d. ’s and the i.i.d. ’s. E.g. in the M/M/1 queue, a busy period serves on average customers, so .
Assume we simulate exactly regeneration cycles. Let
A point estimator of is
This estimator is biased, because the expected value of a ratio is not the ratio of the expected values:
but it is strongly consistent:
(this is the calculation above). In the M/M/1 example, the average of over many runs was 6.97 for cycles, 7.93 for and 8.08 for : a large bias for few cycles, disappearing as grows.
Confidence interval. The problem: is a ratio of two averages, so the CLT cannot be applied to it directly. The trick is to turn the ratio into an average. Let be the covariance matrix of :
Let
The ’s are i.i.d. (functions of the i.i.d. ’s), and
because , and
(the variance of a linear combination: with , ). By the central limit theorem,
Why this gives a CI for : the average of the ’s is
so the statement above says
i.e. is approximately normal around with standard deviation .
Since is unknown, estimate it using the sample covariance matrix
where ; so is the sample variance of the ’s, the sample variance of the ’s, and their sample covariance. Then, with in place of the unknown ,
An approximate confidence interval for is
(, not : the whole result is a large- approximation.)
E.g. one run of the M/M/1 queue, started empty, cycles (8438 customers). The first cycles were Over all 1000 cycles: , , so ; , , , so
and the 95% CI is . It covers but is wide. Over many runs, this CI covered in 55% of runs with cycles, 81% with and 91% with . The cycles of this queue are extremely variable (most busy periods are short, a few are very long with huge ), so the ratio estimator is biased and the normal approximation is poor unless there are many cycles.
Difficulty of the regenerative method: many processes may not have regeneration points. Even if they do, the expected cycle length may be so large that only a few cycles can be simulated (e.g. in a large network of queues, the moment when all queues are empty at the same time is rare).
Ex: single-server queue regeneration points. Possible regeneration points include the arrival times of customers who find the system empty (above). Two choices that do not work:
- Times immediately after busy cycles end (the moment the system becomes empty) are not good regeneration points if the time until the next arrival is not identically distributed. At that moment the next arrival is already “on its way”: the remaining time until it depends on how long ago the previous arrival happened, which differs from one busy period to the next. (Only for exponential interarrival times does this not matter, by the memoryless property.) An arrival to an empty system, by contrast, starts a brand-new interarrival time.
- Arrival times of customers who find one customer in the system are also not regeneration points, because the remaining service time of the customer in service is differently distributed: it depends on how long that service has already been going on. The process after such an arrival is not a fresh copy.
What the regenerative method offers in exchange: if the run starts at a regeneration point (e.g. an empty queue), there is no initial transient problem at all, there is no batch size to choose, and the cycles are exactly i.i.d.
6.4.5. Sequential procedure
A sequential procedure sequentially determines the length of a single run needed to construct an acceptable confidence interval.
Explanation. In §6.3.3 we chose the number of replications to reach a desired precision. For a single long run (e.g. batch means), the corresponding question is: how long must the run be? This cannot be computed in advance, because the variance of depends on the unknown correlation structure of the process. A sequential procedure decides while the run is going. One simple version:
- Run the simulation for an initial length (after the warm-up).
- Construct a CI from the data so far, e.g. by batch means with a fixed number of batches.
- If the CI is acceptable (e.g. its relative half-width is at most , as in §6.3.3), stop. Otherwise continue the same run to a longer length (e.g. double it) and go back to step 2.
(The procedures in the textbook are more refined, e.g. they also check that the batch means are approximately uncorrelated before accepting the CI.)
E.g. M/M/1 queue, warm-up 600, 20 batches, start at and double until the 95% CI has relative half-width . Over 2000 repetitions the procedure stopped at (9% of runs), (41%), (44%) or (5%), and rarely earlier. The estimate was within 10% of in 95.8% of runs, but the final CI covered in only 90.2% (with a fixed : 94.8%). The stopping rule is slightly optimistic: it tends to stop at moments when happens to be small, i.e. when the CI happens to look narrow.
6.4.6. Summary for steady-state simulations
The problem (§6.4): within one run the observations are correlated and the early ones are biased. All methods construct (approximately) i.i.d. pieces and then use the i.i.d. analysis of §6.3:
| method | runs | warm-up | i.i.d. pieces | CI | main difficulty |
|---|---|---|---|---|---|
| replication/deletion (§6.4.2) | independent runs | deleted in every run ( from Welch, §6.4.1) | , exactly i.i.d. | -CI from the ’s | choosing ; the transient is paid times |
| batch means (§6.4.3) | one long run | passed once | batch means , approximately i.i.d. | -CI from the batch means | choosing ( batches) |
| regenerative (§6.4.4) | one run | none, if started at a regeneration point | cycles , exactly i.i.d. | ratio CI with | needs regeneration points; many cycles needed |
| sequential (§6.4.5) | one run, extended as needed | passed once | e.g. batch means | stops when the CI is precise enough | stopping rule is slightly optimistic |
6.5. Multiple Performance Measures
In practice, we are often interested in several performance measures simultaneously (e.g. the average delay in queue, the average number in queue and the server utilization of the same system). Thus we may construct several confidence intervals:
where is the true value of the -th performance measure and is its CI. The question is how these individual confidence intervals affect the overall confidence level:
This is the probability that all confidence intervals simultaneously contain their corresponding performance measures. It matters whenever conclusions are drawn from all the intervals together (“the delay is in and the utilization is in ”).
If the performance measures (more precisely, their CIs) are independent, then
E.g. three independent 95% CIs: , so all three are correct together only with probability 85.7%, not 95%.
In practice, however, performance measures are unlikely to be independent (they are computed from the same simulation runs). A conservative approach uses Bonferroni’s inequality, which holds for any dependence:
Step by step:
- “All intervals are correct” is the intersection of the events .
- Complement: its opposite, “at least one interval is wrong”, is the union of the events (De Morgan’s law), so .
- Union bound (Boole’s inequality): , because the sum counts the overlaps of the events more than once. Subtracting a larger number gives “”.
- Each interval is wrong with probability (at most when the CI is approximate).
Therefore, the overall confidence level is at least
E.g. three 95% CIs: overall at least (compare 85.7% in the independent case). In the other direction, to get an overall level of at least , choose the ’s so that , e.g. : for measures and overall 90%, make two 95% CIs; for and overall 90%, five 98% CIs. The price is that each individual CI is wider (a larger critical value ), so with many measures the individual CIs can become too wide to be useful.