Week 06 · Monte Carlo and deadline risk
Estimate a tail probability and separate model uncertainty from simulation error.
← Week 5 · Subject contents · Week 7 →
Estimate a tail probability and separate model uncertainty from simulation error.
Work through the problem
Let two tasks be independent with equally likely durations of 2 and 5 days. A total strictly above 7 days occurs only if both take 5 days, so the exact probability is 1/4. A simulation estimates this probability by the mean of indicator variables for misses.
For N runs the estimated Monte Carlo standard error is √[p̂(1−p̂)/N]. At p̂ = 0.25 and N = 10,000 that is about 0.00433. Shared blockers can correlate task durations and change the underlying probability. More simulation runs reduce numerical uncertainty while leaving that assumption in place.
Run the Python lab
import numpy as np
rng = np.random.default_rng(123)
draw = rng.choice([2,5], size=(10000,2))
p = np.mean(draw.sum(axis=1)>7)
print(f"Independent miss: {p:.3f} ± {1.96*np.sqrt(p*(1-p)/len(draw)):.3f}")
print(f"Same shared delay: {np.mean(2*draw[:,0]>7):.3f}")
assert abs(p-.25) < .02
Output from the lab
Independent miss: 0.248 ± 0.008
Same shared delay: 0.498
Practice
- What is the exact chance of missing if both durations always match?
Check your reasoning
- 0.5. One shared coin makes both durations 5 in half the cases.