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

Campbell-Hilscher-Szilagyi Distress Probability

Install and import#

bash
npm install fintech-algorithms
ts
import { campbellHilscherSzilagyiDistressProbability } from "fintech-algorithms/credit-risk-and-default/probability-of-default/campbell-hilscher-szilagyi-distress-probability";

Signature#

campbellHilscherSzilagyiDistressProbability(nimtaavg, tlmta, exretavg, sigma, rsize, cashmta, market_to_book, log_price)

Evaluates the published Campbell, Hilscher and Szilagyi twelve-month-lag logit with its eight accounting and market inputs, returning the failure log-odds, the distress probability, and each variable's contribution. The coefficients are fixed inside the function, not supplied by the caller.

Parameters#

NameTypeNotes
nimtaavgnumberGeometrically weighted average net income over market-valued total assets.
tlmtanumberTotal liabilities over market-valued total assets.
min: 0
exretavgnumberGeometrically weighted average excess return over the market index.
sigmanumberAnnualised volatility of daily equity returns over the prior quarter.
min: 0
rsizenumberRelative size, the log of the firm's share of total market capitalisation.
cashmtanumberCash and short-term investments over market-valued total assets.
min: 0
market_to_booknumberThe firm's market-to-book ratio.
log_pricenumberLog of the share price, truncated above in the source study before it reaches this function.

Returns#

{ published_intercept: number; score_contributions: Record<string, number>; failure_log_odds: number; distress_probability: number; state: string; reason: string }

published_intercept is the paper's constant of -9.164 and score_contributions maps each input name to its value times the published coefficient. failure_log_odds is the intercept plus those contributions and distress_probability is the logistic transform of it. state is published-score-replication and reason names the table the coefficients come from.

Errors#

  • When any argument is not a finite number — throws Error
  • When sigma, tlmta, or cashmta is negative — throws Error

Complexity: time O(1), space O(1).

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#

nimtaavg
-0.015
tlmta
0.62
exretavg
-0.04
sigma
0.48
rsize
-8.5
cashmta
0.08
market_to_book
1.8
log_price
2.3

Call#

campbellHilscherSzilagyiDistressProbability(nimtaavg, tlmta, exretavg, sigma, rsize, cashmta, market_to_book, log_price)

Returns#

object with 6 fields: published_intercept, score_contributions, failure_log_odds, distress_probability, state, reason

{
  "published_intercept": -9.164,
  "score_contributions": {
    "nimtaavg": 0.30396,
    "tlmta": 0.87792,
    "exretavg": 0.28516,
    "sigma": 0.67728,
    "rsize": 0.3825,
    "cashmta": -0.17056,
    "market_to_book": 0.135,
    "log_price": -0.1334
  },
  "failure_log_odds": -6.80614,
  "distress_probability": 0.00110573352,
  "state": "published-score-replication",
  "reason": "chs-table-4-twelve-month-lag-coefficients"
}

Other exports#

This module also exports logisticPdModel, probitPdModel, throughTheCyclePd, pointInTimePd, mertonDistanceToDefault, 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#

Campbell-Hilscher-Szilagyi Distress Probability — article hero
Campbell-Hilscher-Szilagyi Distress Probability — evidence clock
Campbell-Hilscher-Szilagyi Distress Probability — formula anatomy
Campbell-Hilscher-Szilagyi Distress Probability — method comparison
Campbell-Hilscher-Szilagyi Distress Probability — system map
Campbell-Hilscher-Szilagyi Distress Probability — validation layers

Calculation flow#

Campbell-Hilscher-Szilagyi Distress Probability calculation flow
flowchart LR
    S1["Verify the paper version failure label coefficient row"]
    S2["Validate all eight inputs and their scoretime availabi"]
    S3["Multiply each variable by its published coefficient"]
    S4["Add the 9164 intercept and apply the logistic transfor"]
    S5["Return contributions score probability and an explicit"]
    S1 --> S2
    S2 --> S3
    S3 --> S4
    S4 --> S5
    S5 --> D{"any lag feature winsorization or coefficient mismatch inva"}
    D --> O["distress_probability + diagnostics"]
    O --> A["Audit: failurelogodds equals 9164 plus every reported contributio"]

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#