multispatial convergent cross mapping
Usage
# S4 method for class '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
)
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
orhigh
.- bidirectional
(optional) whether to examine bidirectional causality.
- progressbar
(optional) whether to show the progress bar.
Value
A list
xmap
cross mapping results
varname
names of causal and effect variable
bidirectional
whether to examine bidirectional causality
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
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(rbind, lapply(sim, function(df) df$x)),
y = do.call(rbind, lapply(sim, function(df) df$y)))
multispatialccm(lst,"x","y",libsizes = seq(5,15,1),E = c(2,4),k = 5,threads = 1)
#>
Computing: [========================================] 100% (done)
#>
Computing: [========================================] 100% (done)
#> libsizes x->y y->x
#> 1 5 0.3605495 0.3301142
#> 2 6 0.4306829 0.4012219
#> 3 7 0.4799676 0.4636211
#> 4 8 0.5138123 0.4956088
#> 5 9 0.5408698 0.5333870
#> 6 10 0.5747756 0.5742982
#> 7 11 0.5953998 0.5999543
#> 8 12 0.6362903 0.6425245
#> 9 13 0.6670359 0.6687122
#> 10 14 0.6982020 0.6980796
#> 11 15 0.7214717 0.7203842