Source: https://guthlabs.ai/docs/instruments/sensitivity-specificity-ppv-npv-calculator/implementation/

instrument implementation / implementation-contract

# Sensitivity/Specificity/PPV/NPV Calculator implementation

A source-bound implementation contract for Sensitivity/Specificity/PPV/NPV Calculator; deployment and executable qualification remain separate.

Status: **VERIFIED_CLEAN**Lifecycle: **implementation-contract**

## Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

**Record owner**: Guth Instruments

**Lifecycle**: verified-clean

**Evidence ID**: t5-175

**Effect**: Computation or source lookup only

## Input and validation requirements

The specification permits zero-count tables and ambiguous prevalence input without stating denominator guards or an explicit percent-versus-fraction convention. Zero denominators produce undefined sensitivity, PPV, and LR+, while interpreting prevalence 5 as a fraction produces invalid probabilities above 1.

## Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

## Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

````
{
  "inputs": {
    "TP": 80,
    "FP": 100,
    "FN": 20,
    "TN": 900
  },
  "expected_outputs": {
    "sensitivity": 0.8,
    "specificity": 0.9,
    "PPV": 0.4444444444,
    "NPV": 0.9782608696,
    "LR+": 8,
    "LR-": 0.2222222222,
    "prevalence": 0.0909090909,
    "post_test_probability_positive": 0.4444444444,
    "post_test_probability_negative": 0.9782608696
  },
  "working": "Total=80+100+20+900=1100. Sensitivity=80/(80+20)=80/100=0.80. Specificity=900/(900+100)=900/1000=0.90. PPV=80/(80+100)=80/180=0.4444444444. NPV=900/(900+20)=900/920=0.9782608696. LR+=0.80/(1−0.90)=0.80/0.10=8. LR−=(1−0.80)/0.90=0.20/0.90=0.2222222222. Prevalence=(80+20)/1100=100/1100=0.0909090909. Positive post-test probability=PPV=0.4444444444. Negative post-test probability=NPV=0.9782608696."
}
````

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/sensitivity-specificity-ppv-npv-calculator/>)[02**Mechanism**](<https://guthlabs.ai/docs/instruments/sensitivity-specificity-ppv-npv-calculator/mechanism/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/sensitivity-specificity-ppv-npv-calculator/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`
