You are on page 1of 27

Rare Events Simulation

Excellent things are rare . Plato (428 BC-348 BC)

Outline Motivation Importance Sampling Importance Splitting (Restart)

Rare Events Occur in many realworld systems, may cause serious consequences, Occur with extremely small probability (e.g. p < 109) Difficult to simulate. Reliable statistics require sufficiently large number of observations: for probability 109 on average 109 trials for one observation.

Rare Events in Computer and Communication Systems Bit errors in digital communications Component and system failures (fault tolerant systems, reliability, availability) Queuing Systems

excessive number of packets in queue, waiting


times, delays buffer overflows, packet loss,

The Problem of Rare Event Simulation


Given a random variable X with distribution P, estimate by direct simulation
1, if event A occurs = P{ A} = EP {I A ( X )} ; I A = 0, otherwise

Generate samples X1,X2, . . . ,XN, IID according to distribution P. Calculate sample mean and variance
1 = N

I
i =1

(Xi ) =

(unbiased sample mean) (variance of sample mean, Bernoulli test)

2 ( ) =

I2
N

(1 )
N

Confidence interval

z1 / 2

(1 )
N
0

1 (1 ) 1 Relative error: = N N

Direct Rare Event Simulation Sample Size


Required confidence interval for

confidence level 1 maximum relative half-width

What sample size N is needed

z1 / 2

(1 )
N

< N

z12 / 2 1

Numerical example:
99% confidence interval 1 = 0.01 and z1/2 = 2.576 maximum relative half-width of 10%; =0.1
N 100 2.576
2

For instance, if = 109 N 6.64 1011

Simulation Speed-Up
Simulation = statistical estimation. Simulation speed-up: significantly reduce the time to get statistical estimates of desired accuracy (confidence interval half-width, relative error) Two ways:

Make more experiments in same time Generate more rare events during simulation, in same time increase the frequency of the rare event of interest (Rare Events Provoking)
Importance Sampling Importance Splitting (RESTART)

Outline Motivation Importance Sampling Importance Splitting (Restart)

Importance Sampling Method


Modify pdfs (inter-arrival or service time distributions, component failure rates, densities, transition probabilities etc. (Change of Measure, Biasing) Perform simulation under modified probability measure Un-bias results by correcting factor, the Likelihood Ratio When applied properly, enormous variance reduction (several orders of magnitude) can be obtained. If not, variance may grow

Elementary Example: Monte-Carlo simulation

Objective: determine the area of region C Generate N IID samples (uniformly distributed over the entire space A) Estimate the area of C as SC = NC/N, where NC is the number of hits within region C The variance of this estimate is inversely proportional to N, while the precision of the estimate is related to the number of hits NC in the important region

Elementary Example: Monte-Carlo simulation with Importance Sampling

Bias the sampling procedure to increase the fraction of samples that result in hits. Double the probability that samples are generated in the quadrant D, containing C The average number of samples in region C is doubled, increasing the estimator precision Each sample which results in a hit in region D must be weighted by a factor of 1/2 to obtain the correct, unbiased result

Elementary Example: Monte-Carlo simulation with Importance Sampling: Problem


Regions in the space with increased sampling frequency must include the important region. This can be a problem in case of insufficient prior knowledge of system behavior. If the region of interest is outside of B , the biased scheme used here reduces the number of hits and the corresponding estimator precision by a factor of two (the weight of each hit is 2!) The art of Importance Sampling.

Importance Sampling Analysis: Idea


f(x)

PDF

x y Problem: Estimate: Pf{x>y} << 1

Importance Sampling: Idea


f(x) Pf*{x>y} >> Pf{x>y}
PDF

f*(x) x y Problem: Estimate: Pf{x>y} << 1

Importance Sampling: Idea


Let f(x) be the original sampling distribution and X the stochastic variable. If g(x) is the property of interest, the original problem is that the probability of observing g(x) > 0 is very small when taking samples from f(x). To solve this problem, importance sampling changes the sampling distribution to a new distribution f*(x). Taking samples from f*(x) should increase the probability of observing g(x) > 0 significantly. To retain an unbiased estimate the observations must be corrected because the samples x are from f*(x) and not f(x).

Importance Sampling: Idea


We are estimating Ef [g(X)].

where L(x) = f(x)/f*(x) is denoted the likelihood ratio. Observe that the expected value of the observations under f is equal to the expected value of the observations under f* corrected for bias by the likelihood ratio,

Importance Sampling: Likelihood Ratio

Pf*{x>y} >> Pf{x>y}


PDF

f ( x1 ) = L( x1 ) ** f f ((x) x1 )

y x1

x x

Importance Sampling: Estimator


An unbiased estimator for , taking samples x from f*(x):

with variance

Importance Sampling: Change of Measure Choice Problem


Main challenge : obtain good change of measure from the original sampling distribution f(x) to a new distribution f*(x), The optimal f(x) is the one that minimizes the variance. Two general guidelines can be given: 1. if g(x)f(x) > 0 then f*(x) > 0, otherwise L(x) infinite 2. (g(X)L(X) - ) must be small, f*(x) g(x)f(x)/ .

Outline Motivation Importance Sampling Importance Splitting (Restart)

RESTART (REpetitive Simulation Trials After Reaching Thresholds)

Rare event A2

Birth-death process with P(A2) P(A1) 1 Further: P(A2) P(A2|A1) and P(A1|A2) ~ 1

RESTART Algorithm : Idea

Restarting the simulation in valid states of the system that provoke the events of interest more often than in a straightforward simulation, thus leading to a shorter simulation run time. Determine P(A1) with sufficient accuracy Determine P(A2|A1) with sufficient accuracy by repeated simulation runs starting from the state A1 Target value P(A2) = P(A2|A1) P(A1)

One-level Restart

Random variable X over simulation time Threshold at I, rare event at B P{ x B} = P{x B | x I} P{x I}

Single Step vs. Global Step Single Step approach : complete all the paths starting from a certain stage before we move to the next one. Global Step approach : generate all the offspring originating from a single root (i.e. a state in the upper stage which is reached immediately from the lower state) before we move to the next root.

Multi-level Restart (Single Step)

Multi-level Restart (Global Step)

Multi-level Restart: Formula


Number of levels: m (0 is non-RESTART or direct simulation) Thresholds Ij with j=0..m-1 and m=1,2,3,; I0 = 0 and Im = B (the rare event) Conditional complementary distribution function for each level: P{x Ij| x Ij-1}
P{x B} = P{x B | x Im-1} P{x Im-1| x Im-2} P{x I1| x I0} P{x I0}

You might also like