monte-carlo-valuation

Monte Carlo valuation: converts point estimates into probability distributions by sampling the most uncertain drivers from normal, log-normal, triangular, uniform, or discrete scenario distributions, rerunning a DCF for each draw, and reporting valuation quantiles, mean, standard deviation, probability the valuation exceeds market price, and the share of draws deemed infeasible by the model. Supports modeling correlations among drivers via shared common factors. Applicable to setting ranges or confidence intervals per-share, assessing under/overvaluation probability, valuing commodity- or cyclical-driven firms, or turning scenario grids into probability-weighted expected values.

Last repository push
GitHub Stars
206
Forks
28
Issues / PRs
3

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "monte-carlo-valuation" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2550436123306c39ac85dd7e8f7b45974a32f2eddd87f190c90ed1ec999fc7f7. Verify the upstream source and version against https://github.com/lyndonkl/claude before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Monte Carlo valuation: converts point estimates into probability distributions by sampling the most uncertain drivers from normal, log-normal, triangular, uniform, or discrete scenario distributions, rerunning a DCF for each draw, and reporting valuation quantiles, mean, standard deviation, probability the valuation exceeds market price, and the share of draws deemed infeasible by the model. Supports modeling correlations among drivers via shared common factors. Applicable to setting ranges or confidence intervals per-share, assessing under/overvaluation probability, valuing commodity- or cyclical-driven firms, or turning scenario grids into probability-weighted expected values.

0 Downloads

Introduction source: third_party · lyndonkl · 0.0.1 Reference

SkillPi interpretation

Tasks
Turns a point-estimate valuation into a distribution — samples the drivers you are least sure about from normal, lognormal, triangular, uniform or discrete-scenario distributions, re-runs the DCF engine on every draw, and reports percentiles, mean, standard deviation, the probability the value exceeds the market price, and the share of draws the engine refused as infeasible. Correlates drivers through a shared common factor. Use when running a Monte Carlo simulation or a probabilistic valuation, putting a range or confidence band around a value per share, asking how likely it is that a stock is under- or overvalued, valuing a commodity or cyclical company where one macro variable such as the oil price dominates, or turning a scenario grid into a probability-weighted expected value.
Inputs and outputs
**Quote the 10th to 90th percentile as the working range.** The minimum and maximum are single draws. They move every run, and they are reported under `extremes` with a note saying so. **The median is the number to lead with, not the base case.** The two differ whenever an input is skewed. Damodaran's Paytm simulation had a median 14% below the base-case DCF, and the divergence was the finding. **`percentile_of_price` is the decision-relevant statistic.** A price at the median means the market sits inside your uncertainty band and you have no edge. A price above the 90th percentile means you have a case worth making. **`probability_value_at_or_below_zero`** is the failure-like tail. Paytm's
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: monte-carlo-valuation
description: Turns a point-estimate valuation into a distribution — samples the drivers you are least sure about from normal, lognormal, triangular, uniform or discrete-scenario distributions, re-runs the DCF engine on every draw, and reports percentiles, mean, standard deviation, the probability the value exceeds the market price, and the share of draws the engine refused as infeasible. Correlates drivers through a shared common factor. Use when running a Monte Carlo simulation or a probabilistic valuation, putting a range or confidence band around a value per share, asking how likely it is that a stock is under- or overvalued, valuing a commodity or cyclical company where one macro variable such as the oil price dominates, or turning a scenario grid into a probability-weighted expected value.

Monte Carlo valuation

A point estimate hides how much you do not know. This skill takes a finished DCF, replaces two or three of its drivers with probability distributions, and runs the same model thousands of times. What comes back is a distribution of value.

That distribution answers questions a single number cannot. How wide is the plausible range? Where does today's price sit inside it? How often does this company end up worth nothing?

The model is not reimplemented here. Every trial calls the engine in dcf-valuation-engine, so the simulation and the base case are the same code with different inputs.

The script

resources/simulate.py — pure standard library, no installation needed. JSON on stdin (or --in FILE), JSON out.

python3 resources/simulate.py simulate --example      # show the input shape
python3 resources/simulate.py simulate --in run.json
python3 resources/simulate.py selftest                # verify the engine
Subcommand Turns this Into this
simulate a base-case DCF payload plus driver distributions the full value distribution, percentiles, price odds, refusal counts
sample one or more distributions on their own the moments and percentiles of the draws, and their realized correlations
scenarios named stories with probabilities value per story and the probability-weighted expected value
percentiles a list of values, or a published percentile table percentiles, moments, and where a price sits inside them

