# zepid.calc.utils.risk_ratio¶

zepid.calc.utils.risk_ratio(a, b, c, d, alpha=0.05)

Calculates the risk ratio and confidence intervals from count data.

Risk ratio is calculated from

$RR = \frac{a}{a + b} / \frac{c}{c + d}$

Risk ratio standard error is

$SE = \left(\frac{1}{a} - \frac{1}{a + b} + \frac{1}{c} - \frac{1}{c + d}\right)^{\frac{1}{2}}$
Parameters: a (integer, float) – Count of exposed individuals with outcome b (integer, float) – Count of unexposed individuals with outcome c (integer, float) – Count of exposed individuals without outcome d (integer, float) – Count of unexposed individuals without outcome alpha (float, optional) – Alpha value to calculate two-sided Wald confidence intervals. Default is 95% confidence interval Tuple of risk ratio, lower CL, upper CL, SE tuple

Examples

Estimate the risk ratio, standard error, and confidence intervals

>>> from zepid.calc import risk_ratio
>>> rr = risk_ratio(45, 55, 21, 79)


Extracting the estimated risk ratio

>>> rr.point_estimate


Extracting the lower and upper confidence intervals, respectively

>>> rr.lower_bound
>>> rr.upper_bound


Extracting the standard error

>>> rr.standard_error