Julia package for diversity measurement
Clone or download
Pull request Compare This branch is 507 commits behind richardreeve:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Diversity Build Status Coverage Status Diversity

Diversity is a Julia package that provides functionality for measuring alpha, beta and gamma diversity of subcommunities and ecosystems. It uses the diversity measures described in the arXiv paper arXiv:1404.6520 (q-bio.QM), How to partition diversity. It also provides a series of other related and older diversity measures through sub-modules. Currently these are all ecological diversity measures, but this will be expanded through interfacing to BioJulia.

This package is still in alpha, and so we do not guarantee its correctness, although we are aware of no issues with it. Please raise an issue if you find any problems.


Diversity is in METADATA and can be installed via Pkg.add("Diversity").



Accessing the main functionality in the package is simple:

using Diversity
diversities = ecosystemAbar(proportions, [0, 1, 2, Inf], Z)
diversity = DE(proportions, 2, Z)

The main package provides basic diversity measures (from Hill, 1973), and generalised alpha, beta and gamma diversity measures at the level of the ecosystem and its component subcommunities (these are extended from Reeve et al, 2014). There are also matching normalised and raw, alpha, beta and gamma diversities at both the subcommunity and ecosystem level. The functions exist both with unicode names preceded by D (e.g. Dᾱ()), and with matching ascii names (e.g. subcommunityalphabar()). We also provide a general function for extract any diversity measure for a series of subcommunity relative abundances. And we can calculate the proportions that subcommunities each contribute to ecosystem diversity per subcommunity or per individual. The full documentation can be found here.

The package also provides sub-modules with other diversity measures:


We also replicate old ecological diversity measures and generalised versions of them that relate to our general measures of alpha, beta and gamma diversity at subcommunity and ecosystem measures. The generalisations of the richness, Shannon and Simpson are the only standard measures we are aware of whose subcommunity components sum directly to the corresponding ecosystem measure (although note that Simpson's index decreases for increased diversity, so small components are more diverse). Documentation for these diversity measures can be found here.


Hill numbers are found in the .Hill sub-module. Documentation for these diversity measures can be found here.


Lou Jost's diversity measures are found in the .Jost sub-module. Documentation for these diversity measures is here.


Documentation is generated by the Docile package, and available in Julia and on the web through the Lexicon package.


Accessing the documentation in Julia requires Lexicon:

using Diversity
using Lexicon

# Returns any documentation for the qDZ function and all qDZ methods

# Returns the specific documentation for that qD method call
?qD([0.1, 0.2, 0.7], 2)

However, the documentation is also available online.

Stable branch

The online documentation for the current stable branch is here:

Master branch

The online documentation for the current master (unreleased) branch is here: