Skip to content

v0.4: Stochastic Foundation#3

Merged
fall-development-rob merged 1 commit into
mainfrom
feat/v0.4-stochastic-foundation
Apr 17, 2026
Merged

v0.4: Stochastic Foundation#3
fall-development-rob merged 1 commit into
mainfrom
feat/v0.4-stochastic-foundation

Conversation

@fall-development-rob
Copy link
Copy Markdown
Contributor

Summary

  • Integrates multi-asset correlated return samplers (LogNormal, Student-T copula, Bootstrap), AR(1) inflation, and Gompertz/cohort longevity models into the Monte Carlo loop
  • Attaches institutional risk metrics (VaR/CVaR/Sortino/drawdown/P10-P50-P90 trajectories) to MCResult when runs >= 200 and horizon >= 10 years
  • Forces stochastic features off in sensitivity and backtest modules per ADR-027/031 to prevent double-counting
  • Preserves byte-identical MC output for v0.3-shape scenarios (no multi-asset, Flat inflation, Fixed longevity)

Changes

  • src/monte-carlo.ts: Integrated stochastic samplers; conditional trial-seed derivation to preserve legacy RNG sequence; added risk_metrics, inflation_fan_chart, lifespan_distribution to MCResult
  • src/sensitivity.ts: Force-disables stochastic features on the base scenario before running the tornado sweep
  • src/backtest.ts: Force-disables stochastic features for historical windows
  • src/index.ts: Barrel exports for all v0.4 sampler builders, defaults, and types
  • package.json: Version 0.3.0 -> 0.4.0; added "type": "module" and test script
  • tsconfig.json: Added rewriteRelativeImportExtensions for proper ESM output
  • scripts/fix-esm-extensions.mjs: Post-build script adding .js extensions to dist imports
  • src/tests/smoke.test.mjs: 46 new assertions (68 total) covering sampler determinism, Cholesky, AR(1) mean-reversion, Gompertz median, CVaR invariants, and v0.3 backwards compat

Test plan

  • All 68 smoke tests pass (22 existing + 46 new)
  • npm run build succeeds
  • npm run lint succeeds
  • v0.3-shape MC produces byte-identical terminal values (fixture-locked)
  • Integration test with app layer consuming new MCResult fields

🤖 Generated with claude-flow

…tion, Gompertz longevity, risk metrics)

Integrates stochastic samplers into the MC loop while preserving byte-identical
output for v0.3-shape scenarios. Adds multi-asset correlated returns (LogNormal,
Student-T copula, Bootstrap), AR(1) inflation with calibration presets, Gompertz
and cohort longevity models, and institutional risk metrics (VaR/CVaR/Sortino/
drawdown). Sensitivity and backtest modules force-disable stochastic features
per ADR-027/031. Version bumped to 0.4.0. 68 smoke tests pass (46 new).

Co-Authored-By: claude-flow <ruv@ruv.net>
@fall-development-rob fall-development-rob merged commit c5e5df8 into main Apr 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant