Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-193

Attributable Risk Percent

Problem

Return the attributable risk percent (RR - 1)/RR * 100, where RR is the risk ratio from the 2x2 table. Return 0.0 when a group is empty or the unexposed risk is zero.

Hint

It is the share of exposed cases that would be avoided without exposure.

Test cases

case 1
in: [30,70,10,90]
expected: 66.66666666666666
case 2
in: [20,80,20,80]
expected: 0
case 3
in: [50,50,10,90]
expected: 80
case 4
in: [10,90,20,80]
expected: -100
case 5
in: [0,10,5,5]
expected: 0
Starter codePython
def attributable_risk_percent(a, b, c, d):
    # Your code here
    pass

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