Ways to get tighter confidence intervals from the same simulation budget: common random numbers, antithetic variates, control variates, indirect estimation, stratified sampling, conditioning, and importance sampling.
Estimate μ=E[X] from n i.i.d. replications X1,…,Xn: the point estimator is μ^=Xˉ(n), and the 100(1−α)% CI is
[μ^−tα/2,n−1nσ2,μ^+tα/2,n−1nσ2],σ2=Var(X)
(in practice σ2 is estimated by S2(n), as in §6.3).
Goal: reduce the variance σ2 at no additional simulation cost. The half-width is proportional to σ/n, so there are two ways to make the CI narrower: more replications (a larger n, which costs computer time; by §6.3.3 the required n is proportional to σ2), or a smaller σ2 for the same n. Variance reduction techniques do the second, by using the random numbers more cleverly: halving σ2 is as good as doubling n, but costs (almost) nothing.
7.1. Common Random Numbers (CRN)
Applicable when comparing two or more alternative systems.
Idea: we want the simulation experiments to be conducted under the same “experimental conditions”, i.e. with the same random numbers, so that an observed difference in performance is due to the difference between the systems and not to the random numbers (“luck”) of each simulation.
Ex: 1. M/M/1, 2. M/M/2.
Xi = average delay in queue in system i=1,2. Goal: estimate ζ=E[Z]=E[X1−X2], where Z=X1−X2.
Repeat the experiment n times (each time simulating both systems) and get Z1,Z2,…,Zn, with Zj=X1j−X2j. The point estimator is
Zˉ(n)=n1j=1∑nZj,
and the half-width of the 100(1−α)% CI is
tα/2,n−1nVar(Z1)
(with Var(Z1) estimated by the sample variance of the Zj’s), where
If the two systems are simulated with independent random numbers, cov(X1,X2)=0. We want cov(X1,X2)>0: then the last term is subtracted and Var(Z1) is smaller than with independent sampling.
CRN is a technique that tries to induce this positive correlation by using the same random numbers to simulate all alternative systems. (A first example was in §6.3.3: for M/M/1 vs M/D/1, CRN reduced Var(Zj) from 3.79 to 2.23.)
When does CRN work?
u1,u2,…,un⟶simulation program⟶X
The simulation program is a (complicated, but deterministic) function of the random numbers: X=X(u1,u2,…). To picture it, pretend that X depends on a single random number: X=X(u). CRN feeds the same u to both systems, so the question is how X1(u) and X2(u) react to u.
Desired cases: X1 and X2 both increase, or both decrease, in u.
Backfire: one increases while the other decreases. Then CRN induces a negative correlation and increases the variance.
How can we guarantee the desired case? There is no guarantee: the simulation program is far too complicated to check whether it is monotone in every random number. But we can make it very likely, by looking at the two parts that turn random numbers into an output:
flowchart LR
U(["uᵢ's"]) --> RVG
subgraph H["X(u₁, u₂, …): monotone if each box is monotone"]
RVG["RVG: random numbers → random variates"] --> SP["simulation program: random variates → X"]
end
SP --> X(["X"])
The composition of two monotone functions is also monotone, so each part has to be monotone:
The random variate generator (RVG) is under our control. Use the inverse transform (§4.2.1): X=F−1(u) is increasing in u, so a larger u always gives a larger variate. Other methods are not monotone; e.g. with acceptance–rejection a slightly different u can change which candidate is accepted, and even how many u’s are used. So always use the inverse transform in the CRN approach.
The simulation program (the model itself) should react monotonically to the variates. This we cannot control, but it can usually be checked by reasoning about the model, as in the queueing example below.
Queueing simulation (service times in the M/M/1 and the M/M/2 system, both generated by the inverse transform from the same u):
u↑⇒S1↑ and S2↑⇒X1↑ and X2↑
(longer service times mean longer delays in both systems). Likewise for interarrival times: u↑⇒A1↑ and A2↑⇒X1↓ and X2↓. Both systems react in the same direction to every random number, which is the desired case.
Synchronization: it is not enough to use the same stream of random numbers to simulate the alternative systems. We must match up (synchronize) the random numbers across the different systems, to ensure that the same u is used for the same purpose in the different systems.
Ex: one stream u1,u2,… is used for everything, each random number being taken when the program needs one (A = used for an interarrival time, S = used for a service time):
random number
used in M/M/1 for
used in M/M/2 for
u1
A
A
u2
A
A
⋮
⋮
⋮
u7
S
S
u8
A
A
→u9
A
S
Up to u8 the two systems happen to need the random numbers for the same purposes. But the systems are different, so their events eventually happen in a different order: e.g. in the M/M/2 system a waiting customer starts service on the second server (which needs a service time) while in the M/M/1 system the next event is an arrival (which needs an interarrival time). From u9 on, the same u is used as an interarrival time in one system and as a service time in the other, and all later random numbers are shifted as well. The two systems are no longer driven by the same inputs, and most of the positive correlation is lost.
General synchronization methods:
Dedicate a stream of random numbers to a particular source of randomness (§3.3), e.g. stream 1 for all interarrival times and stream 2 for all service times. Then the k-th interarrival time always uses the k-th number of stream 1, in both systems, no matter in which order the events happen.
Use the inverse transform method to generate random variates: it guarantees monotonicity and is one-to-one (exactly one u per variate). With acceptance–rejection, the number of u’s used per variate is random, so the streams drift out of synchronization even when they are dedicated.
Generate all random variates beforehand, e.g. generate customer j’s service time when customer j arrives and attach it to the customer. Then customer j has the same service time in both systems, even if it starts service at different times or (with other queue disciplines) in a different order.
E.g. with numbers (my choice): arrival rate 1; system 1 has one server with mean service time 0.9, system 2 has two servers with mean service time 1.8 each (the same total capacity); Xi = average delay in queue of the first 100 customers, starting empty; 3000 replications of each version:
random numbers
corr(X1,X2)
Var(Z)
change
independent for the two systems
0.01
16.4
CRN, one shared stream, not synchronized
0.08
15.7
−4%
CRN, dedicated streams for arrivals and services (synchronized)
0.997
0.057
−99.7%
backfire: system 2 uses 1−u wherever system 1 uses u
−0.36
23.3
+42%
Here E[Z]≈0.43 (the M/M/2 system has slightly shorter delays). With n=10 replications, the 95% CI half-width is 2.26216.4/10=2.9 with independent random numbers (the CI cannot even tell which system is better), but 2.2620.057/10=0.17 with synchronized CRN. Note that sharing a stream without synchronization gives almost nothing: CRN only works when the same u is used for the same purpose.
7.2. Antithetic Variates (AV)
Used when investigating the performance of a single system.
Idea: make the replications in pairs, such that a large observation in the first replication of a pair tends to be matched by a small one in the second; their average is then closer to μ than the average of two independent replications.
Use ui’s for the first replication of a pair to get X(1).
Use 1−ui’s for the second replication, in the same roles, to get X(2).
Since 1−U∼U(0,1) when U∼U(0,1), both are valid replications: E[X(1)]=E[X(2)]=μ and Var(X(1))=Var(X(2))=σ2. (X(1),X(2) are the two runs of one pair, not two systems as in §7.1.) Use the pair average as the observation:
With two independent replications the covariance would be 0 and the variance σ2/2. So AV helps exactly when cov(X(1),X(2))<0. With n pairs (different pairs use independent random numbers), the pair averages X1,…,Xn are i.i.d., and the CI is computed from them as usual, with tα/2,n−1.
Why the covariance is negative:
ui↑⇒X(1)↑,1−ui↓⇒X(2)↓.
Applicability: the output reacts monotonically to the underlying random numbers (the same condition as for CRN; here it makes the two runs of a pair move in opposite directions).
Practical issues:
Synchronization: 1−ui must be used for exactly the same purpose in the second run as ui in the first.
Use the inverse transform to generate random variates (monotone, one u per variate).
Use dedicated streams for the different sources of randomness.
Do not combine CRN with AV (in a comparison of systems): it may backfire. With both, system 1’s first run (with u) and system 2’s second run (with 1−u) are negatively correlated, and these cross-covariances enter Var(Z) with the wrong sign: they increase it. Whether the net effect is a reduction is not clear in advance.
Ex: θ=E[eU], U∼U(0,1):
θ=∫01eu⋅1du=e−1=1.718.
To compare fairly, both approaches use two evaluations of eu.
Approach 1: crude Monte Carlo simulation. Generate U1,U2∼U(0,1), independent (U1⊥U2), and use
because eUe1−U=e is a constant and E[e1−U]=E[eU]=e−1. So
Var(θ^)=0.121−20.2342=0.0039.
The percentage reduction in variance is (0.121−0.0039)/0.121=96.8%.
Why so much: eu is increasing in u, so eU and e1−U move in opposite directions, and their average is almost constant:
In a real simulation the reduction is usually much smaller, because the output is far from such a simple, almost linear function of each u. E.g. the M/M/1 queue above (X = average delay of the first 100 customers, μ≈4.13, σ2≈8.67), with 1−u for both the interarrival and the service times in the second run: corr(X(1),X(2))=−0.36, so the pair average has variance 2.80 instead of σ2/2=4.34, a reduction of 35%.
7.3. Control Variates (CV)
Goal: estimate μ=E[X], X = average delay in queue of the first 100 customers.
Suppose there is an intermediate r.v. Y satisfying
the value of Y can be observed (in the same run as X);
Y and X are correlated;
ν=E[Y] is known.
E.g. Y = average service time of the first 99 customers. ν is known: it is the mean of the service-time distribution, which we chose as an input. (99, not 100: the delays of customers 1,…,100 depend only on the service times of customers 1,…,99.)
If Y>ν (the service times happened to be long in this run) ⇒ probably X>μ (the delays are long too) ⇒ adjust the value of X downwards, towards μ.
If Y<ν⇒ probably X<μ⇒ adjust X upwards.
Y is called a control variate: it measures how lucky or unlucky the run was, and we correct X for that luck.
How to decide the adjustment amount?
Let X = the observed value and Xc = the value of X after the adjustment, so the adjustment amount is X−Xc. Assume it is proportional to how far Y is from its mean:
X−Xc=a(Y−ν),Xc=X−a(Y−ν).
E[Xc]=E[X]−aE[Y−ν]=μ−a⋅0=μ,
so Xc is unbiased for every constant a. Its variance (ν is a constant, so it does not affect the variance):
So with the best a, the variance is reduced by the fraction ρXY2: the more strongly X and Y are correlated (positively or negatively), the better. a∗ has the sign of cov(X,Y): with a negatively correlated control, a∗<0 and X is adjusted upwards when Y>ν.
E.g. M/M/1 queue (arrival rate 1, mean service time 0.9, so ν=0.9), X and Y as above: Var(X)=8.67, Var(Y)=0.00819, cov(X,Y)=0.1663, so ρXY=0.624 and a∗=0.1663/0.00819=20.3. Then Var(Xc∗)=(1−0.6242)×8.67=5.29, a reduction of 39%. With a=1 instead, the condition Var(Y)≤2cov(X,Y) holds (0.008≤0.33), but the variance only drops to 8.35 (4%): Y varies much less than X, so a large factor a is needed.
One limitation: Var(Y) and cov(X,Y), and hence a∗, are usually unknown. In practice, perform n simulation runs, giving (X1,Y1),…,(Xn,Yn), and estimate them from the runs:
(the slope of the least-squares line of X on Y, the line in the figure above). The control-variate estimator is then
Xˉc(n)=Xˉ(n)−a^∗(n)[Yˉ(n)−ν].
Drawback: a^∗(n) is now a random variable computed from the same Yi’s as Yˉ(n), so the two are not independent, and
E[a^∗(n)(Yˉ(n)−ν)]=E[a^∗(n)]E[Yˉ(n)−ν]=0.
So E[Xˉc(n)]=μ: the estimator is biased, and the usual CI formula is no longer exact. (This is the standard drawback; the formula on the board was most likely this one.) The bias goes to 0 as n grows. It can be avoided by estimating a∗ from separate pilot runs: then a^∗ is independent of Yˉ(n), the expectation above factorizes, and it equals 0. E.g. in the M/M/1 example with n=10 runs and a^∗ estimated from them, the variance of Xˉc(10) was 0.58 instead of 0.86 for Xˉ(10) (a 33% reduction), with a bias of −0.07.
Ex. Estimate θ=E[eU], where U∼U(0,1) (θ=e−1=1.718, as in §7.2).
Crude Monte Carlo: generate U∼U(0,1) and use θ~=eU, with
Var(θ~)=Var(eU)=0.242.
Control variates: let U itself be the control variate. It is observed, it is correlated with eU, and its mean E[U]=21 is known.
θ^=eU−a∗(U−21),a∗=Var(U)cov(eU,U)=1.690,
because
cov(eU,U)=E[UeU]−E[U]E[eU]=1−21(e−1)=0.1409,
where
E[UeU]=∫01ueudu=[(u−1)eu]01=1,
and Var(U)=121, so a∗=12×0.1409=1.690 (1.692 on the board is a small rounding slip). So
(this is (1−ρ2)Var(X) from above, with ρ2=0.14092/(0.242×121)=0.9837).
Reduction in variance: (0.242−0.0039)/0.242=98.4%.
Why so much: eu is almost a straight line on [0,1], and 1.718+1.690(u−21) is the best straight line through it, so θ^ only keeps the small curvature. (Compare §7.2: antithetic variates also reached 0.0039, but with two evaluations of eu; here one is enough.)
7.4. Indirect Estimation
Idea: use known relationships, and replace random quantities by constant known quantities wherever possible.
Queueing example:
Di = delay in queue of the i-th customer
Wi = total waiting time in system of the i-th customer
(the second equalities hold with probability 1, by the same long-run-average argument as in Chapter 6, §6.4.4). Their direct estimators, from a run with n customers that ends at time T(n) (e.g. when the n-th customer leaves):
The term in braces is a random average of the service times, but its mean E[S] is known (we chose the service-time distribution). Replace it by its known mean:
where Sˉ(n)=n1∑iSi. In a queue, long service times cause long delays, so cov(d^(n),Sˉ(n))>0 and Var(w~(n))<Var(w^(n)). (w~(n)=w^(n)−[Sˉ(n)−E[S]] is a control-variate estimator with Y=Sˉ(n) and a=1, §7.3.)
Little’s Law
L=λ⋅w
where λ is the arrival rate; likewise LQ=λ⋅d.
Why: each customer is charged 1 dollar for every unit of time he spends in the system. Compute the long-run average reward earned per unit time in two ways:
By time: at time t, L(t) customers are in the system, each paying 1 dollar per unit time, so the reward rate is L(t). The total reward up to time T is ∫0TL(t)dt, and the average reward per unit time is T1∫0TL(t)dt→L.
By customer: customer i pays Wi in total. With N(T) = the number of customers who arrived by time T,
T1i=1∑N(T)Wi=TN(T)⋅N(T)1i=1∑N(T)Wi→λ⋅w,
since N(T)/T→λ (arrivals per unit time) and the average of the Wi’s →w. (Customers still in the system at time T have not paid everything yet, but this is negligible as T→∞.)
Both compute the same long-run reward rate, so L=λw. Charging only for the time spent in the queue gives LQ=λd in the same way.
Use in indirect estimation: λ is a known input, so L and LQ can also be estimated indirectly, instead of by the time averages L^(n), Q^(n):
L~(n)=λw~(n)=λ(d^(n)+E[S]),Q~(n)=λd^(n).
So all four quantities are estimated from d^(n) alone.
E.g. M/M/1 queue (λ=1, E[S]=0.9, empty start), first n=1000 customers, 20,000 runs:
quantity
direct estimator
variance
indirect estimator
variance
reduction
w
w^(n)
14.48
w~(n)=d^(n)+E[S]
14.37
0.8%
L
L^(n)
16.05
L~(n)=λw~(n)
14.37
10.5%
LQ
Q^(n)
15.83
Q~(n)=λd^(n)
14.37
9.3%
The gains are small here (the delays, d≈8.1, dominate W, so the service times add little noise), but they come for free.
7.5. Stratified Sampling
Goal: estimate θ=E[X], using an intermediate r.v. Y∈{1,2,…,k} with known p.m.f.: P(Y=i), i=1,…,k, is given. By the law of total expectation,
θ=E[X]=i=1∑kE[X∣Y=i]P(Y=i).
Let Xˉi be an estimator of E[X∣Y=i]: the average of ni observations of X generated conditional on Y=i (from “stratum” i). Then the stratified sampling estimator is
θ^=i=1∑kXˉiP(Y=i).
Why it helps: the strata are sampled independently, so
Var(θ^)=i=1∑kP(Y=i)2niVar(X∣Y=i).
With N runs in total and proportional allocation, ni=NP(Y=i), this is N1∑iP(Y=i)Var(X∣Y=i)=N1E[Var(X∣Y)]≤N1Var(X), the crude Monte Carlo variance with N runs. Stratification removes the part N1Var(E[X∣Y]) of the variance, i.e. the randomness of how many observations happen to fall in each stratum (law of total variance, §7.6).
Ex: Estimate E[g(U)]=∫01g(x)dx, U∼U(0,1). Two approaches, each with 2n evaluations of g.
Derivation: let A=∫01/2g, B=∫1/21g, A2=∫01/2g2, B2=∫1/21g2. The density of 21U is 2 on (0,21), so E[g(21U)]=2A, E[g2(21U)]=2A2, and Var(g(21U))=2A2−4A2; likewise for the other half. Then
The reduction is large when the two halves have very different integrals. Crude Monte Carlo may by chance put more points in one half; stratification puts exactly n in each:
E.g. g(x)=ex: A=e1/2−1=0.649, B=e−e1/2=1.070, (A−B)2=0.177, and Var(g(U))=0.242. So Var(g^)=0.242/2n and Var(g~)=(0.242−0.177)/2n=0.065/2n: a 73% reduction.
7.6. Conditioning
Goal: estimate μ=E[X], using an intermediate r.v. Z satisfying: if the value of Z is known, then E[X∣Z=z] is a known, deterministic function of z (it can be computed exactly, without simulation).
μ=E[X]=E[E[X∣Z]].
The conditioning estimator is
μ^=E[X∣Z=z],
evaluated at the observed value z of Z (i.e. the random variable E[X∣Z]): instead of using the observed X, observe Z and use the exact conditional mean.
Ex: a single-server queue (FCFS) with exponential service times. μ=E[Di], Di = delay of the i-th customer. Z = number of customers in the system seen by the i-th arrival. Then
E[Di∣Z=z]=zE[S].
Why: customer i has to wait for the z customers ahead of him. The z−1 customers waiting in the queue each need a full service time (mean E[S]). The customer in service needs its remaining service time, which by the memoryless property of the exponential distribution also has mean E[S], no matter how long the service has already lasted. In total, zE[S]. (With non-exponential service times the remaining service time would depend on the elapsed service time, and the formula would fail.) So the conditioning estimator of E[Di] is ZE[S], and for the average delay of the first n customers it is n1∑i=1nZiE[S].
Law of total variance:
Var(X)=E[Var(X∣Z)]+Var(E[X∣Z])
(total variance = average variance within each value of Z + variance of the conditional means). Hence
Var(E[X∣Z])=Var(X)−E[Var(X∣Z)]≤Var(X),
since E[Var(X∣Z)]≥0. So the conditioning estimator μ^=E[X∣Z] is unbiased (because μ=E[X]=E[E[X∣Z]]) and its variance is never larger than that of X. The randomness it removes is E[Var(X∣Z)]: here, the randomness of the actual service times of the customers ahead, which is averaged out exactly instead of being simulated.
E.g. M/M/1 queue (λ=1, E[S]=0.9, empty start), X = average delay of the first 100 customers (20,000 runs): both estimators have mean 4.13, but Var(X)=8.48 while Var(1001∑i0.9Zi)=6.56, a 23% reduction.
where Y has density f, and g is another density that we choose (and can sample from). We need f to be absolutely continuous with respect to g (the board said “g with respect to f”, but the “i.e.” part is the right condition), i.e. whenever g(y)=0, f(y)=0. Equivalently:
support of f⊆support of g,
where the support of f is the set of values of y s.t. f(y)>0.
Why this is needed: we divide by g(y), and any region where f(y)>0 but g(y)=0 would never be sampled from g, so that part of the integral would be missed. (Strictly, it is enough where h(y)=0.)
Write Ef for an expectation when Y has density f, and Eg when Y has density g. Then
This one is unbiased, Eg[μ^(n)]=μ, just like the crude estimator n1∑i=1nh(Yi) with Yi∼f. The likelihood ratio is a weight that corrects for sampling from the “wrong” density: values that g produces more often than f would (g>f) get weight <1, values that g produces less often get weight >1.
“Y∼f? Wait, but Y is already ∼g?” In the simulation, the Yi’s are always generated from g; nothing changes there. The subscript of E only says which density the integral is taken against: Eg[k(Y)]=∫k(y)g(y)dy and Ef[k(Y)]=∫k(y)f(y)dy, and the Y inside is just a name for the integration variable. The last step does not change the number: it regroups the same integral ∫h2f2/gdy, using f(y) instead of g(y) as the density, so that it can be compared with crude Monte Carlo:
The μ2 terms are the same, so importance sampling wins when f(y)/g(y)<1 mostly where h2(y)f(y) is large: g should generate the “important” values (those that contribute most to the integral) more often than f does. Hence the name.
Choosing g: only the first term depends on g, so we want
gminEf[g(Y)h2(Y)f(Y)].
The best possible choice (for h≥0) is g∗(y)=h(y)f(y)/μ: then h(y)f(y)/g∗(y)=μ for every y and the variance is 0. It cannot be used, because it requires the unknown μ, but it is the guideline: choose g roughly proportional to h⋅f.
In practice, g is chosen from a family and its parameter is optimized. E.g. if f is Exp(λ), take g=Exp(λ′) and choose the rate λ′. (The board called this rate μ; I renamed it to avoid a clash with μ=E[X].)
Ex (worked out for this family): estimate p=P(Y>a) for Y∼Exp(λ), so h(y)=I{y>a} (the indicator I is explained in the next example). For λ′<2λ,
and setting the derivative of its logarithm to 0 gives
λ′∗=λ+a1−λ2+a21≈a1for large a,
i.e. the best g has mean ≈a: it puts the samples around the threshold. With λ=1 and a=20, p=e−20=2.06×10−9. One crude sample has standard deviation p(1−p)≈22,000×p. One importance sample with λ′∗=0.049 has standard deviation 5.2×p.
Ex: X∼N(0,1). Estimate p=P(10<X<11) by simulation. The true value is
p=P(10<X<11)=7.6×10−24(board: ≈10−24, the right order of magnitude).
Monte Carlo simulation: generate X1,…,Xn∼N(0,1). Write the probability as an expectation:
P(10<X<11)=E[I{10<X<11}].
What is I? The indicator function of an event: I{A}=1 if A happens and 0 otherwise. So I{10<X<11} is a Bernoulli r.v.: it equals 1 with probability p and 0 with probability 1−p. Hence E[I]=1⋅p+0⋅(1−p)=p and Var(I)=p(1−p). This turns any probability into an expectation, with h(y)=I{10<y<11}. The estimator
μ~(n)=n1i=1∑nI{10<Xi<11}
is the fraction of the Xi’s that fall in (10,11), and
Var(μ~(n))=np(1−p)≈n10−24.
A 95% CI for μ=p is
[μ~(n)−1.96n10−24,μ~(n)+1.96n10−24].
n=106: half-width =1.9610−24/106=1.96×10−15, about 109 times larger than p.
n=1010: half-width =1.9610−24/1010=1.9610−34=1.96×10−17. This is the 10−17 on the board: the half-width is still about ten million times larger than the true mean.
“Variance is too large compared with the true probability?” Yes, exactly. The variance 10−34 is tiny in absolute terms, but what matters is the error relative to the tiny p:
pstandard deviation of μ~(n)=pp(1−p)/n≈np1.
For the half-width to be even as small as p itself (a 100% error!), we need 1.96/np≤1, i.e. n≥1.962/p≈5×1023 runs. Intuitively: with n=1010 runs, the expected number of Xi’s that land in (10,11) is np≈10−13. In practice no Xi ever lands there, so μ~(n)=0, the sample variance is 0 too, and the computed CI is [0,0]: a meaningless answer. Crude Monte Carlo cannot see an event that it never generates.
Importance sampling. Sample from g=N(10,1) instead, i.e. move the normal density to the interval:
Write ϕ for the N(0,1) density (=f) and ϕ10 for the N(10,1) density (=g); “N(0,1)/N(10,1)” on the board means the ratio ϕ(x)/ϕ10(x) of the two densities. Then
This is the general formula n1(Eg[(weighted observation)2]−μ2), and the square of the weight is (e−10x+50)2=e−20x+100.
I2=I, because 02=0 and 12=1.
The bound: the indicator is nonzero only when 10<X<11, and there −20X+100<−200+100=−100. So I{10<X<11}e−20X+100≤e−100 always, and its expectation is ≤e−100=3.7×10−44≈10−44.
p2≈(10−24)2=10−48 (with the exact p, 5.8×10−47), negligible.
Compare with crude Monte Carlo:
Var(μ~(n))≈n10−24vs.Var(μ^(n))≲n10−44:
the variance is about 1020 times smaller, for the same n. In relative terms, the standard deviation of one sample is now at most 10−44/10−24=100 times p (bound with p≈10−24), instead of 1/p≈1012 times p. E.g. with n=106 the 95% half-width is at most 1.9610−44/106≈2×10−25, a fraction of p, while crude Monte Carlo gave 2×10−15 with the same n.
The bound is conservative. The exact per-sample variance is 6.8×10−46 (computed numerically), i.e. a standard deviation of 3.4×p. E.g. with n=104: 3421 of the Xi’s land in (10,11), μ^=7.44×10−24, half-width 5.0×10−25, so the 95% CI is [6.94,7.95]×10−24, which covers p=7.62×10−24. Over 2000 repetitions, this CI covered p in 94.3% of cases.
Why it works: under g, about 34% of the Xi’s land in (10,11) (P(10<X<11)=Φ(1)−Φ(0)=0.341 for X∼N(10,1)), instead of np≈10−13 expected hits with crude sampling. Each hit is then multiplied by the likelihood ratio e−10x+50, between e−60=8.8×10−27 (at x=11) and e−50=1.9×10−22 (at x=10), which scales the frequent hits back down to the true, tiny probability.
Choice of the shift: among g=N(θ,1), the variance is smallest at θ≈10.05 (3.43×p), so θ=10 is essentially optimal (θ=10.5 gives 3.6×p, θ=11 gives 4.4×p). The reason: f falls so fast that almost all of the probability of (10,11) sits just above 10, i.e. h⋅f is concentrated near 10, and the guideline “g roughly proportional to h⋅f” says to put the samples there.