fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Merton Distance-to-Default

Install and import#

bash
npm install fintech-algorithms
ts
import { mertonDistanceToDefault } from "fintech-algorithms/credit-risk-and-default/probability-of-default/merton-distance-to-default";

Signature#

mertonDistanceToDefault(equity_value, equity_volatility, debt_face_value, risk_free_rate, asset_drift, horizon_years, tolerance, max_iterations)

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

equity_value
120
equity_volatility
0.35
debt_face_value
80
risk_free_rate
0.03
asset_drift
0.06
horizon_years
1
tolerance
1e-10
max_iterations
200

Call#

mertonDistanceToDefault(equity_value, equity_volatility, debt_face_value, risk_free_rate, asset_drift, horizon_years, tolerance, max_iterations)

Returns#

object with 9 fields: asset_value, asset_volatility, distance_to_default, physical_default_probability, risk_neutral_default_probability, iterations, residual, state, …

{
  "asset_value": 197.635612721046,
  "asset_volatility": 0.212513018382,
  "distance_to_default": 4.431810702245,
  "physical_default_probability": 0.000004672252,
  "risk_neutral_default_probability": 0.000008907831,
  "iterations": 2,
  "residual": 5.5e-11,
  "state": "converged",
  "reason": "merton-equity-system-solved"
}

Other exports#

This module also exports logisticPdModel, probitPdModel, throughTheCyclePd, pointInTimePd, campbellHilscherSzilagyiDistressProbability, bharathShumwayNaiveDistanceToDefault, calculate. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Merton Distance-to-Default — article hero
Merton Distance-to-Default — evidence clock
Merton Distance-to-Default — formula anatomy
Merton Distance-to-Default — method comparison
Merton Distance-to-Default — system map
Merton Distance-to-Default — validation layers

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Probability of Default family#