Variability Metrics Functions
The variability metrics functions in MetaCommunityMetrics
are designed to capture changes in dispersal and density-dependent biotic interactions by investigating temporal variability and synchrony across spatial scales and organizational levels within a metacommunity. These functions are based on the work of Wang et al. (2019), which provides a framework for quantifying variability at different scales and contexts within a community.
An Overview
In MetaCommunityMetrics
, the CV_meta
function is directly adapted from the R function var.partition
in Wang et al. (2019).
The function provides four metrics that are designed to quantify variability at different scales and contexts within a metacommunity:
- Local-scale average species variability (
CV_s_l
) - Regional-scale average species variability (
CV_s_r
) - Local-scale average community variability (
CV_c_l
) - Regional-scale community variability (
CV_c_r
)
The Function
MetaCommunityMetrics.CV_meta
— FunctionCV_meta(abundance::AbstractVector, time::AbstractVector, site::AbstractVector, species::AbstractVector) -> DataFrame
Calculates coefficients of variation (CV) for species and community biomass at both local and regional scales within a metacommunity.
Arguments
abundance::AbstractVector
: Vector representing the abundance 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.
Example
julia> using MetaCommunityMetrics, Pipe
julia> df = @pipe load_sample_data()
53352×12 DataFrame
Row │ Year Month Day Sampling_date_order plot Species Abundance Presence Latitude Longitude normalized_temperature normalized_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
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