class zepid.base.Diagnostics(alpha=0.05)

Generates the Sensitivity, Specificity, and the corresponding (1-alpha)% confidence intervals, comparing test results to disease status from pandas DataFrame

Sensitivity is calculated from

\[Se = \frac{TP}{P}\]

Wald standard error is

\[SE_{Wald} = \left(\frac{1}{TP} - \frac{1}{P}\right)^{\frac{1}{2}}\]

Specificity is calculated from

\[Sp = \frac{FN}{N}\]

Wald standard error is

\[SE_{Wald} = \left(\frac{1}{FN} - \frac{1}{N}\right)^{\frac{1}{2}}\]


Disease & Test must be coded as (1: yes, 0:no)

Parameters:alpha (float, optional) – Alpha value to calculate two-sided Wald confidence intervals. Default is 95% confidence interval


Calculate the sensitivity and specificity in a data set

>>> from zepid import Diagnostics, load_sample_data
>>> df = load_sample_data(False)
>>> diag = Diagnostics()
>>> diag.fit(df, test='art', disease='dead')  # Note this example is not great... ART is a treatment not test
>>> diag.summary()

Initialize self. See help(type(self)) for accurate signature.


__init__([alpha]) Initialize self.
fit(df, test, disease) Calculates sensitivity and specificity
summary([decimal]) Prints the results