A seed is a required input, not an option. A valuation you cannot re-run to the same number cannot be audited. Record the seed next to the result, and the whole run is reproducible by anyone who has the payload.

When a simulation is the right tool

Simulation answers "how much", not "which story". Match the tool to the doubt:

The doubt The tool
A narrative shift — the same business, better or worse: market size, share, margin simulate with distributions
A narrative break — a binary event ends the story you modelled a probability and a consequence, not a distribution. Use failure in the DCF engine, or scenarios
A narrative expansion — a new market that may not exist yet a real option on top of the DCF. Use option-valuation-toolkit
Genuine doubt about which of a few named stories is true scenarios

A binary risk does not belong in a continuous distribution. Widening a growth rate cannot represent a company that either gets a licence or does not.

The workflow

Simulation progress:
- [ ] 1. Finish the base-case DCF and make it defensible on its own
- [ ] 2. Pick the two to four drivers that both matter and are genuinely uncertain
- [ ] 3. Choose a shape for each, and write down why
- [ ] 4. Set the correlations, getting the signs right
- [ ] 5. Run enough trials, with a recorded seed
- [ ] 6. Read the percentiles, the refusal share and the price position

1. Start from a finished valuation

The simulation varies the inputs of an existing model. It does not replace the model, and it does not rescue one you do not believe. If the base case is wrong about how the business works, every trial is wrong in the same way.

Run the base case through dcf-valuation-engine first and check it with valuation-consistency-checks. The script refuses to simulate a base case the engine itself rejects.

2. Pick the drivers

Two to four. The candidates are almost always revenue growth, the target operating margin, the sales-to-capital ratio, and the cost of capital. For a commodity firm the list starts with the commodity price.

Distributing everything is the standard mistake. It manufactures a wide range that carries no information, because most inputs barely move value. Run a sensitivity grid first (dcf-valuation-engine sensitivity) and distribute only the drivers that show up in it.

The opposite mistake is worse: distributing three minor inputs while holding the real driver fixed. The output then looks precise and is not.

3. Choose a shape

Each driver points at a leaf of the base-case payload with a dotted path, exactly as the sensitivity grid does.

{"name": "target margin", "path": "operating_margin.end",
 "distribution": {"type": "triangular", "min": 0.08, "likeliest": 0.14, "max": 0.20}}
Shape Use it when Parameters
uniform you know the range and have no view inside it min, max
triangular you can state a worst, a likeliest and a best case min, likeliest, max
normal you have a central estimate and a symmetric error around it mean, sd
lognormal the variable cannot go below a floor but can run far above it mean, sd (arithmetic), or median and log_sd; optional shift
discrete the variable takes a few named values outcomes: a list of value and probability

Triangular is the workhorse, because a minimum, a likeliest and a maximum are things an analyst can actually defend. Lognormal is right for growth rates and prices, which have a floor and a long right tail. A normal distribution on a growth rate quietly allows revenue to fall by more than 100%.

Check a shape before you wire it in:

echo '{"seed": 1, "trials": 20000, "distributions": [
  {"name": "growth", "distribution": {"type": "lognormal", "mean": 0.20, "sd": 0.06}}]}' \
  | python3 resources/simulate.py sample

A lognormal given an arithmetic mean of 20% has a median near 19.1%. That gap is the skew, and seeing it here is better than discovering it in the output.

Full parameterization, the quantile formulas and how to calibrate each shape: resources/distributions.md.

4. Set the correlations

Drivers that share a cause have to move together. High revenue growth with a collapsing margin, or falling earnings with an unchanged payout, are combinations that cannot happen. Drawing them independently produces trials that describe no possible company.

Correlation here uses one shared common factor. Give a driver a loading between −1 and 1 on a named factor, and two drivers on the same factor end up correlated at the product of their loadings.

{"name": "revenue growth", "path": "revenue_growth.start",
 "distribution": {"type": "lognormal", "mean": 0.20, "sd": 0.06},
 "factor": "demand", "loading": 0.7}

Two drivers at 0.7 and 0.5 on demand come out correlated at about 0.35. Opposite signs anti-correlate, which is how the payout-against-earnings link in Damodaran's S&P 500 run is expressed. Getting the sign right matters far more than the second decimal of the size.

The output reports the correlation you asked for next to the correlation the draws actually produced, so you can check it landed.

Independent sampling of correlated drivers understates the tails. Both tails, not just the bad one. If growth and margin really move together, the good draws are better and the bad draws are worse than an independent run will ever show, and the middle of the distribution looks tighter than it is. The script's own test suite confirms this: the same two drivers loaded on one factor produce a 5th-to-95th spread more than 10% wider than the independent version.

