cyclic_shift {codyn} | R Documentation |
Cyclic Shift Permutations
Description
Performs a user-specified function on a null ecological community created via cyclic shift permutations (Harms et al. 2001, Hallett et al. 2014). The null community is formed by randomly selected different starting years for the time series of each species. This generates a null community matrix in which species abundances vary independently but within-species autocorrelation is maintained. The user-specified function must require a species x time input.
Usage
cyclic_shift(
df,
time.var,
species.var,
abundance.var,
replicate.var = NA,
FUN,
bootnumber
)
Arguments
df |
A data frame containing time, species and abundance columns and an optional column of replicates |
time.var |
The name of the time column |
species.var |
The name of the species column |
abundance.var |
The name of the abundance column |
replicate.var |
The name of the replicate column. Defaults to |
FUN |
A function to calculate on the null community |
bootnumber |
Number of null simulations to run |
Details
The input data frame needs to contain columns for time, species and abundance; time.var, species.var and abundance.var are used to indicate which columns contain those variables.
Value
The cyclic_shift function returns an S3 object of class "cyclic_shift" and parameter "out". The length of the "out" parameter is the number of null iterations as specified by bootnumber. If multiple replicates are specified, null values are averaged among replicates for each iteration, but a different cyclic shift permutation is applied to each replicate within an iteration.
References
Hallett, Lauren M., Joanna S. Hsu, Elsa E. Cleland, Scott L. Collins, Timothy L. Dickson, Emily C. Farrer, Laureano A. Gherardi, et al. "Biotic Mechanisms of Community Stability Shift along a Precipitation Gradient." Ecology 95, no. 6 (2014): 1693-1700.
Harms, Kyle E., Richard Condit, Stephen P. Hubbell, and Robin B. Foster. "Habitat Associations of Trees and Shrubs in a 50-Ha Neotropical Forest Plot." Journal of Ecology 89, no. 6 (2001): 947-59.
Examples
# Calculate a covariance matrix on a null community
data(knz_001d)
a1_cyclic <- cyclic_shift(subset(knz_001d, subplot == "A_1"),
time.var = "year",
species.var = "species",
abundance.var = "abundance",
FUN = cov,
bootnumber = 10)