asc_entities: Identify Functional Entities (Species Clustering)

View source: R/asc_entities.R

asc_entitiesR Documentation

Identify Functional Entities (Species Clustering)

Description

Groups species with similar traits into functional entities by hierarchical clustering (Gower distance and Ward's method by default). If neither k nor h is given, the number of entities is chosen as the one with the highest mean silhouette width. The result can be passed to asc_null (A on counts summed by entity) and asc_transitions (displacement between vs within entities) to explore whether species were replaced by functionally similar ones. This use is exploratory: only replacement within an entity is seen (similar species placed in different entities look like a change between entities, so a negative result does not rule out redundancy), the signal was weak in the validation except for strong compensation, and it depends on the number of entities.

Usage

asc_entities(
  traits,
  dist_method = "gower",
  hclust_method = "ward.D2",
  k = NULL,
  h = NULL,
  k_max = 15,
  B = 100,
  seed = NULL,
  correction = c("none", "sqrt"),
  type = NULL,
  weights = NULL
)

Arguments

traits

A data frame or matrix of functional traits (row names = species).

dist_method

Character. Distance metric. Default is "gower".

hclust_method

Character. Agglomeration method. Default is "ward.D2".

k

Integer. Number of entities. If NULL (and h is NULL), chosen by the silhouette.

h

Numeric. Height at which to cut the dendrogram (alternative to k).

k_max

Integer. Largest k evaluated by the criteria. Default 15.

B

Integer. Number of reference data sets for the gap statistic. Default 100.

seed

Integer or NULL. Seed for the gap statistic (the user's random stream is left unchanged).

correction, type, weights

Passed to the trait distance; see asc_paired.

Details

Three criteria are computed for k = 2, ..., k_max on the same tree:

  • Mean silhouette width (Rousseeuw 1987), on the trait distance. Used to choose k by default. Below 0.25: no clear groups; 0.25-0.5: weak structure.

  • Mojena's rule: first fusion height above the mean plus 1.25 standard deviations of all fusion heights.

  • Gap statistic (Tibshirani et al. 2001), on the PCoA coordinates, with the "Tibs2001SEmax" rule. k = 1 means no natural groups: the entities then discretise a continuum, which is still useful, but conclusions should be checked with neighbouring values of k.

In the validation (continuous traits of 42 butterfly species), very coarse entities (k = 5, Mojena's choice there) classified part of a directed change as "within entities", whereas the silhouette choice (k = 13) did not. Even with k = 13, compensation between similar species was detected only when it was strong, and not when the species fell in different entities. With discrete traits, h = 0 gives entities in the strict sense (species sharing exactly the same trait combination); this use has not been evaluated by simulation.

Value

An S3 object of class ascent_entities (it also carries the class ascfcd_entities of ascent 0.5.0, which will be dropped in 0.6.0) with membership (named vector: species -> entity, accepted by asc_null() and asc_transitions()), k, entity_classification (species, entity and traits), indices (silhouette and gap by k), suggestions (k by silhouette, Mojena and gap), silhouette_max, n_species_per_entity, distance_matrix, hclust_obj, method and metric.

References

Rousseeuw, P. J. (1987). Silhouettes: a graphical aid to the interpretation and validation of cluster analysis. Journal of Computational and Applied Mathematics, 20, 53-65.

Tibshirani, R., Walther, G. & Hastie, T. (2001). Estimating the number of clusters in a data set via the gap statistic. Journal of the Royal Statistical Society B, 63, 411-423.

Mojena, R. (1977). Hierarchical grouping methods and stopping rules: an evaluation. The Computer Journal, 20, 359-363.

Examples


# Group the 24 species of birds_sim by their traits
ent <- asc_entities(birds_sim$traits, k_max = 10, B = 50, seed = 1)

# Suggested number of entities (silhouette, Mojena, gap) and their sizes
summary(ent)

# Is the change at "Logged" a reorganisation of the functional groups
# (shift between entities) or a replacement among similar species (within)?
res <- asc_paired(birds_sim$traits, birds_sim$counts,
                  sites = birds_sim$samples$site,
                  time = birds_sim$samples$time, ref_time = "Before")
asc_transitions(res, entities = ent)$Logged$entities



ascent documentation built on Nov. 30, 2026, 1:07 a.m.