asc_paired: Paired Functional Restructuring (Reference vs Comparison...

View source: R/asc_paired.R

asc_pairedR Documentation

Paired Functional Restructuring (Reference vs Comparison State)

Description

Measures, at each site, the change between a reference state and a comparison state (e.g. before and after an event) in three layers of the functional space: position (shift of the abundance-weighted centroid, \Delta C), dispersion (\DeltaFDis) and volume (\DeltaFRic). Pass the result to asc_null to test each layer, and to asc_transitions to see which species moved the centroid.

Usage

asc_paired(
  traits,
  abund,
  sites,
  time,
  ref_time,
  dist_method = "gower",
  dim_retention = c("msd", "variance", "broken_stick"),
  var_tol = 0.8,
  na.rm = TRUE,
  correction = c("none", "sqrt"),
  type = NULL,
  weights = NULL,
  blocks = NULL
)

Arguments

traits

A data frame or matrix of functional traits, one row per species (row names = species). Categorical traits should be factors.

abund

A data frame or matrix of abundances, one row per sample and one column per species (matched to traits by name). Use counts of individuals (whole numbers): null model A needs them. Several samples of the same site and state are replicates.

sites

A vector, one value per row of abund, naming the site (one contrast is made per site).

time

A vector, one value per row of abund, naming the state of each sample.

ref_time

The value of time that is the reference state; all other samples of a site form the comparison state.

dist_method

Distance metric for the trait matrix. Default is "gower".

dim_retention

Character. How many PCoA axes to keep: "msd" (default since 0.5.1: the number of axes, 2 to 10, whose Euclidean distances best reproduce the trait distances, i.e. the minimum mean squared deviation of Maire et al. 2015), "variance" (axes needed to reach var_tol of the positive variance; the default up to 0.5.0, use it to reproduce earlier results) or "broken_stick" (axes explaining more than the broken-stick expectation). assess_functional_space shows the fidelity for each number of axes.

var_tol

Numeric. Proportion of cumulative variance to retain when dim_retention = "variance". Default is 0.80.

na.rm

Logical. Remove missing values? Default is TRUE.

correction

Character. "none" (default) builds the PCoA on the Gower dissimilarity, as in 0.1.1. "sqrt" uses its square root, which Gower (1971) showed to be Euclidean for complete data with constant weights (no negative eigenvalues). It changes the distances between species (and the shape of the space), so results with and without it are not comparable; its effect on the tests has not been evaluated by simulation. An option when the space quality is low, not a default recommendation.

type, weights

Optional; passed unchanged to daisy (e.g. to declare asymmetric binary traits or to down-weight traits coded in several columns). Default: not used.

blocks

Optional vector, one value per row of abund, naming the unit in which each sample was taken when the samples of both states were taken in matched units: the same months, plots or survey rounds. With blocks, null model A exchanges samples between the two states only within each block (see asc_null, section "Choosing the permutation for A"). Leave NULL when samples are not matched. Blocks are used only when both states of a contrast have replicates. They remove effects shared by the samples of a block, but not the temporal autocorrelation of consecutive samples of the same state.

Value

An S3 object of class ascent_paired (it also carries the class ascfcd of ascent 0.5.0, which will be dropped in 0.6.0), a list whose main elements are rDelta_C (centroid shift per contrast, as a percentage of the largest distance between species in the functional space), site_results (per contrast: abs_dist = ||\Delta C||, Delta_FDis, Delta_FRic, Delta_FRic_rarefied, n_samples and the share of the shift along each axis), F_space (species coordinates), k_retained and dim_retention (number of axes and the rule used), quality of the PCoA and the inputs needed by asc_null(). summary() gives a reading; plot() draws the shift.

Note

Normalization: Delta FDis and Delta FRic are absolute differences, not normalized by the regional pool. Values are not directly comparable across studies with different species pools or trait scales. Only rDelta_C (position) is normalized by Dmax_regional.

FRic = NA: When a community has fewer species than retained PCoA axes, the convex hull is geometrically undefined and FRic is set to NA, which propagates to Delta_FRic.

FRic and unequal replicates: with replicates, a species counts as present in a state if it appears in any of its samples, so FRic grows with the number of samples. When the two states of a contrast have different numbers of samples, Delta_FRic_rarefied gives Delta FRic with the same number of samples in both states: FRic of the state with more samples is averaged over all subsets of the size of the other state (or over 200 random subsets, with a fixed internal seed, when there are more). Use it to read the size of the volume change; the tests of asc_null keep the numbers of samples and remain valid.

Replicates: When several rows share the same site and state (e.g. five surveys before an event), their relative abundances are averaged (column means) to describe the state, so the three layers compare the mean community of each state. The variation among replicates is used by null model A, which then permutes whole samples between the states (see asc_null).

Examples

# birds_sim: two sites surveyed 5 times before and 5 times after an event.
# At "Logged" the bird community changes; at "Control" nothing changes.
# Check the functional space first (see ?assess_functional_space)
assess_functional_space(birds_sim$traits)

res <- asc_paired(birds_sim$traits, birds_sim$counts,
                  sites = birds_sim$samples$site,
                  time = birds_sim$samples$time, ref_time = "Before")

# Layer1_rDeltaC is the centroid shift (% of the functional space): it is
# large at "Logged" and small at "Control". The last section ("Top Functional
# Drivers") lists the species that moved the centroid most (see ?asc_transitions).
summary(res)


# Is each shift larger than sampling noise (A) and organised by traits (B)?
res <- asc_null(res, n_perm = 199, seed = 1)
summary(res)



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