Variability Metrics Functions

The variability metrics functions in MetaCommunityMetrics.jl are designed to quantify temporal variability in species and community abundances across spatial scales and organizational levels within a metacommunity. By partitioning variability at the species and community levels, both locally and regionally, these metrics implicitly reflect the net outcomes of ecological processes, including biotic interactions, dispersal, and environmental correlation, through the patterns of spatial synchrony and temporal covariance in abundance data. These functions are based on Wang et al. (2019), which provides a framework for partitioning variability at different hierarchical levels within a metacommunity.

Functionality Overview

In MetaCommunityMetrics, the CV_meta() function is translated from the R function var.partition() in the supplementary material of Wang et al. (2019), published in Ecography (https://doi.org/10.1111/ecog.04290). This function was first translated from R to Julia in August 2024 and is used here for non-commercial scientific research purposes in accordance with Wiley's terms and conditions for use of published content.

The function provides four metrics that are designed to quantify variability at different scales and contexts within a metacommunity:

  • CV_s_l (local-scale average species variability): the sum of the temporal standard deviations of each species' abundance (or biomass) at each site, divided by the mean total metacommunity abundance (or biomass). It captures species-level temporal variability at the local scale.
  • CV_s_r (regional-scale average species variability): the sum of the temporal standard deviations of each species' abundance (or biomass) summed across all sites, divided by the mean total metacommunity abundance (or biomass). Because each species' regional abundance is the sum across all sites, this metric implicitly incorporates pairwise temporal covariances between sites for the same species, reflecting spatial synchrony.
  • CV_c_l (local-scale average community variability): the sum of the temporal standard deviations of total community abundance (or biomass) at each site, divided by the mean total metacommunity abundance (or biomass). Because total community abundance at each site is the sum of all species abundances, by the variance sum law this metric implicitly incorporates pairwise temporal covariances between species within each site, reflecting the net outcome of biotic interactions such as competition and facilitation.
  • CV_c_r (regional-scale community variability): the temporal standard deviation of total metacommunity abundance (or biomass) across all species and sites, divided by the mean total metacommunity abundance (or biomass). This metric implicitly incorporates all pairwise temporal covariances: between species within sites (biotic interactions), between sites for the same species (spatial synchrony), and between different species at different sites.

The Function

MetaCommunityMetrics.CV_metaFunction
CV_meta(abundance::AbstractVector, time::AbstractVector, site::AbstractVector, species::AbstractVector) -> DataFrame

Calculates coefficients of variation for species and community abundances/biomass at both local and regional scales within a metacommunity.

Arguments

  • abundance::AbstractVector: Vector representing the abundance or biomass of species.
  • time::AbstractVector: Vector representing sampling dates.
  • site::AbstractVector: Vector representing site names or IDs.
  • species::AbstractVector: Vector representing species names or IDs.

Returns

  • DataFrame: A DataFrame containing the following columns:
    • CV_s_l: Local-scale average species variability.
    • CV_s_r: Regional-scale average species variability.
    • CV_c_l: Local-scale average community variability.
    • CV_c_r: Regional-scale community variability.

Details

  • This function is translated from the R function var.partition() in the supplementary material of Wang et al. (2019), published in Ecography (https://doi.org/10.1111/ecog.04290). First translated from R to Julia in August 2024. Used here for non-commercial scientific research purposes in accordance with Wiley's terms and conditions for use of published content.
  • CV_s_l (local-scale average species variability): the sum of the temporal standard deviations of each species' abundance (or biomass) at each site, divided by the mean total metacommunity abundance (or biomass). It captures species-level temporal variability at the local scale.
  • CV_s_r (regional-scale average species variability): the sum of the temporal standard deviations of each species' abundance (or biomass) summed across all sites, divided by the mean total metacommunity abundance (or biomass). Because each species' regional abundance is the sum across all sites, this metric implicitly incorporates pairwise temporal covariances between sites for the same species, reflecting spatial synchrony.
  • CV_c_l (local-scale average community variability): the sum of the temporal standard deviations of total community abundance (or biomass) at each site, divided by the mean total metacommunity abundance (or biomass). Because total community abundance at each site is the sum of all species abundances, by the variance sum law this metric implicitly incorporates pairwise temporal covariances between species within each site, reflecting the net outcome of biotic interactions such as competition and facilitation.
  • CV_c_r (regional-scale community variability): the temporal standard deviation of total metacommunity abundance (or biomass) across all species and sites, divided by the mean total metacommunity abundance (or biomass). This metric implicitly incorporates all pairwise temporal covariances: between species within sites (biotic interactions), between sites for the same species (spatial synchrony), and between different species at different sites.

Example

julia> using MetaCommunityMetrics, Pipe

julia> df = load_sample_data()
53352×12 DataFrame
   Row │ Year   Month  Day    Sampling_date_order  plot   Species  Abundance  Presence  Latitude  Longitude  standardized_temperature  standardized_precipitation 
       │ Int64  Int64  Int64  Int64                Int64  String3  Int64      Int64     Float64   Float64    Float64                 Float64                  
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     1 │  2010      1     16                    1      1  BA               0         0      35.0     -110.0                0.829467              -1.4024
     2 │  2010      1     16                    1      2  BA               0         0      35.0     -109.5               -1.12294               -0.0519895
     3 │  2010      1     16                    1      4  BA               0         0      35.0     -108.5               -0.409808              -0.803663
     4 │  2010      1     16                    1      8  BA               0         0      35.5     -109.5               -1.35913               -0.646369
     5 │  2010      1     16                    1      9  BA               0         0      35.5     -109.0                0.0822                 1.09485
   ⋮   │   ⋮      ⋮      ⋮             ⋮             ⋮       ⋮         ⋮         ⋮         ⋮          ⋮                ⋮                        ⋮
 53348 │  2023      3     21                  117      9  SH               0         0      35.5     -109.0               -0.571565              -0.836345
 53349 │  2023      3     21                  117     10  SH               0         0      35.5     -108.5               -2.33729               -0.398522
 53350 │  2023      3     21                  117     12  SH               1         1      35.5     -107.5                0.547169               1.03257
 53351 │  2023      3     21                  117     16  SH               0         0      36.0     -108.5               -0.815015               0.95971
 53352 │  2023      3     21                  117     23  SH               0         0      36.5     -108.0                0.48949               -1.59416
                                                                                                                                            53342 rows omitted

julia> CV_summary_df = CV_meta(df.Abundance, df.Sampling_date_order, df.plot, df.Species)
1×4 DataFrame
 Row │ CV_s_l   CV_s_r    CV_c_l    CV_c_r   
     │ Float64  Float64   Float64   Float64  
─────┼───────────────────────────────────────
   1 │ 1.48859  0.944937  0.718266  0.580183
source

References

  • Wang, S., Lamy, T., Hallett, L. M. & Loreau, M. Stability and synchrony across ecological hierarchies in heterogeneous metacommunities: linking theory to data. Ecography 42, 1200-1211 (2019). https://doi.org:https://doi.org/10.1111/ecog.04290