zepid.calc.utils.incidence_rate_difference¶
-
zepid.calc.utils.
incidence_rate_difference
(a, c, t1, t2, alpha=0.05)¶ Calculates the incidence rate difference and confidence intervals from count data
Incidence rate difference is calculated from
\[ID = \frac{a}{t_1} - \frac{c}{t_2}\]Incidence rate difference standard error is
\[SE = \left(\frac{a}{t_1^2} + \frac{c}{t_2^2}\right)^{\frac{1}{2}}\]Parameters: - a (integer, float) – Count of exposed individuals with outcome
- c (integer, float) – Count of unexposed individuals with outcome
- t1 (integer, float) – Person-time contributed by those who were exposed
- t2 (integer, float) – Person-time contributed by those who were unexposed
- alpha (float, optional) – Alpha value to calculate two-sided Wald confidence intervals. Default is 95% confidence interval
Returns: Tuple of ID, lower CL, upper CL, SE)
Return type: tuple
Examples
Estimate the incidence rate ratio, standard error, and confidence intervals
>>> from zepid.calc import incidence_rate_difference >>> ird = incidence_rate_difference(45, 21, 109, 158)
Extracting the estimated incidence rate ratio
>>> ird.point_estimate
Extracting the lower and upper confidence intervals, respectively
>>> ird.lower_bound >>> ird.upper_bound
Extracting the standard error
>>> ird.standard_error