Skip to content

Odds ratio

Maurice HT Ling edited this page Aug 14, 2021 · 1 revision

Purpose: Measures odds ratio of an outcome as result of exposure.

Code:

>>> from scipy import stats
>>> exposed_positive = 27
>>> exposed_total = 122
>>> unexposed_positive = 44
>>> control_total = 487
>>> odds = (exposed_positive / (exposed_total - exposed_positive)) / \
           (unexposed_positive / (unexposed_total - unexposed_positive))
>>> print("odds ratio = %.3f" % odds)
odds ratio = 2.861
Clone this wiki locally