Skip to contents

spatial granger causality test

Usage

# S4 method for class 'sf'
sgc(
  data,
  cause,
  effect,
  k,
  block = 3,
  boot = 399,
  seed = 42,
  base = 2,
  lib = NULL,
  pred = NULL,
  nb = NULL,
  threads = detectThreads(),
  trend.rm = TRUE,
  normalize = FALSE,
  progressbar = FALSE
)

# S4 method for class 'SpatRaster'
sgc(
  data,
  cause,
  effect,
  k,
  block = 3,
  boot = 399,
  seed = 42,
  base = 2,
  lib = NULL,
  pred = NULL,
  threads = detectThreads(),
  trend.rm = TRUE,
  normalize = FALSE,
  progressbar = FALSE
)

Arguments

data

The observation data.

cause

Name of causal variable.

effect

Name of effect variable.

k

(optional) Number of nearest neighbors used in symbolization.

block

(optional) Number of blocks used in spatial block bootstrap.

boot

(optional) Number of bootstraps to perform.

seed

(optional) The random seed.

base

(optional) Base of the logarithm.

lib

(optional) Libraries indices.

pred

(optional) Predictions indices.

nb

(optional) The neighbours list.

threads

(optional) Number of threads.

trend.rm

(optional) Whether to remove the linear trend.

normalize

(optional) Whether to normalize the result.

progressbar

(optional) Whether to show the progress bar.

Value

A list

sc

statistic for spatial causality

varname

names of causal and effect variable

References

Herrera, M., Mur, J., & Ruiz, M. (2016). Detecting causal relationships between spatial processes. Papers in Regional Science, 95(3), 577–595.

Examples

columbus = sf::read_sf(system.file("case/columbus.gpkg", package="spEDM"))
# \donttest{
sgc(columbus,"hoval","crime", k = 15)
#> spatial granger causality test
#> hoval -> crime: statistic = 1.114, p value = 0.539
#> crime -> hoval: statistic = 1.555, p value = 0.005
# }