#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)
Run the code above in your browser using DataLab