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

Score Confidence, Missing-Data Penalty, and Abstention

Install and import#

bash
npm install fintech-algorithms
ts
import { scoreConfidenceMissingDataPenaltyAndAbstention } from "fintech-algorithms/fundamental-analysis-and-valuation/integrated-equity-scoring/score-confidence-missing-data-penalty-and-abstention";

Signature#

scoreConfidenceMissingDataPenaltyAndAbstention(data)

Turns component coverage, data staleness and conflict count into a confidence figure, penalises the base score for what is missing or contested, and decides whether the score should be withheld.

Parameters#

NameTypeNotes
data{ base_score: number; required_components: number; available_components: number; stale_days: number; conflict_count: number; max_conflicts: number; minimum_components: number }base_score is the score to adjust and must be between 0 and 100. available_components over required_components gives coverage and may not exceed it; conflict_count is measured against max_conflicts and may not exceed it; minimum_components is the abstention floor applied to available_components; stale_days ages the inputs. All counts are truncated to integers.

Returns#

{ state: string; method: string; base_score: number; coverage: number; missing_penalty: number; staleness_penalty: number; conflict_penalty: number; confidence: number; adjusted_score: number; abstain: boolean; reason: string }

coverage is available over required and missing_penalty one minus it. staleness_penalty is stale days over 365 capped at one and scaled by 0.2, and conflict_penalty is conflicts over the maximum capped at one and scaled by 0.2. confidence multiplies coverage by one minus each penalty; adjusted_score is the base score less 15 times the missing penalty and 10 times the conflict penalty, clamped to 0 to 100. abstain is true when available components fall below minimum_components or confidence falls below 0.6, which also sets state to abstain rather than usable-with-confidence.

Errors#

  • When any of the seven inputs is not a finite number — throws TypeError
  • When base_score is below 0 or above 100 — throws RangeError
  • When required_components, max_conflicts or minimum_components is not positive — throws RangeError
  • When available_components, conflict_count or stale_days is negative — throws RangeError
  • When available_components exceeds required_components, or conflict_count exceeds max_conflicts — throws RangeError

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

Worked example#

executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

Input#

data
{
  "base_score": 76.26,
  "required_components": 6,
  "available_components": 6,
  "stale_days": 20,
  "conflict_count": 1,
  "max_conflicts": 4,
  "minimum_components": 4
}

Call#

scoreConfidenceMissingDataPenaltyAndAbstention(data)

Returns#

object with 11 fields: state, method, base_score, coverage, missing_penalty, staleness_penalty, conflict_penalty, confidence, …

{
  "state": "usable-with-confidence",
  "method": "coverage-staleness-conflict-confidence-gate",
  "base_score": 76.26,
  "coverage": 1,
  "missing_penalty": 0,
  "staleness_penalty": 0.010958904109589041,
  "conflict_penalty": 0.05,
  "confidence": 0.9395890410958904,
  "adjusted_score": 75.76,
  "abstain": false,
  "reason": "coverage and confidence gates passed"
}

Other exports#

This module also exports calculate, pointInTimeStockScoringInputAssembly, stockScoringPeerCohortResolver, fundamentalMetricDirectionAndPeerNormalization, modelApplicabilityAndVariantRouter, accountingFinancialHealthComposite, earningsQualityComposite, dividendSafetyScore, balanceSheetResilienceScore, distressModelEnsemble, crossModelConflictAndDoubleCountingResolver, overallExplainableStockScore, marketWideStockScreeningAndRanking, stockScoreHistoryMigrationAndChangeAttribution. 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#

Score Confidence, Missing-Data Penalty, and Abstention — evidence clock
Score Confidence, Missing-Data Penalty, and Abstention — model anatomy
Score Confidence, Missing-Data Penalty, and Abstention — system map
Score Confidence, Missing-Data Penalty, and Abstention — threshold and interpretation
Score Confidence, Missing-Data Penalty, and Abstention — variant boundaries

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 Integrated Equity Scoring family#