Premium problem74. Two Positive Tests in a Row

Medium Locked

The same test from before is run twice on one person and comes back positive both times. Assuming the two results are conditionally independent given the person's true status, return the probability they have the disease.

Either apply Bayes twice, feeding the first posterior in as the second prior, or do it in one step with the likelihoods squared. Both give the same number.

Input

prevalence = 0.001
sensitivity = 0.99
specificity = 0.99

Output

0.9074999999999999

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)