Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-347

Sequential Posterior Two Tests

Problem

Two independent positive tests update the prevalence twice: apply the posterior formula once, then use the result as the prior for the second application.

Given the prior prevalence, sensitivity, and specificity, return the posterior after both tests.

Hint

The output of the first update becomes the prior for the second.

Test cases

case 1
in: [0.01,0.9,0.9]
expected: 0.4500000000000001
case 2
in: [0.1,0.99,0.95]
expected: 0.9775583482944344
case 3
in: [0.5,0.8,0.8]
expected: 0.9411764705882353
Starter codePython
def sequential_posterior_two_tests(prior, sensitivity, specificity):
    # Your code here
    pass

3 test cases · run your code against them in the editor