geographical pattern causality
# S4 method for sf
gpc(
data,
cause,
effect,
libsizes = NULL,
E = 3,
k = E + 2,
tau = 1,
style = 1,
lib = NULL,
pred = NULL,
boot = 99,
random = TRUE,
seed = 42,
dist.metric = "L2",
zero.tolerance = k,
relative = TRUE,
weighted = TRUE,
threads = detectThreads(),
detrend = FALSE,
parallel.level = "low",
bidirectional = TRUE,
progressbar = TRUE,
nb = NULL
)# S4 method for SpatRaster
gpc(
data,
cause,
effect,
libsizes = NULL,
E = 3,
k = E + 2,
tau = 1,
style = 1,
lib = NULL,
pred = NULL,
boot = 99,
random = TRUE,
seed = 42,
dist.metric = "L2",
zero.tolerance = k,
relative = TRUE,
weighted = TRUE,
threads = detectThreads(),
detrend = FALSE,
parallel.level = "low",
bidirectional = TRUE,
progressbar = TRUE,
grid.coord = TRUE
)
A list
xmapcross mapping results (only present if libsizes is not NULL)
causalityper-sample causality statistics (present if libsizes is NULL)
summaryoverall causal strength (present if libsizes is NULL)
patternpairwise pattern relationships (present if libsizes is NULL)
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) libraries indices (input requirement same as libsizes).
(optional) predictions indices (input requirement same as libsizes).
(optional) number of bootstraps to perform.
(optional) whether to use random sampling.
(optional) random seed.
(optional) distance metric (L1: Manhattan, L2: Euclidean).
(optional) maximum number of zeros tolerated in signature space.
(optional) whether to calculate relative changes in embeddings.
(optional) whether to weight causal strength.
(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).
Zhang, Z., Wang, J., 2025. A model to identify causality for geographic patterns. International Journal of Geographical Information Science 1–21.
columbus = sf::read_sf(system.file("case/columbus.gpkg",package="spEDM"))
# \donttest{
gpc(columbus,"hoval","crime",E = 6,k = 9)
# convergence diagnostics
g = gpc(columbus,"hoval","crime",libsizes = seq(5,45,5),E = 6,k = 9)
plot(g)
# }
Run the code above in your browser using DataLab