Statistical Methods

Summarize Categorical Diversity

Decide what is being counted

A diversity summary describes how observations are distributed across categories. Start with a mutually exclusive category definition and a counting unit: documents, study designs, specimen classes, or another clearly specified object. If one object can receive several labels, decide whether to construct an exclusive classification or analyze label occurrences explicitly. Otherwise the denominator silently changes.

Keep missing or unclassifiable records visible. Treating missingness as a substantive category can change the interpretation, while dropping it changes the population summarized. Preserve the original counts so a reviewer can understand either choice.

Name the index and its convention

The SciPy entropy documentation defines Shannon entropy as minus the sum of p×log(p). Using natural logarithms expresses the result in nats. A zero-probability category contributes zero by continuity; it does not make the entropy undefined.

The vegan diversity documentation distinguishes Simpson concentration, sum(p²), from the diversity form 1−sum(p²) and the inverse form 1/sum(p²). These quantities have different directions and scales, so the word “Simpson” alone is insufficient in a methods section.

Work through invented counts

Consider 50 records in category A, 25 in B, and 25 in C. The proportions are 0.50, 0.25, and 0.25. Shannon entropy is approximately 1.03972 nats. Exponentiating gives 2.82843 effective categories: the number of equally common categories with the same Shannon entropy.

Simpson concentration is 0.25+0.0625+0.0625 = 0.375. Its diversity form is 0.625 and the inverse concentration is 2.66667 effective categories. The difference between the two effective-category summaries reflects their different weighting of category frequencies; it is not a calculation error.

Use the categorical diversity tool and retain the counts in the category diversity worksheet. Adding an unused category with count zero should not alter these quantities. An entirely empty dataset has no observed category distribution to summarize.

Make comparisons interpretable

Compare datasets only after checking that their categories were defined at the same resolution. Splitting one category into several subcategories can increase diversity without any change in the underlying records. Different sample sizes also affect which rare categories are observed; these descriptive plug-in summaries do not correct sampling bias or supply uncertainty intervals.

Report total count, nonempty category count, index convention, and the underlying distribution alongside the summary. Diversity is not automatically desirable: a more varied set of data-entry errors is not better data. These tools describe composition and do not establish clinical benefit, representativeness, fairness, or predictive performance. Choose a metric because it answers the research question, rather than because a higher value looks favorable.

Sources checked on 5 November 2026; all numerical examples are fictional and independently recomputed.

Related reading

Reading path: Analyze data. Guide 2 of 36. Choose any guide to suit your project.

Statistical Methods

Summarize an Ordinal Scale Without Hiding Its Categories

Preserve ordered response labels, denominators, and scoring rules when describing ordinal research outcomes.

Statistical Methods

Audit Binary Prediction Scores

Calculate a binary Brier score from valid aggregate inputs and distinguish overall probability accuracy from calibration.

Browse this reading pathTools for this stageGuides and downloads for this stage