geographical convergent cross mapping
# S4 method for sf
gccm(
data,
cause,
effect,
libsizes = NULL,
E = 3,
k = E + 2,
tau = 1,
style = 1,
stack = FALSE,
lib = NULL,
pred = NULL,
dist.metric = "L2",
dist.average = TRUE,
theta = 1,
algorithm = "simplex",
threads = detectThreads(),
detrend = TRUE,
parallel.level = "low",
bidirectional = TRUE,
progressbar = TRUE,
nb = NULL
)# S4 method for SpatRaster
gccm(
data,
cause,
effect,
libsizes = NULL,
E = 3,
k = E + 2,
tau = 1,
style = 1,
stack = FALSE,
lib = NULL,
pred = NULL,
dist.metric = "L2",
dist.average = TRUE,
theta = 1,
algorithm = "simplex",
threads = detectThreads(),
detrend = TRUE,
parallel.level = "low",
bidirectional = TRUE,
progressbar = TRUE,
grid.coord = TRUE,
embed.direction = 0,
win.ratio = 0
)
A list
xmapcross mapping results
varnamenames of causal and effect variables
bidirectionalwhether to examine bidirectional causality
observation data.
name of causal variable.
name of effect variable.
(optional) number of spatial units used (input needed: vector - spatial vector, matrix - spatial raster).
(optional) embedding dimensions.
(optional) number of nearest neighbors.
(optional) step of spatial lags.
(optional) embedding style (0 includes current state, 1 excludes it).
(optional) whether to stack embeddings.
(optional) libraries indices (input requirement same as libsizes).
(optional) predictions indices (input requirement same as libsizes).
(optional) distance metric (L1: Manhattan, L2: Euclidean).
(optional) whether to average distance.
(optional) weighting parameter for distances, useful when algorithm is smap.
(optional) prediction algorithm.
(optional) number of threads to use.
(optional) whether to remove the linear trend.
(optional) level of parallelism, low or high.
(optional) whether to examine bidirectional causality.
(optional) whether to show the progress bar.
(optional) neighbours list.
(optional) whether to detrend using cell center coordinates (TRUE) or row/column numbers (FALSE).
(optional) direction selector for embeddings (0 returns all directions, 1-8 correspond to NW, N, NE, W, E, SW, S, SE).
(optional) ratio of sliding window scale to speed up state-space predictions.
Gao, B., Yang, J., Chen, Z. et al. Causal inference from cross-sectional earth system data with geographical convergent cross mapping. Nat Commun 14, 5875 (2023).
columbus = sf::read_sf(system.file("case/columbus.gpkg",package="spEDM"))
# \donttest{
g = gccm(columbus,"hoval","crime",libsizes = seq(5,45,5),E = 6)
g
plot(g,ylimits = c(0,0.85))
# }
Run the code above in your browser using DataLab