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

Probability of Default

7 algorithms in Credit Risk and Default · 7 with asserted arithmetic.

In this family#

  1. Logistic PD Model verified

    Applies a logistic link to a supplied linear credit score and reports the resulting default probability alongside the per-feature contributions that produced it and its position relative to an alert threshold.

    logisticPdModel(intercept, coefficients, features, alert_threshold)
  2. Probit PD Model verified

    Applies the standard normal cumulative distribution to a supplied linear latent score and reports the resulting default probability, the per-feature contributions behind it, and its position relative to an alert threshold.

    probitPdModel(intercept, coefficients, features, alert_threshold)
  3. Through-the-Cycle PD verified

    Turns a multi-year history of obligor counts and default counts into annual default rates, averages them into a through-the-cycle rate, and compares one selected year against that long-run level.

    throughTheCyclePd(annual_obligors, annual_defaults, current_year_index, minimum_years)
  4. Point-in-Time PD verified

    Overlays a borrower-specific shift and a macro shift on the log-odds of a through-the-cycle default probability, returning the resulting point-in-time probability and the size of each shift.

    pointInTimePd(through_the_cycle_pd_value, borrower_log_odds_shift, macro_factor_z, macro_sensitivity, alert_threshold)
  5. Merton Distance-to-Default verified

    Solves the two-equation Merton system iteratively for the unobserved asset value and asset volatility implied by observed equity, then reports the distance to default and the default probabilities that follow from it.

    mertonDistanceToDefault(equity_value, equity_volatility, debt_face_value, risk_free_rate, asset_drift, horizon_years, tolerance, max_iterations)
  6. Campbell-Hilscher-Szilagyi Distress Probability verified

    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.

    campbellHilscherSzilagyiDistressProbability(nimtaavg, tlmta, exretavg, sigma, rsize, cashmta, market_to_book, log_price)
  7. Bharath-Shumway Naive Distance-to-Default verified

    Computes the Bharath and Shumway naive distance to default, which approximates the Merton solve with closed-form substitutes for firm value and asset volatility instead of iterating.

    bharathShumwayNaiveDistanceToDefault(equity_value, debt_face_value, equity_volatility, prior_year_equity_return, horizon_years)

What they share#

Every topic here is a record-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { logisticPdModel } from "fintech-algorithms/credit-risk-and-default/probability-of-default/logistic-pd-model";
import { probitPdModel } from "fintech-algorithms/credit-risk-and-default/probability-of-default/probit-pd-model";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Credit Risk and Default collects 7 algorithms across 1 family. For the concept behind this family rather than the call signatures, see the concept guides.