zepid.calc.utils.number_needed_to_treat¶

zepid.calc.utils.
number_needed_to_treat
(a, b, c, d, alpha=0.05)¶ Calculates the number needed to treat and confidence intervals from count data.
Number needed to treat is calculated as
\[NNT = \frac{1}{RD} = \frac{1}{\frac{a}{a + b}  \frac{c}{c + d}}\]Confidence intervals are calculated by taking the inverse of the lower and upper confidence limits of the risk difference. The formula for the risk difference standard error is
\[SE = \left(\frac{R_1 \times (1  R_1)}{a+b} + \frac{R_0 \times (1R_0)}{c+d}\right)^{\frac{1}{2}}\]Note
If the risk difference confidence limits cover the null (RD=0), that means the interpretation will switch from NNT to NNH (number needed to harm). See Altman 1998 for further details on interpretation is this scenario
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 twosided Wald confidence intervals. Default is 95% confidence interval
Returns: Tuple of NNT, lower CL, upper CL, SE
Return type: tuple
Examples
Estimate the number needed to treat, standard error, and confidence intervals
>>> from zepid.calc import number_needed_to_treat >>> nnt = number_needed_to_treat(45, 55, 21, 79)
Extracting the estimated number needed to treat
>>> nnt.point_estimate
Extracting the lower and upper confidence intervals, respectively
>>> nnt.lower_bound >>> nnt.upper_bound
Extracting the standard error
>>> nnt.standard_error