Learn R Programming

tEDM (version 1.0)

multispatialccm: multispatial convergent cross mapping

Description

multispatial convergent cross mapping

Usage

# S4 method for list
multispatialccm(
  data,
  cause,
  effect,
  libsizes,
  E = 3,
  tau = 0,
  k = E + 1,
  boot = 99,
  seed = 42,
  threads = length(libsizes),
  parallel.level = "low",
  bidirectional = TRUE,
  progressbar = TRUE
)

Value

A list

xmap

cross mapping results

varname

names of causal and effect variable

bidirectional

whether to examine bidirectional causality

Arguments

data

observation data.

cause

name of causal variable.

effect

name of effect variable.

libsizes

number of time points used in prediction.

E

(optional) embedding dimensions.

tau

(optional) step of time lags.

k

(optional) number of nearest neighbors used in prediction.

boot

(optional) number of bootstraps to perform.

seed

(optional) random seed.

threads

(optional) number of threads to use.

parallel.level

(optional) level of parallelism, low or high.

bidirectional

(optional) whether to examine bidirectional causality.

progressbar

(optional) whether to show the progress bar.

References

Clark, A.T., Ye, H., Isbell, F., Deyle, E.R., Cowles, J., Tilman, G.D., Sugihara, G., 2015. Spatial convergent cross mapping to detect causal relationships from short time series. Ecology 96, 1174–1181.

Examples

Run this code
set.seed(42)
obs = runif(15,0,0.1)
sim = vector("list",15)
for (i in seq_along(obs)){
  sim[[i]] = logistic_map(x = obs[i],y = obs[i],step = 15,beta_xy = 0.5,beta_yx = 0)
}
lst = list(x = do.call(cbind, lapply(sim, function(df) df$x)),
           y = do.call(cbind, lapply(sim, function(df) df$y)))
multispatialccm(lst,"x","y",libsizes = 5:15,E = c(7,2),k = 6,threads = 1)

Run the code above in your browser using DataLab