The one-factor model is a deliberate simplification. What it captures, what it cannot, and when you need more: resources/correlation.md.

5. Run it

python3 resources/simulate.py simulate --in run.json

Ten thousand trials settles the middle of the distribution. The 5th and 95th percentiles need more, because tail error falls only with the square root of the trial count. Damodaran's published Paytm run used 100,000, which takes a few seconds here.

Reading the output

"distribution": {
  "mean": 17.16, "standard_deviation": 4.14, "median": 16.84,
  "percentiles": {"5": 10.89, "10": 11.98, "25": 14.18, "50": 16.84,
                  "75": 19.68, "90": 22.55, "95": 24.35},
  "range_10_to_90": [11.98, 22.55],
  "versus_price": {"current_price": 14.0,
                   "probability_value_exceeds_price": 0.76,
                   "percentile_of_price": 24.0}
}
  • Quote the 10th to 90th percentile as the working range. The minimum and maximum are single draws. They move every run, and they are reported under extremes with a note saying so.
  • The median is the number to lead with, not the base case. The two differ whenever an input is skewed. Damodaran's Paytm simulation had a median 14% below the base-case DCF, and the divergence was the finding.
  • percentile_of_price is the decision-relevant statistic. A price at the median means the market sits inside your uncertainty band and you have no edge. A price above the 90th percentile means you have a case worth making.
  • probability_value_at_or_below_zero is the failure-like tail. Paytm's was about 3%.
  • Check drivers. Each one reports the mean, standard deviation and percentiles of the values actually drawn. If a driver's realized 90th percentile is a number you would not defend in writing, fix the distribution.
  • Read the warnings array. It flags independent sampling, heavy refusals, thin trial counts, and a median far from the base case.

The width of the distribution is a statement about your uncertainty. It is not a forecast of where the price will trade, and it is not a target price band.

Refused trials

Some draws describe companies that cannot exist. Terminal growth above the discount rate is the common one; reinvestment above 100% of income is the other. The DCF engine refuses these rather than returning a number, and the simulation counts the refusals with reasons:

"refused": 162, "refused_share": 0.032,
"refusals": [{"reason": "Terminal cost of capital (0.0800) must exceed terminal growth ...",
              "count": 162, "share": 0.032}]

Refused trials are dropped from the distribution by default. That is not neutral. Refusals cluster in one tail, so dropping them quietly narrows the range on that side. Treat a refusal share above a few percent as a signal to tighten the input distributions, not as noise to read around.

If a refused draw genuinely means the equity is worthless, say so explicitly with "refused_value": 0.0 and the trials enter the distribution at that value.

Commodity and cyclical companies

This is where simulation earns its keep. When one macro variable dominates value, a point estimate blends two opinions — your view on the company and your view on the commodity — and no reader can tell which is doing the work.

The discipline is to value the company at today's commodity price, then state the macro uncertainty separately as a distribution. Damodaran's Shell valuation, March 2016, is the template:

  1. Regress revenues on the commodity price. Shell: revenues = 39,992.77 + 4,039.40 × oil price per barrel, with an R-squared of 96.44% over 1989 to 2015.
  2. Value the firm at the market price of oil, $40, giving $39.31 per share.
  3. Simulate the steady-state oil price and the target margin. Median $36.99, with a 10th to 90th range of $23.90 to $57.49.

The linear_map field does step 1 inside the simulation. It applies intercept + slope × draw before writing the value into the model, so you sample the oil price and the model receives revenue:

{"name": "oil price", "path": "base_revenue",
 "distribution": {"type": "lognormal", "median": 40.0, "log_sd": 0.35},
 "linear_map": {"intercept": 39992.77, "slope": 4039.40}}

Normalize the margin separately. A trough margin is a point in the cycle, not the business, and simulating around it simulates the wrong centre. Use financial-statement-normalization for the long-run margin and return on capital first.

Worked runs for Shell, Amazon, Paytm and the S&P 500: resources/worked-examples.md.

Named scenarios instead of distributions

When the doubt is about which story is true, use discrete scenarios. Each one is a named set of overrides with a probability, and the probabilities have to sum to 1.

python3 resources/simulate.py scenarios --example | python3 resources/simulate.py scenarios

The output gives value per scenario, the probability-weighted expected value, the spread from best to worst, and the cheapest scenario that clears the market price. That last field is the point of the exercise. Some scenario always justifies any price. The question is never whether such a scenario exists, but whether it is probable.

Label each scenario possible, plausible or probable before you weight it. Only probable stories belong in a base case.

