A simulation must preserve relationships among inputs when the same real-world event changes demand and available capacity together.
Joint inputs and correlated operational shocks
Define the shared driver
On a disruption day, the warehouse receives 63 orders and only six staff are available. Otherwise it receives 41 orders and has nine staff. Each worker can complete seven orders. In this deliberately discrete teaching model, a disruption occurs with probability 0.23. When it occurs, demand 63 exceeds capacity 42; otherwise demand 41 fits within capacity 63. The modeled overflow probability is therefore 0.23. The driver creates both high load and low staffing.
See the independence mistake
If demand and staffing are drawn independently with the same separate marginal probabilities, overflow occurs only when high demand and low staffing happen together. That probability is 0.23 times 0.23, or 0.0529. Both simulators can display the correct demand marginal and correct staffing marginal while disagreeing sharply on the decision event. Matching univariate histograms is not enough. Correlation and derived metrics explain why the joint process matters.
Model a mechanism, not just a coefficient
The shared disruption state is a plausible causal driver of both arrival volume and absences. A single measured correlation coefficient would not explain which combinations of extremes are possible or when the relationship changes. In production, estimate disruption frequency and conditional arrival and staffing distributions from versioned periods; compare joint cells across seasons. If observations are sparse, use a small set of explicit scenarios and show sensitivity rather than manufacture precision.
Keep scenario timing coherent
Draw the disruption state once per shift, then draw that shift’s demand and staffing conditional on the state. Drawing a new shock for every case would imply that one shift simultaneously had many unrelated weather states. Treat a shift as the replication unit and preserve any within-shift dependence. If a customer or site spans multiple shifts, temporal persistence may need a higher-level model. The denominator for a shift-level breach is shifts, not orders.
Validate the joint output
Check simulated disruption share, demand-staffing combinations, overflow frequency and source data coverage. A policy may appear safe under the independent model because the tail combination is artificially rare. Keep the independent version as a stress-test contrast, not the default if the shared mechanism is supported. Paired policy evaluation must reuse the same sampled joint shift for both policies.
Implementation
from random import Random
def overflow_rate(replications, seed, shared_disruption):
if replications <= 0:
raise ValueError("replications must be positive")
draw_stream = Random(seed)
overflows = 0
for _ in range(replications):
demand_disruption = draw_stream.random() < 0.23
staffing_disruption = (demand_disruption if shared_disruption
else draw_stream.random() < 0.23)
orders = 63 if demand_disruption else 41
staff = 6 if staffing_disruption else 9
overflows += orders > staff * 7
return overflows / replications
coupled_risk = overflow_rate(30000, 73, True)
independent_risk = overflow_rate(30000, 73, False)
assert abs(coupled_risk - 0.23) < 0.02
assert abs(independent_risk - 0.0529) < 0.02
assert coupled_risk > independent_riskPerformance and operating cost
Generating R shifts costs O(R) time and O(1) additional space. More realistic conditional distributions add sampling work but usually less cost than the decision error caused by breaking dependence. Marginal validation alone cannot detect a wrong joint tail.
Common Mistakes
- Do not draw one disruption state for demand and an unrelated state for staffing when one event affects both.
- Do not validate only the separate input marginals.
- Do not treat the teaching probability as a measured disruption rate.
