All problems
SIR CI
Problem
Return the log-based confidence interval for a standardized incidence ratio: SIR * exp(-z/sqrt(observed)) to SIR * exp(z/sqrt(observed)). Return [0.0, 0.0] when observed or expected is not positive.
Hint
The standard error of ln(SIR) is 1/sqrt(observed events).
Test cases
case 1
in: [120,100,1.96]
expected: [1.0034046373317664,1.4351139574451428]
case 2
in: [10,8,1.96]
expected: [0.6725607277616321,2.323210284965938]
case 3
in: [5,10,1.645]
expected: [0.2395930199746716,1.0434360734984205]
case 4
in: [0,10,1.96]
expected: [0,0]
case 5
in: [10,0,1.96]
expected: [0,0]
Starter codePython
import math
def sir_ci(observed, expected, z_crit):
# Your code here
pass5 test cases · run your code against them in the editor