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

Probit PD Model

Install and import#

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

Signature#

probitPdModel(intercept, coefficients, features, alert_threshold)

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.

Parameters#

NameTypeNotes
interceptnumberThe constant term of the already-fitted latent score. Nothing is estimated here; the coefficients arrive from the caller.
coefficientsnumber[]The fitted coefficient for each feature, in the same order as features. Must hold at least one finite number.
min_length: 1 · same_length_as: features
featuresnumber[]The borrower's feature values, aligned position by position with coefficients.
min_length: 1
alert_thresholdnumberThe probability at or above which the borrower is flagged, compared with the computed probability using a greater-than-or-equal test.
exclusive_min: 0 · exclusive_max: 1

Returns#

{ latent_score: number; feature_contributions: number[]; probability_of_default: number; survival_probability: number; alert_threshold: number; state: string; reason: string }

latent_score is the intercept plus the summed contributions and feature_contributions holds each coefficient times its feature. probability_of_default is the normal cumulative distribution evaluated at that score, with survival_probability as its complement. state is at-or-above-alert or below-alert, and reason records that the score was supplied rather than fitted here. No odds key is emitted.

Errors#

  • When any argument is not a finite number — throws Error
  • When coefficients or features is not an array of at least one finite number — throws Error
  • When coefficients and features have different lengths — throws Error
  • When alert_threshold is not strictly between zero and one — throws Error

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

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
-1.5
coefficients
[0.7, -0.5, 0.9]
features
[0.6, -0.2, 0.3]
alert_threshold
0.25

Call#

probitPdModel(intercept, coefficients, features, alert_threshold)

Returns#

object with 7 fields: latent_score, feature_contributions, probability_of_default, survival_probability, alert_threshold, state, reason

{
  "latent_score": -0.71,
  "feature_contributions": [0.42, 0.1, 0.27],
  "probability_of_default": 0.23885206809,
  "survival_probability": 0.76114793191,
  "alert_threshold": 0.25,
  "state": "below-alert",
  "reason": "supplied-probit-score-transformed"
}

Other exports#

This module also exports logisticPdModel, 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#

Probit PD Model — article hero
Probit PD Model — evidence clock
Probit PD Model — formula anatomy
Probit PD Model — method comparison
Probit PD Model — system map
Probit PD Model — validation layers

Calculation flow#

Probit PD Model calculation flow
flowchart LR
    S1["Validate ordered features coefficients units and knowl"]
    S2["Calculate contribution terms and latent score"]
    S3["Evaluate the standardnormal CDF"]
    S4["Compare with the declared threshold using inclusive eq"]
    S5["Return score contributions probability survival state "]
    S1 --> S2
    S2 --> S3
    S3 --> S4
    S4 --> S5
    S5 --> D{"z  0 maps to PD  05 alert equality is inclusive"}
    D --> O["probability_of_default + diagnostics"]
    O --> A["Audit: probabilityofdefault  survivalprobability  1 within tolera"]

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#