All problems
Likelihood Ratios
Problem
Return [LR+, LR-] for a test: LR+ = sensitivity / (1 - specificity) and LR- = (1 - sensitivity) / specificity. Return 0.0 for a ratio whose denominator is zero.
Hint
Positive likelihood ratios above 1 increase the post-test odds.
Test cases
case 1
in: [0.9,0.8]
expected: [4.500000000000001,0.12499999999999997]
case 2
in: [1,1]
expected: [0,0]
case 3
in: [0.8,0.9]
expected: [8.000000000000002,0.22222222222222215]
case 4
in: [0.5,0.5]
expected: [1,1]
case 5
in: [0,0]
expected: [0,0]
Starter codePython
def likelihood_ratios(sensitivity, specificity):
# Your code here
pass5 test cases · run your code against them in the editor