What a simulation does not do

  • It does not fix a wrong narrative. If the story about the business is wrong, the simulation gives you a precise distribution of wrong answers. Model risk is not in the output, because the model does not vary across trials.
  • The output is a distribution of your assumptions, not of reality. Someone chose every shape and every parameter. The percentile table inherits all of that judgment and none of the modesty.
  • It is only as good as its input distributions. A triangular distribution with made-up endpoints produces a confident-looking range built on two invented numbers. Calibrate from the driver's own history, industry ranges and peer distributions.
  • It does not add risk. The discount rate already carries risk. Widening the distributions and raising the discount rate for the same uncertainty counts it twice.
  • It does not average away a decision. The range is not the answer. You still have to say which part of it you believe, and why.

Handoffs

You need Where it comes from
The base-case payload dcf-valuation-engine value — the same JSON goes in as base_case
Which drivers to distribute dcf-valuation-engine sensitivity — distribute what moves the answer
The cost of capital and its range cost-of-capital-toolkit wacc, read wacc
Normalized margins and returns for a cyclical financial-statement-normalization normalize-earnings
Employee option value for the bridge option-valuation-toolkit employee-options, read value_of_options
A check on the base case before simulating valuation-consistency-checks --dcf base_case.json

Reference data

resources/data/simulation_cases.json holds four of Damodaran's published simulations — Paytm 2021, Amazon 2018, Shell 2016 and the S&P 500 in November 2020 — with their input distributions, percentile tables and findings, tagged with an as_of date and a refresh note. They are calibration anchors and test vectors, not inputs to a valuation.

Each case is a snapshot of a company at a date. The market prices in particular mean nothing outside that date, so re-read the source before quoting one in live work.

Common failures

Symptom Cause
The range is enormous and says nothing Every input was distributed, including ones that barely move value
The range looks tight for a genuinely uncertain company The real driver was held fixed while minor inputs were distributed
Percentiles move every run Too few trials for the tails, or the seed is being changed between runs
The result cannot be reproduced The seed was not recorded alongside the output
Trials contain impossible combinations Correlated drivers sampled independently; set a loading
A large share of trials refused A distribution reaches past a hard constraint, usually terminal growth above the discount rate
The simulated median differs from the base case Normal with a skewed input; quote the median and say why the two differ
A lognormal produces values far below what was intended mean and sd were read as log-space parameters; they are arithmetic. Use median and log_sd for log space
The market price sits at the median and the result feels useless It is the result. The market is inside your uncertainty band and you have no edge
A binary risk produced a strange bimodal output A narrative break was forced into a continuous distribution; use scenarios or the DCF failure branch
The engine refuses the whole run The base case itself is infeasible; fix it in dcf-valuation-engine first

