All problems
Posterior After Positive Test
Problem
With prevalence p, sensitivity se, and specificity sp, the posterior probability of disease given a positive test is se * p / (se * p + (1 - sp)(1 - p)).
Given sensitivity, specificity, and prevalence, return the posterior.
Hint
The denominator is the total probability of a positive test.
Test cases
case 1
in: [0.9,0.9,0.01]
expected: 0.08333333333333336
case 2
in: [0.99,0.95,0.1]
expected: 0.6874999999999998
case 3
in: [1,1,0.5]
expected: 1
Starter codePython
def posterior_after_positive_test(sensitivity, specificity, prevalence):
# Your code here
pass3 test cases · run your code against them in the editor