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

Logistic PD Model

Install and import#

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

Signature#

logisticPdModel(intercept, coefficients, features, alert_threshold)

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#

intercept
-2.4
coefficients
[0.8, -0.6, 1.1]
features
[0.5, -0.4, 0.2]
alert_threshold
0.2

Call#

logisticPdModel(intercept, coefficients, features, alert_threshold)

Returns#

object with 8 fields: linear_score, feature_contributions, probability_of_default, survival_probability, odds_of_default, alert_threshold, state, reason

{
  "linear_score": -1.54,
  "feature_contributions": [0.4, 0.24, 0.22],
  "probability_of_default": 0.176535274779,
  "survival_probability": 0.823464725221,
  "odds_of_default": 0.214381101427,
  "alert_threshold": 0.2,
  "state": "below-alert",
  "reason": "supplied-logit-score-transformed"
}

Other exports#

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

Logistic PD Model — article hero
Logistic PD Model — evidence clock
Logistic PD Model — formula anatomy
Logistic PD Model — method comparison
Logistic PD Model — system map
Logistic PD Model — 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#