This function can compute different aggregation indices. See "Details" section for more information about the available indices.

agg_index(x, method = c("fisher", "lloyd", "morisita"), flavor = c("count",
  "incidence"), n = NULL, ...)



A numeric vector or a count/incidence object.


The name of the method to be used. "fisher" method is used by default. See details below.


Which flavor of this index must be calculated ("count" or "incidence")?


Number of individuals per sampling unit. If n is provided, the "incidence" flavor is calculated whatever the value of flavor. Note that current implementation only deals with equal size sampling units.


Additional arguments to be passed to other methods.


There are currently three implemented methods to compute indices of aggregation.

fisher: Fisher's index of aggregation. In case of a count, this index corresponds to the ratio of the observed variance to the observed mean, and this is why this index is also known as the variance to mean ratio. For a binary variable, a similar index can be calculated using instead the ratio of the observed variance to the theoretical variance if data follow a binomial law (i.e. a reference distribution for a random pattern of individuals within sampling units).

lloyd: Lloyd's index of patchiness. The value of this index increases with the degree of aggregation. Note that Lloyd's mean crowding can also be returned if type = "mean-crowding" is provided as parameter.

morisita: Morisita's coefficient of dispersion. This index can be computed for either count or incidence data, but its interpretation can be uncertain.

Values of Fisher's and Lloyd's indices can be interpreted as follows:

  • index < 1: uniform pattern;

  • index = 1: random pattern;

  • index > 1: aggregated pattern.

The following table gives information about the applicability of the various methods.


where + means implemented, and -, not implemented (or not possible). At the moment, there is no index of aggregation for severity data.


Fisher RA. 1925. Statistical methods for research workers. Oliver and Boyd, Edinburgh.

Lloyd M. 1967. Mean crowding. The Journal of Animal Ecology 36, 1–30.

Morisita M. 1962. I\(\delta\)-Index, a measure of dispersion of individuals. Researches on Population Ecology 4, 1–7. doi:10.1007/BF02533903

Madden LV, Hughes G. 1995. Plant disease incidence: Distributions, heterogeneity, and temporal analysis. Annual Review of Phytopathology 33(1): 529–564. doi:10.1146/

See also

vegdist in vegan package.


# Count flavor of Fisher's index: my_fisher_count <- agg_index(aphids$i) my_fisher_count
#> Fisher's index of dispersion: #> (Version for count data) #> 32.56
# And incidence flavor of Fisher's index: my_fisher_incidence <- agg_index(tobacco_viruses$i, n = tobacco_viruses$n) my_fisher_incidence
#> Fisher's index of dispersion: #> (Version for incidence data) #> 3.144
# Either standard R or epiphy idioms can be used: identical(my_fisher_count, agg_index(count(aphids)))
#> [1] TRUE
identical(my_fisher_incidence, agg_index(incidence(tobacco_viruses)))
#> [1] TRUE
# Lloyd's index (only for count data): agg_index(aphids$i, method = "lloyd")
#> Lloyd's index of patchiness: #> 4.589
# Lloyd's mean crowding: agg_index(aphids$i, method = "lloyd", type = "mean-crowding")
#> Lloyd's mean crowding: #> 40.36
# Count flavor of Morisita's index: agg_index(aphids$i, method = "morisita")
#> Morisita's coefficient of dispersion: #> (Version for count data) #> 4.539
# Incidence flavor of Morisita's index: agg_index(tobacco_viruses$i, n = tobacco_viruses$n, method = "morisita")
#> Morisita's coefficient of dispersion: #> (Version for incidence data) #> 1.295