Title: | Partitioning the Drivers of Stability of Ecological Communities |
---|---|
Description: | Contains the basic functions to apply the unified framework for partitioning the drivers of stability of ecological communities. Segrestin et al. (2024) <doi:10.1111/geb.13828>. |
Authors: | Jules Segrestin [aut, cre, cph]
|
Maintainer: | Jules Segrestin <[email protected]> |
License: | GPL-3 |
Version: | 0.0.3.9000 |
Built: | 2025-02-18 05:11:52 UTC |
Source: | https://github.com/jsegrestin/comstab |
comTS()
is a function used to simulate com
munity T
ime S
eries
based on custom parameters.
comTS(nsp, ny, even, mvs, sync = c("0", "1", "2", "-1", "-2"))
comTS(nsp, ny, even, mvs, sync = c("0", "1", "2", "-1", "-2"))
nsp |
Number of species in the community ( |
ny |
Length of the time series in years ( |
even |
Parameter of the geometric rank-abundance curve
ranging between 0 and 1 ( |
mvs |
Scaling coefficient of the mean-variance
relationship ranging between 1 and 2 ( |
sync |
Level of synchrony between species (
|
The simulation produces temporal series of abundances of 'nsp'
species for 'ny'
years.
The mean abundance of each species is determined by a geometric series of 'nsp'
values using a constant
'even'
ratio between successive terms. Hence, a high 'even'
value means a community with even species
abundances while a low 'even'
means a strongly dominated community. Species temporal variances are
calculated following Taylor’s power law, using with a 'mvs'
scaling coefficient.
Finally, for each species, the 'ny'
abundance values are sampled from a normal distribution
with the corresponding species parameters, and bounded to positive values. Since each species is simulated independently of others,
the resulting simulation can be used to describe a community where the 'nsp'
species fluctuate independently ('sync'
= "0").
To simulate an overall positive synchrony ('sync'
= "1"), the temporal sequences
of each species are sorted to maximize the number of years with all species
having values above or below their respective median (one random selection among many possible combinations).
A stabilizing negative synchrony ('sync'
= "-1") is simulated by sorting the temporal sequences
of each species to maximize the number of years where successively abundant species
have values above and below their respective median (one random selection among many possible combinations).
High positive synchrony ('sync'
= "2") and high negative synchrony ('sync'
= "-2") are generated using a similar approach but
sorting values based on four quartiles instead of using the median only.
The simulation uses a simplistic approach where species fluctuations are not related to any underlying environmental factor
nor demographic parameters. Consequently, the temporal order of the simulated abundances for each species cannot be considered realistic.
Nevertheless, this simplification has little influence on the analyses performed in this R
package since none of the indices
calculated depend on the temporal order of individual series, but rather describe the overall variability and temporal coordination of species.
A matrix
of 'ny'
rows and 'nsp'
columns, containing numerical values of species abundances.
The parameters used to compute species values (even, mvs, and sync) are stored as attributes of the matrix.
Jules Segrestin, [email protected]
require(stats) comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0")
require(stats) comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0")
PartitionR()
is a function used to partition the temporal coefficient of variation of a community
into the variability of the average species and three stabilizing effects: the dominance, asynchrony and averaging effects
(see Details).
partitionR(z, ny = 0)
partitionR(z, ny = 0)
z |
A |
ny |
Only species appearing more than |
The analytic framework is described in details in Segrestin et al. (2024). In short, the partitioning relies on the following equation:
where is the community coefficient of variation (reciprocal of community stability),
is the expected community CV when controlling for the dominance structure and species temporal synchrony,
is the dominance effect,
is the asynchrony effect, and
is the averaging effect.
Returns an object of class 'comstab'
.
An object of class 'comstab'
is a list containing the following components:
'CVs'
a named vector of calculated coefficient of variations. CVe
is the CV of an average species,
CVtilde
is the mean of species CVs weighted by their relative abundances, CVa
is the expected community CV if
the community was stabilized by species asynchrony only, and CVc
is the observed community CV.
'Stabilization'
a named vector of the stabilizing effects. tau
is the total stabilization, Delta
is
the dominance effect, Psi
is the asynchrony effect, and omega
is the averaging effect.
'Relative'
a named vector of the relative contributions of each stabilizing effect to the total stabilization.
Delta_cont
, Psi_cont
, and omega_cont
are the relative contribution of respectively, the dominance, asynchrony, and averaging effects to the total stabilization.
Returns a vector of NAs if any Stabilizing effect is higher than 1.
Jules Segrestin, [email protected]
Segrestin et al. (2024) A unified framework for partitioning the drivers of stability of ecological communities. Global Ecology and Biogeography, 33(5), e13828. https://doi.org/10.1111/geb.13828
require(stats) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: partitionR(z)
require(stats) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: partitionR(z)
comstab
objectPlotting method for object inheriting from class "comstab".
## S3 method for class 'comstab' plot(x, ..., xlab = "", ylab = "Log scale", cex.comp = 1)
## S3 method for class 'comstab' plot(x, ..., xlab = "", ylab = "Log scale", cex.comp = 1)
x |
object of class |
... |
other parameters to be passed through to plotting functions. |
xlab |
a label for the x axis, removed by defaults. |
ylab |
a label for the y axis, defaults to 'Log scale'. |
cex.comp |
A numerical value giving the label size of stabilizing components. This is an absolute measure, not scaled by par("cex"). |
No return value, graphical function.
Jules Segrestin, [email protected]
require(graphics) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: x <- partitionR(z) # Plots the result plot(x)
require(graphics) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: x <- partitionR(z) # Plots the result plot(x)
TPL
objectPlotting method for object inheriting from class "TPL".
## S3 method for class 'TPL' plot(x, ..., xlab = "Mean", ylab = "Variance", log = "xy")
## S3 method for class 'TPL' plot(x, ..., xlab = "Mean", ylab = "Variance", log = "xy")
x |
object of class |
... |
other parameters to be passed through to plotting functions. |
xlab |
a label for the x axis, defaults to 'Mean". |
ylab |
a label for the y axis, defaults to 'Variance'. |
log |
Defaults to 'xy' to show the log-log relationship. |
No return value, graphical function.
Jules Segrestin, [email protected]
require(graphics) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Computes Taylor's power law: x <- TPL(z) # Plots the result plot(x)
require(graphics) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Computes Taylor's power law: x <- TPL(z) # Plots the result plot(x)
ternStab()
is a graph function used to represent the relative contributions
of the three stabilizing effects ("Dominance", "Asynchrony" and "Averaging") on a
ternary plot.
ternStab(x, ..., point = TRUE, add = FALSE)
ternStab(x, ..., point = TRUE, add = FALSE)
x |
object of class |
... |
other parameters to be passed through to plotting functions. |
point |
plot the community on the ternary plot ( |
add |
add the community on the current plot window ( |
No return value, graphical function.
Jules Segrestin, [email protected]
require(Ternary) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: x <- partitionR(z) # Plots the relative contributions oldpar <- par(no.readonly = TRUE) par(mar = c(0, 0, 0, 0)) ternStab(x) # Adds a second community on the ternary plot z2 <- comTS(nsp = 15, ny = 30, even = .7, mvs = 1.1, sync = "1") x2 <- partitionR(z2) ternStab(x2, add = TRUE, col = "red") par(oldpar)
require(Ternary) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Runs the partitioning of the community coefficient of variation: x <- partitionR(z) # Plots the relative contributions oldpar <- par(no.readonly = TRUE) par(mar = c(0, 0, 0, 0)) ternStab(x) # Adds a second community on the ternary plot z2 <- comTS(nsp = 15, ny = 30, even = .7, mvs = 1.1, sync = "1") x2 <- partitionR(z2) ternStab(x2, add = TRUE, col = "red") par(oldpar)
TPL()
is a function used to compute the power function between
species temporal means and variances.
TPL(z, ny = 0, method = c("OLS", "SMA"))
TPL(z, ny = 0, method = c("OLS", "SMA"))
z |
A |
ny |
Only species appearing more than |
method |
Regression method used to estimate the scaling coefficient (
|
An object of class 'TPL'
is a list containing the following components:
data
a data.frame
containing species temporal means and variance
test
the result of the Pearson's correlation test between log10-transformed species means and variances (see stats::cor.test
)
a
the intercept of the power law
b
the scaling coefficient of the power law
Jules Segrestin, [email protected]
require(smatr) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Computes Taylor's power law: TPL(z)
require(smatr) # Simulates a custom community time series using 'comTS()': z <- comTS(nsp = 10, ny = 30, even = 0.6, mvs = 1.5, sync = "0") # Computes Taylor's power law: TPL(z)