Skip to content

Relative risk

Maurice HT Ling edited this page Aug 14, 2021 · 3 revisions

Purpose: Measures relative risk of an outcome as result of exposure

Code:

>>> from scipy import stats
>>> exposed_positive = 27
>>> exposed_total = 122
>>> unexposed_positive = 44
>>> control_total = 487
>>> result = stats.contingency.relative_risk(exposed_positive, exposed_total,
                                             unexposed_positive, unexposed_total)
>>> print("relative risk = %.3f" % result.relative_risk)
relative risk = 2.450
>>> confidence = result.confidence_interval(confidence_level=0.95)
>>> print("95 percent confidence interval of relative risk = %.3f to %.3f" % (confidence.low, confidence.high))
95 percent confidence interval of relative risk = 1.584 to 3.789
Clone this wiki locally