The Discriminatory Index is calculated with the following formula:

$D=1 - \frac{1}{N(N-1)} \sum^s_{j=1}n_j(n_j-1)$
where $N$ is the total number of Samples, $s$ is the total number of types described, and $n_j$ is the number of Samples belonging to the $j$th type.

Unknown values can either be ignored or treated as an unknown category.

A 95% Confidence Interval can be calculated with the following formula:
$CI=[D-2 \sqrt(\sigma^2), D+2 \sqrt(\sigma^2)]$ with
$\sigma^2=\frac{4}{N} [\sum \pi_j^3 - (\sum \pi_j^2)^2 ]$ and $\pi_j = \frac{n_j}{N}$.

See [Simpson, 1949], [Hunter, Gaston 1988], [Grundmann et. al. 2001].

## References

Simpson, E.H.: Measurement of diversity, Nature 163:688, 1949

Hunter, P.R., and Gaston, M.A.: Numerical index of the discriminatory ability of typing systems: an application of Simpson’s index of diversity, J. Clin. Microbiol. 26:2465–2466, 1988

Grundmann, H., Hori, S., Tanner, G.: Determining confidence intervals when measuring genetic diversity and the discriminatory abilities of typing methods for microorganisms, J. Clin. Microbiol., 39:4190-4192, 2001