multiEWS {EWSmethods} | R Documentation |
Multivariate Early Warning Signal Assessment
Description
A single function for performing early warning signal (EWS) assessment on multivariate systems where multiple time series have been measured. Both methods of EWS assessment can be performed (rolling or expanding windows) with the assessments returned as a dataframe. The two methods of dimension reduction used to perform these assessments are Principal Component Analysis and Maximum/Minimum Autocorrelation Factors.
Usage
multiEWS(
data,
metrics = c("meanAR", "maxAR", "meanSD", "maxSD", "eigenMAF", "mafAR", "mafSD",
"pcaAR", "pcaSD", "eigenCOV", "maxCOV", "mutINFO"),
method = c("expanding", "rolling"),
winsize = 50,
burn_in = 5,
threshold = 2,
tail.direction = "one.tailed"
)
Arguments
data |
A dataframe where the first column is an equally spaced time vector and all other columns are individual time series. These could be different species, populations or measurements. |
metrics |
String vector of early warning signal metrics to be assessed. Options include: |
method |
Single string of either |
winsize |
Numeric value. If |
burn_in |
Numeric value. If |
threshold |
Numeric value of either |
tail.direction |
String of either |
Value
A list containing up to two objects: EWS outputs through time (EWS
), and an identifier string (method
).
EWS$raw |
Dataframe of EWS measurements through time. If |
EWS$dimred.ts |
Dataframe containing the dimension reduction time series |
EWS$cor |
Dataframe of Kendall Tau correlations. Only returned if |
Examples
#Generate a random five species, non-transitioning
#ecosystem with 50 years of monitoring data.
spp_data <- matrix(nrow = 50, ncol = 5)
spp_data <- sapply(1:dim(spp_data)[2], function(x){
spp_data[,x] <- rnorm(50,mean=20,sd=5)})
multi_spp_data <- as.data.frame(cbind("time" =
seq(1:50), spp_data))
#Rolling window early warning signal assessment of
#the ecosystem.
roll_ews <- multiEWS(
data = multi_spp_data,
method = "rolling",
winsize = 50)
#Expanding window early warning signal assessment of
#the ecosystem.
exp_ews <- multiEWS(
data = multi_spp_data,
method = "expanding",
burn_in = 10)