Test specificity is the conditional probability that a medical test is negative when the tested condition is absent. Alongside sensitivity, it describes test accuracy without determining how likely a positive result is to be correct. section 13.4
A highly specific test can still produce mostly false positives
Suppose Frob Syndrome affects 1 person in 30,000. A cheap test has 99.5% sensitivity and 99.5% specificity. Among roughly 6 million people, about 199 sick people test positive, but about 29,999 healthy people also test positive. Thus, after a positive result, the posterior chance of having the syndrome is only 0.7%. section 13.4
static IDiscreteDistribution<CheapTest> TestResultGivenFrob(Frob f)
{
List<CheapTest> cheap = [CheapTest.Negative, CheapTest.Positive];
return f == Frob.No ?
cheap.ToCategorical(995, 5) :
cheap.ToCategorical(5, 995);
}
Represent the test-result likelihood with separate negative and positive probabilities for people with and without the condition. section 13.4





