Calculation catalog › Monte Carlo
Monte carlo median first depletion year
Among the simulated paths that run out of money, the calendar year by which half of them have first depleted, printed in the Monte Carlo page's "Why this number?" panel.
Field: Median first-depletion year Unit: calendar year Basis: no dollar basis Computed by: UI-native Status: Complete chain
Appears in: monte-carlo-page (WhySuccessPanel "Which years drive it": "(median YEAR)")
Calculation records
-
Median first-depletion year Formula record, justified by derivation
Purpose: The year by which half of the simulated markets that run out of money have run out, printed in the Monte Carlo page's explanation of its success rate.
Statement: montecarlo/run.ts#aggregateMonteCarlo publishes MonteCarloSummary.medianFirstDepletionYear: walking depletionYearCounts in year order and adding each year's count, the first year whose running count reaches half of downsideRisk.failingPathCount, so the lower of the two middle years when the failing count is even, and null when no path runs out. Paths that last are not counted. Failing years 2040, 2041, 2042, 2043 and 2060 among ten paths give 2042, whatever the other five do; four paths failing in 2035, 2040, 2045 and 2050 give 2040; 40, 60 and 50 paths failing in 2047, 2050 and 2053 give 2050. Units: a calendar year. Rounding: none; the year is always one a path failed in.
Formula:
median = the first year y, in year order, with Σ count(year ≤ y) ≥ F / 2; null when F = 0-
count(year): Number of simulated paths that first run out of investable assets in that calendar year (depletionYearCounts) (unit: count) (domain: integer, at least 1 for every listed year) -
F: Number of paths that run out at all (downsideRisk.failingPathCount), the sum of the counts (unit: count) (domain: integer, at least 0)
Timing: once per aggregation
Rounding: none
Limits:
- A median of the failing paths only: it says when the typical failure happens, not how likely failure is, which the success rate says.
- With an even number of failing paths it is the lower middle year, never an average of two years, so it is always a year some path failed in.
Provenance: derived by
claude, implemented byclaude.Independent review:
codexGates (6 of 6 pass): fixture registers a test: pass; pins resolve: pass; families exist: pass; worksheet exists: pass; mutation receipt exists: pass; provenance independent: pass
Worksheet: monte-carlo-median-first-depletion-year.md Mutation receipt: monte-carlo-median-first-depletion-year.mutation.md
Evidence tests: run.depletionMedian.evidence.test.ts
Implemented in: run.ts
Is the number of: monte-carlo-median-first-depletion-year
-
Transformations
- montecarlo/run.ts#aggregateMonteCarlo publishes MonteCarloSummary.medianFirstDepletionYear: walking depletionYearCounts in year order, the first year whose running count reaches half of downsideRisk.failingPathCount (the lower middle year when that count is even); null when no path fails. explainPanels.tsx#WhySuccessPanel prints it.
The evidence links on this page (each record's worksheet, mutation receipt, evidence tests
and implementation, and the source links) are pinned to engine commit
2624dbdba9fd, committed 2026-10-11.
The live calculation index and
output-family census links point at the repository's main
branch, so you can check this snapshot against them.