Quantitative valuation

From JoelLewis/finance_skills · View interactive version

Quantitative valuation is an AI agent skill from the GitHub repository JoelLewis/finance_skills. Estimate intrinsic value of stocks and companies using DCF, dividend discount models, comparable multiples, and residual income. Use when the user asks about discounted cash flow, DCF models, WACC, terminal value, dividend discount models, comparable multiples, or sum-of-the-parts valuation. Also tr

How to use this skill

Skill file

Quantitative Valuation

Core Concepts

Discounted Cash Flow (DCF)

The DCF model values a company as the present value of its future free cash flows plus a terminal value:

V = Σ FCF_t / (1 + WACC)^t + TV / (1 + WACC)^n

where FCF_t is the free cash flow in year t, WACC is the weighted average cost of capital, and TV is the terminal value at the end of the explicit forecast period.

Terminal Value — Gordon Growth Model

Estimates the value of all cash flows beyond the explicit forecast period assuming perpetual growth:

TV = FCF_n × (1 + g) / (WACC - g)

where g is the long-term sustainable growth rate (typically near nominal GDP growth, 2-4%).

Terminal Value — Exit Multiple Method

Estimates terminal value by applying a market multiple to the final-year financial metric:

TV = EBITDA_n × EV/EBITDA multiple

The exit multiple is typically based on current peer trading multiples or long-run sector averages.

Weighted Average Cost of Capital (WACC)

Blends the cost of equity and after-tax cost of debt weighted by their market-value proportions:

WACC = w_e × r_e + w_d × r_d × (1 - τ)

where w_e and w_d are equity and debt weights, r_e and r_d are their respective costs, and τ is the marginal tax rate.

Cost of Equity — CAPM

The Capital Asset Pricing Model estimates the required return on equity:

r_e = R_f + β × (R_m - R_f)

where R_f is the risk-free rate, β is the stock's sensitivity to market returns, and (R_m - R_f) is the equity risk premium.

Dividend Discount Model (DDM)

Values a stock as the present value of its future dividends. The Gordon Growth (single-stage) form:

P = D_1 / (r - g)

where D_1 is the next-period dividend, r is the required return, and g is the constant dividend growth rate.

Multi-Stage DDM

Accommodates companies transitioning through growth phases:

Residual Income Model

Values a company as its book value plus the present value of economic profits:

V = BV_0 + Σ (ROE - r) × BV_{t-1} / (1 + r)^t

This model is useful when free cash flows are negative but the company earns above its cost of equity.

Comparable Multiples

Relative valuation uses pricing ratios from a peer group to infer value:

Use the median of the peer group to reduce outlier effects. Adjust for differences in growth, margins, and risk.

Relative Valuation

Compare a stock's current multiple to:

A stock trading at a discount to both may be undervalued, or there may be fundamental deterioration.

Sum-of-the-Parts (SOTP)

Value each business segment separately using the most appropriate method (DCF, multiples, or asset-based), then sum. Subtract net debt and add non-operating assets to arrive at equity value.

Sensitivity Analysis

Vary key assumptions (WACC and terminal growth rate are the most impactful) in a two-way data table to understand the range of possible valuations. This exposes which assumptions drive the result.

Key Formulas

| Formula | Expression | Use Case |

|---------|-----------|----------|

| DCF Value | V = Σ FCF_t/(1+WACC)^t + TV/(1+WACC)^n | Enterprise valuation from cash flows |

| Gordon Growth TV | TV = FCF_n×(1+g)/(WACC-g) | Terminal value assuming perpetual growth |

| Exit Multiple TV | TV = EBITDA_n × multiple | Terminal value using market multiples |

| WACC | WACC = w_e×r_e + w_d×r_d×(1-τ) | Blended discount rate |

| CAPM | r_e = R_f + β×(R_m - R_f) | Cost of equity estimation |

| Gordon Growth DDM | P = D_1/(r-g) | Stock value from dividends |

| Residual Income | V = BV_0 + Σ (ROE-r)×BV_{t-1}/(1+r)^t | Value from economic profit |

| Implied Value (Comps) | V = Metric × Peer Median Multiple | Relative valuation |

Worked Examples

Example 1: Two-Stage DCF

Given:

Calculate: Enterprise value

Solution:

Projected free cash flows:

PV of Stage 1 cash flows:

Terminal value (Gordon Growth):

Enterprise Value = $572.5M + $1,837.7M = $2,410.1M

Note: Terminal value represents 76% of total value, which is typical but underscores the importance of terminal assumptions.

Example 2: Comparable P/E Analysis

Given:

Calculate: Implied share price using peer median

Solution:

Peer median P/E = 18x (middle value of the sorted set)

Implied share price = EPS × Peer Median P/E = $5.00 × 18 = $90.00

If the stock trades at $75, it appears undervalued relative to peers (16.7% discount). Before concluding, check whether lower growth, margins, or higher risk justify the discount.

Common Pitfalls

Cross-References

Running the script

uv run scripts/quantitative_valuation.py

The PEP 723 header resolves the numpy dependency automatically. Alternatively run python3 scripts/quantitative_valuation.py after pip install numpy.

The file is primarily meant to be imported as a module, e.g. from quantitative_valuation import DCF, WACC, DividendDiscount, ComparableMultiples.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.