Run a Monte Carlo simulation on a forecast or decision: turn single point estimates into honest input ranges, pick a distribution per input with a stated reason, model correlated inputs with a Gaussian copula instead of assuming independence, run enough trials with a convergence check, and read percentiles, downside probability, and a Spearman sensitivity ranking a decision can rest on. Use when someone wants a forecast with uncertainty, a probability of hitting or missing a target, a risk range for a budget, schedule, cash flow, or NPV, or asks how many trials a simulation needs.
./install.sh monte-carlo-simulationname: "monte_carlo_simulation" description: "Run a Monte Carlo simulation on a forecast or decision: turn single point estimates into honest input ranges, pick a distribution per input with a stated reason, model correlated inputs with a Gaussian copula instead of assuming independence, run enough trials with a convergence check, and read percentiles, downside probability, and a Spearman sensitivity ranking a decision can rest on. Use when someone wants a forecast with uncertainty, a probability of hitting or missing a target, a risk range for a budget, schedule, cash flow, or NPV, or asks how many trials a simulation needs."
A single point forecast hides the only thing a decision needs: how wrong it could be, and in which direction. This skill turns a deterministic model into a distribution of outcomes. Each uncertain input gets a range and a distribution chosen for a stated reason, inputs that move together are sampled together, and the output is read as percentiles, a downside probability, and a ranked list of which inputs drive the result.
The bundled runner (bin/monte_carlo.py, needs numpy and scipy) does the sampling, the correlation, the convergence check, and the sensitivity ranking. A worked cash forecast spec ships in references/cash-forecast-example.json. The distribution selection guide is in references/distribution-guide.md.
units * (price - var_cost) - fixed_cost). If the model only exists as a spreadsheet tangle or a paragraph, pin it down before simulating. A simulation of a vague model produces precise looking noise.fixed input or a constant in the formula. Simulating a known value adds fake spread.references/distribution-guide.md. Never put a normal on a quantity that cannot go negative if its spread would draw negative values in a visible share of trials.[["units", "price", -0.35]] with the reason. The runner applies a Gaussian copula: it draws correlated standard normals through a Cholesky factor of the correlation matrix, maps them to correlated uniforms with the normal CDF, then through each input's own inverse CDF. Independence is the default only when no shared driver exists, and that is a claim to state, not a default to slide past.python3 bin/monte_carlo.py spec.json prints percentiles p5 to p95, the mean, the standard error of the mean, the sensitivity ranking, and a convergence check. Add --threshold X to get the probability the output lands below X (a loss line, a deadline expressed as a budget cap, a covenant floor).Monthly cash flow for a small product business. Point forecast from most likely values: 1,000 units at a price of 49, variable cost 22, fixed cost 18,000, giving 9,000 for the month.
The spec (references/cash-forecast-example.json) replaces the points with ranges: units triangular 800 / 1,000 / 1,300, price normal mean 49 sd 3, variable cost lognormal with median 22 (mu 3.091, sigma 0.12, positive only with a right tail), fixed cost triangular 16,500 / 18,000 / 20,500. Units and price are correlated at -0.35 because high volume months are discount months.
At 20,000 trials, seed 42, the runner reports: mean 9,272, sd 4,450, p10 3,666, p50 9,181, p90 15,019, and a 1.6 percent chance the month loses money. Sensitivity ranking: variable cost -0.60, price +0.47, units +0.36, fixed cost -0.18. The decision grade reading: the month is very likely cash positive, a bad month still clears about 3,700 at p10, and variable cost is the input worth nailing down first because it drives more of the spread than volume does. None of that is visible in the 9,000 point forecast.
A simulation report must contain: the model formula, every input with its distribution, its parameters, and the reason that distribution was chosen, every correlation with its reason (or an explicit statement that inputs were treated as independent and why), the trial count and seed, the percentile band (at least p10, p50, p90), the mean with its standard error, the downside probability against a named threshold when the decision has one, the convergence result, the sensitivity ranking, and the decision the numbers support with the assumption that would flip it.
Round percentiles in the report. A p90 of 15,019 from guessed ranges is reported as about 15,000.
--lhs, no correlations) stratifies each input's range so every slice gets sampled, and its variance on a given trial count is lower than plain random sampling. Use it for expensive models where trials are scarce. It does not combine with the copula path in this runner, so correlated models use plain sampling with more trials.publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.