Version history

  1. 0.1 GitHub ↗
    Original release notes

    ## What's Changed * Improve writer skill navigation and structure by @lyndonkl in https://github.com/lyndonkl/claude/pull/1 * Consolidate stickiness content and reduce revision to 3 passes by @lyndonkl in https://github.com/lyndonkl/claude/pull/2 * Update README.md to reflect current writer skill structure by @lyndonkl in https://github.com/lyndonkl/claude/pull/3 * Add explicit instructions for AI agents to follow resource file workf… by @lyndonkl in https://github.com/lyndonkl/claude/pull/4 * Change analysis files from /tmp/ to project directory by @lyndonkl in https://github.com/lyndonkl/claude/pull/5 * Add five refined skills to production by @lyndonkl in https://github.com/lyndonkl/claude/pull/6 * Add causal-inference-root-cause skill and fix missing methodology files by @lyndonkl in https://github.com/lyndonkl/claude/pull/7 * Add workflow pattern to 6 completed skills by @lyndonkl in https://github.com/lyndonkl/claude/pull/8 * Add chain-estimation and roleplay-debate skills with optimizations by @lyndonkl in https://github.com/lyndonkl/claude/pull/9 * Add 3 new skills and update writer skill workflow pattern by @lyndonkl in https://github.com/lyndonkl/claude/pull/10 * Add skills #12-13: constraint-based-creativity and data-schema-knowle… by @lyndonkl in https://github.com/lyndonkl/claude/pull/11 * Add skills #14-16: decision-matrix, decomposition-reconstruction, deliberation-debate-red-teaming by @lyndonkl in https://github.com/lyndonkl/claude/pull/12 * Add skills #17-19: design-of-experiments, dialectical-mapping-steelmanning, discovery-interviews-surveys by @lyndonkl in https://github.com/lyndonkl/claude/pull/13 * Add chef-assistant skill and update README by @lyndonkl in https://github.com/lyndonkl/claude/pull/14 * Fix README: Remove links to gitignored scratchpad files by @lyndonkl in https://github.com/lyndonkl/claude/pull/15 * Add skills #14-22: 9 new production-ready skills by @lyndonkl in https://github.com/lyndonkl/claude/pull/16 * Add skills #20-24 and workflow pattern updates by @lyndonkl in https://github.com/lyndonkl/claude/pull/17 * Add skill #25: expected-value by @lyndonkl in https://github.com/lyndonkl/claude/pull/18 * Add skills #26-28: facilitation-patterns, financial-unit-economics, focus-timeboxing-8020 by @lyndonkl in https://github.com/lyndonkl/claude/pull/19 * Add skills #29-30: heuristics-and-checklists, hypotheticals-counterfactuals by @lyndonkl in https://github.com/lyndonkl/claude/pull/20 * Add skills #31-33: information-architecture, kill-criteria-exit-ramps, layered-reasoning by @lyndonkl in https://github.com/lyndonkl/claude/pull/21 * Add Claude Code plugin support by @lyndonkl in https://github.com/lyndonkl/claude/pull/22 * Fix plugin marketplace source path by @lyndonkl in https://github.com/lyndonkl/claude/pull/23 * Add skill #34: mapping-visualization-scaffolds by @lyndonkl in https://github.com/lyndonkl/claude/pull/24 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/25 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/26 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/27 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/28 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/29 * Add skill #59: skill-extraction by @lyndonkl in https://github.com/lyndonkl/claude/pull/30 * Add skill-creator: Transform documents into actionable skills by @lyndonkl in https://github.com/lyndonkl/claude/pull/31 * Update skill count from 58 to 61 in README by @lyndonkl in https://github.com/lyndonkl/claude/pull/32 * Skill refinement by @lyndonkl in https://github.com/lyndonkl/claude/pull/33 * Add d3-visualization skill: comprehensive D3.js implementation guide by @lyndonkl in https://github.com/lyndonkl/claude/pull/34 * Add comprehensive Superforecasting Toolkit with 4 skills and orchestr… by @lyndonkl in https://github.com/lyndonkl/claude/pull/35 * Add "Run in Smithery" badge by @gurdasnijor in https://github.com/lyndonkl/claude/pull/36 * Add Scientific Writing Toolkit with 6 skills and orchestrating agent by @lyndonkl in https://github.com/lyndonkl/claude/pull/37 * Improve skill invocation rules and update README by @lyndonkl in https://github.com/lyndonkl/claude/pull/38 * Add Geometric Deep Learning skill suite and orchestrating agent by @lyndonkl in https://github.com/lyndonkl/claude/pull/39 * Decompose writer skill into 4 focused skills + orchestrating agent by @lyndonkl in https://github.com/lyndonkl/claude/pull/40 * Add GraphRAG skill suite with 5 skills + orchestrating agent by @lyndonkl in https://github.com/lyndonkl/claude/pull/41 * Decompose cognitive-design skill into 3 focused skills + orchestrating agent by @lyndonkl in https://github.com/lyndonkl/claude/pull/42 ## New Contributors * @lyndonkl made their first contribution in https://github.com/lyndonkl/claude/pull/1 * @gurdasnijor made their first contribution in https://github.com/lyndonkl/claude/pull/36 **Full Changelog**: https://github.com/lyndonkl/claude/commits/0.1

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 解决金融估值中的核心痛点:将点估计转化为概率分布,提供置信区间和风险评估
  • 适用于高频刚需场景:股票估值、大宗商品公司、周期性企业、情景分析等
  • 显著提升分析师效率,支持可审计、可复现的蒙特卡洛模拟
Trigger Precision95/100

Highlights

  • 触发描述完整且精准,覆盖多种变体(蒙特卡洛模拟、概率估值、周期性公司等)
  • 边界清晰,无与其他 Skill 重叠风险
Structure and Standards90/100

Areas to improve

  • 文档长度 Reported severity: Minor

    SKILL.md 文件约 480 行,内容详尽但较长

    Recommendation: 建议增加目录导航或适当拆分章节以提升可读性

Highlights

  • Phase/步骤清晰,包含完整的工作流程(6 步法)
  • 提供端到端示例和多种分布类型说明
  • frontmatter 完整,结构规范
Execution Reliability90/100

Highlights

  • 工具来源明确(resources/simulate.py),纯标准库实现,无需额外安装
  • 参数定义清晰,支持多种分布类型和相关性建模
  • 覆盖主要异常处理(拒绝试验、种子记录、自测验证)
  • 提供完整的输入输出示例和错误诊断指南
Evidence Verifiability (mean of the first four)93/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.