1. Home
  2. ECDIVERSITY procedure


Calculates measures of diversity with jackknife or bootstrap estimates (D.A. Murray).


PRINT = string tokens Controls printed output (index, estimate); default inde
INDEX = string token Controls the type of measurement to be calculated (hshannon, qstatistic, simpsonyule, bergerparker, ibrillouin, ebrillouin, dmcintosh, emcintosh, evar, logseriesalpha, lognormallambda, jshannon, margalef, isimpson, richness); default hsha
GROUPS = factor Defines the groups if there is more than one sample
BMETHOD = string token Controls whether to use the bootstrap or jackknife method (jackknife, bootstrap); default jack for multiple samples and boot for individual samples
NBOOT = scalar Number of times to resample in bootstrap; default 100
SEED = scalar Seed for random number generator for bootstrap; default 0
CIPROBABILITY = scalar Probability for the confidence interval produced by either jackknife or bootstrap method; default 0.95


INDIVIDUALS = variates Number of individuals per species
SPECIES = variates Number of species
SAVE = variate or pointer Saves the diversity indices


A diversity index is a measure of species diversity within a community that consists of co-occurring populations of several (two or more) different species. There are two components to diversity: richness and evenness. Richness is the measure of the number of species within a sample where the more species in a community the higher the diversity (or greater richness). Evenness is a measure of the relative abundance of the different species within a community. The more nearly equal the species relative abundances the higher the diversity.

ECDIVERSITY can be used to calculate several different measures of diversity. Amongst these indices are the log series α and log-Normal λ which are estimated by fitting an underlying species abundance model, and the Q statistic which is derived from cumulative ranked frequencies. Other available indices include the Margalef and Simpsons 1/D which emphasize the richness component of diversity. The indices that highlight the evenness component of diversity include Simpsons 1-D, McIntosh D and E, Shannon-Weiner H′ and J′, Brillouin diversity and evenness index, Berger-Parker and Smith-Wilson evenness measure. Confidence intervals for the measures can be estimated by bootstrapping. For multiple samples, ECDIVERSITY calculates the overall values of the diversity indices, and provides an option to perform jackknifing to produce less bias estimates with a confidence interval.

The numbers of individuals per species are specified using the INDIVIDUALS parameter. The SPECIES parameter specifies a variate containing the number of species for the associated number of individuals denoted in the corresponding element of INIDIVIDUALS. SPECIES can be omitted if each of the values in INDIVIDUALS corresponds to one species. The GROUPS option can be used to calculate measures of diversity for different samples. The SAVE parameter allows the diversity indices to be saved in a variate or in a pointer to a set of variates for each group.

The PRINT option controls printed output, with settings:

    index the index of diversity or evenness,
    estimate bootstrap or jackknife estimate with confidence limits for the statistic.

The BMETHOD option can be used to select either the bootstrap or jackknife (for multiple samples) method to produce an estimate of the diversity measure with an associated confidence interval. To produce a bootstrap or jackknife estimate for multiple samples each sample must contain the same number of values where each element corresponds to the same species within each sample. For the calculation of the bootstrap confidence intervals of the diversity measures, the NBOOT option specifies how many bootstrap samples to take (default 100). The probability level for the confidence interval can be set by the CIPROBABILITY option; by default 0.95. The SEED option specifies the seed to use in the random number generator used to construct the bootstrap samples. The default value of zero continues an existing sequence of random numbers or, if the generator has not yet been used in this run of Genstat, it initializes the generator automatically.




The log series α index is estimated by fitting a log series model using the ECFIT procedure. The log-Normal λ is the ratio of the S* and σ parameters estimated by fitting a Poisson-log-Normal distribution using the ECFIT procedure.

The Q statistic is calculated by:

Q = ( 0.5 × nR1 + ∑r = R1+1 … R2-1 { nr } + 0.5 × nR2 ) / log( R2 / R1),

where nr is the total number of species with abundance r, R1 and R2 are the 25% and 75% quartiles, nR1 is the number of species where R1 lies, and nR2 is the number of species where R2 lies.

The Shannon-Weiner index is evaluated by:

H′ = – ∑i (ni / N) × log(ni / N)

where ni are the individuals, N is total number of individuals.

The Shannon-Weiner evenness (Pielou J) is given by

J′ = H′ / log(S)

where H′ is the Shannon index and S is the total number of species.

The Brillouin index is given by

HB = ( log(N!) – ∑i {log(ni!)} ) / N

where ni is the individual in species i and N is total number of individuals.

The Brillouin evenness index is then calculated by

E = HB / HBmax


HBmax = 1 / N × log( N! / ( (N/S)!Sr × ((N/S)+1)!r )

where N/S is the integer of N/S and r = NS(N/S)

Simpsons index D is calculated by

D = ∑i {ni × (ni – 1)} / (N × (N – 1))

and is expressed in the output as both 1-D and 1/D

The Margalef index is:

Dmn = (S – 1) / log(N)

where S is total number of species and N is total number of individuals.

McIntosh’s measure of diversity is expressed as

D = (N – √( ∑i {ni2} / (N – √(N))

and the evenness measure is given by

E = (N – √( ∑i {ni2} ) / (NN / √(S))

where ni is the individual in species i and N is total number of individuals.

The Berger-Parker index is

d = Nmax / N

where Nmax is the number of individuals in the most abundant species.

The Evar (Smith and Wilson 1996) evenness index is evaluated by

Evar = 1 – 2 / π × arctan( ∑i { log(ni) – ∑j { log(nj) } }2 / S )

where ni and nj are the number of individuals in species i and j respectively, and S is the total number of species

Species richness is the total number of species.

The jackknife estimate and standard error are generated by the JACKKNIFE procedure where the estimates are calculated from all samples, and then for the situations where one sample is omitted in turn. The confidence interval is calculated by:

φ +/- t(n-1) × se(φ)

where n is the number of samples.

The bootstrap confidence intervals are generated using the BOOTSTRAP procedure where all individuals are sampled with replacement and the diversity measures are calculated from these samples.

Action with RESTRICT

If a parameter is restricted the statistics will be calculated using only those units included in the restriction.


Magurran, A.E. (2003). Measuring Biological Diversity. Blackwell, Oxford.

Smith, B, & Wilson, J.B. (1996). A consumer’s guide to evenness indices. Oikos, 76, 70-82.

See also

Commands for Ecological data.


CAPTION      'ECDIVERSITY example'; STYLE=meta
FACTOR       [NVALUES=69; LEVELS=3; VALUES=23(1...3);\
             LABELS=!t('Derrycunnihy oakwood','Muckross yew wood',\
             'Sitka spruce plot')] Location
VARIATE      [VALUES=35,26,25,21,16,11,6,5,3,3,3,3,3,2,2,2,1,1,1,1,0,0,0,\
                      9,20,10,21, 5,14,0,3,2,6,9,2,0,0,0,6,0,0,0,1,1,1,0,\
                     14,10, 0,30, 4, 6,0,0,7,3,0,0,0,0,0,0,0,0,0,0,0,0,1]\
ECDIVERSITY [INDEX=hshannon,simpson,berger; GROUPS=Location] Territories
Updated on March 8, 2019

Was this article helpful?