zepid.base.IncidenceRateRatio¶

class zepid.base.IncidenceRateRatio(reference=0, alpha=0.05)

Estimates of Incidence Rate Ratio with a (1-alpha)*100% Confidence interval. Missing data is ignored

Incidence rate ratio is calculated from

$IR = \frac{a}{t_1} / \frac{c}{t_0}$

Incidence rate ratio standard error is

$SE = \left(\frac{1}{a} + \frac{1}{c}\right)^{\frac{1}{2}}$

Note

Outcome must be coded as (1: yes, 0:no). Only works for binary outcomes

Parameters: reference (integer, optional) – Reference category for comparisons. Default reference category is 0 alpha (float, optional) – Alpha value to calculate two-sided Wald confidence intervals. Default is 95% confidence interval

Examples

Calculate the incidence rate ratio in a data set

>>> from zepid import IncidenceRateRatio, load_sample_data
>>> irr = IncidenceRateRatio()
>>> irr.summary()


Calculate the incidence rate ratio with exposure of ‘1’ as the reference category

>>> irr = IncidenceRateRatio(reference=1)
>>> irr.summary()


Generate a plot of the calculated incidence rate ratio(s)

>>> import matplotlib.pyplot as plt
>>> irr = IncidenceRateRatio()

__init__(reference=0, alpha=0.05)
 __init__([reference, alpha]) Initialize self. fit(df, exposure, outcome, time) Calculate the Incidence Rate Ratio plot([measure, scale, center]) Plot the risk ratios or the risks along with their corresponding confidence intervals. summary([decimal]) Prints the summary results