diff --git a/news/index.html b/news/index.html
index c6fecff..310d464 100644
--- a/news/index.html
+++ b/news/index.html
@@ -40,6 +40,7 @@
spEDM 1.2#72).
Add options for tau
, k
, and progressbar
in gccm
(#69).
Add print
and plot
s3 methods for gccm
result (#64).
+Require sdsfun
package version 0.7.0
or higher (#61).
spEDM 1.1
CRAN release: 2024-12-19
diff --git a/pkgdown.yml b/pkgdown.yml
index 52fc4ff..dfccc91 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -3,7 +3,7 @@ pkgdown: 2.1.1
pkgdown_sha: ~
articles:
GCCM: GCCM.html
-last_built: 2025-01-11T05:46Z
+last_built: 2025-01-14T04:06Z
urls:
reference: https://stscl.github.io/spEDM/reference
article: https://stscl.github.io/spEDM/articles
diff --git a/search.json b/search.json
index 6ca19e6..c05d11b 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"the-principle-of-geographical-convergent-cross-mapping-gccm","dir":"Articles","previous_headings":"","what":"1. The principle of geographical convergent cross mapping (GCCM)","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Takens’ theory proves , dynamic system \\(\\phi\\), trajectory converges attractor manifold \\(M\\), consisted bounded invariant set states, mapping \\(\\phi\\) M can built time series observations \\(\\phi\\) can used construct \\(M\\). According generalized embedding theorem, compact \\(d\\)-dimensional manifold \\(M\\) set observation functions \\(\\left
\\), map \\(\\psi_{\\phi,h} = \\left\\) embedding \\(M\\) \\(L = 2d + 1\\). embedding means one--one map resolving singularities original manifold. elements \\(h_i\\) can lags observations single time series observations, lags observations multiple time series, multiple observation functions. first two constructions special cases third one. taking measured values one specific unit neighbors (named spatial lags spatial statistics) set observation functions, \\(\\psi_{\\phi,h} \\left(x,s\\right) = \\left\\) embedding, \\(s\\) focal unit currently investigation \\(s\\left(\\right)\\) \\(\\)-th order spatial lags. \\(h_s\\left(x\\right)\\) \\(h_{s\\left(\\right)}\\left(x\\right)\\) observation functions respectively. (Hereinafter, use \\(\\psi \\left(x,s\\right)\\) present \\(\\psi_{\\phi,h} \\left(x,s\\right)\\) short). two spatial variables \\(X\\) \\(Y\\) set spatial units, values spatial lags can regarded observation functions reading values spatial unit. spatial lags order contain one spatial units, observation function can set mean spatial units summary functions considering spatial direction, assure one--one mapping original manifold \\(M\\). cross-mapping prediction defined : \\[ \\hat{Y}_s \\mid M_x = \\sum\\limits_{=1}^{L+1} \\left(\\omega_{si}Y_{si} \\mid M_x \\right) \\] \\(s\\) represents spatial unit value \\(Y\\) needs predicted, \\(\\hat{Y}_s\\) prediction result, \\(L\\) number dimensions embedding, \\(si\\) spatial unit used prediction, \\(Y_{si}\\) observation value \\(si\\) simultaneously first component state \\(M_y\\), noted \\(\\psi\\left(y,s_i\\right)\\). , \\(\\psi\\left(y,s_i\\right)\\) determined one--one mapping point \\(\\psi\\left(x,s_i\\right)\\), turn one \\(L+1\\) nearest neighbors focal state \\(M_x\\). \\(\\omega_{si}\\) corresponding weight defined : \\[ \\omega_{si} \\mid M_x = \\frac{weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)}{\\sum_{=1}^{L+1}weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)} \\] \\(weight \\left(\\ast,\\ast\\right)\\) weight function two states shadow manifold, defined : \\[ weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right) = \\exp \\left(- \\frac{dis \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)}{dis \\left(\\psi\\left(x,s_1\\right),\\psi\\left(x,s\\right)\\right)} \\right) \\] \\(\\exp\\) exponential function \\(dis \\left(\\ast,\\ast\\right)\\) represents distance function two states shadow manifold defined : \\[ dis \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right) = \\frac{1}{L} \\left(\\left|h_{si}\\left(x\\right)-h_{s}\\left(x\\right)\\right| + \\sum_{k=1}^{L-1}abs \\left[h_{si\\left(k\\right)}\\left(x\\right),h_{s\\left(k\\right)}\\left(x\\right)\\right]\\right) \\] Note absolute value distance used . skill cross-mapping prediction measured Pearson correlation coefficient true observations corresponding predictions: \\[ \\rho = \\frac{Cov\\left(Y,\\hat{Y}\\right)}{\\sqrt{Var\\left(Y\\right) Var\\left(\\hat{Y}\\right)}} \\] prediction skill \\(\\rho\\) varies setting different sizes libraries, means quantity observations used reconstruction shadow manifold. can use convergence \\(\\rho\\) infer causal associations. GCCM, convergence means \\(\\rho\\) increases size libraries statistically significant library becomes largest. confidence interval \\(\\rho\\) can estimated based \\(z\\)-statistics normal distribution: \\[ t = \\rho \\sqrt{\\frac{n-2}{1-\\rho^2}} \\] \\(n\\) number observations predicted, \\[ z = \\frac{1}{2} \\ln \\left(\\frac{1+\\rho}{1-\\rho}\\right) \\]","code":""},{"path":[]},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"install-the-spedm-package","dir":"Articles","previous_headings":"2. Examples","what":"2.1 Install the spEDM package","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load spEDM package:","code":"install.packages(\"spEDM\", dep = TRUE) library(spEDM)"},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"an-example-of-lattice-data-about-county-level-population-density","dir":"Articles","previous_headings":"2. Examples","what":"2.2 An example of lattice data about county-level population density","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load data package: Run GCCM: Visualize result:","code":"popd_nb = spdep::read.gal(system.file(\"extdata/popdensity_nb.gal\", package = \"spEDM\")) ## Warning in spdep::read.gal(system.file(\"extdata/popdensity_nb.gal\", package = \"spEDM\")): ## neighbour object has 4 sub-graphs popd_nb ## Neighbour list object: ## Number of regions: 2806 ## Number of nonzero links: 15942 ## Percentage nonzero weights: 0.2024732 ## Average number of links: 5.681397 ## 4 disjoint connected subgraphs popdensity = readr::read_csv(system.file(\"extdata/popdensity.csv\", package = \"spEDM\")) ## Rows: 2806 Columns: 7 ## ── Column specification ─────────────────────────────────────────────────────────────────────── ## Delimiter: \",\" ## dbl (7): x, y, popDensity, DEM, Tem, Pre, slop ## ## ℹ Use `spec()` to retrieve the full column specification for this data. ## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. popdensity ## # A tibble: 2,806 × 7 ## x y popDensity DEM Tem Pre slop ## ## 1 117. 30.5 780. 8 17.4 1528. 0.452 ## 2 117. 30.6 395. 48 17.2 1487. 0.842 ## 3 117. 30.8 261. 49 16.0 1456. 3.56 ## 4 116. 30.1 258. 23 17.4 1555. 0.932 ## 5 116. 30.5 211. 101 16.3 1494. 3.34 ## 6 117. 31.0 386. 10 16.6 1382. 1.65 ## 7 117. 30.2 350. 23 17.5 1569. 0.346 ## 8 117. 30.7 470. 22 17.1 1493. 1.88 ## 9 117. 30.6 1226. 11 17.4 1526. 0.208 ## 10 116. 30.9 137. 598 13.9 1458. 5.92 ## # ℹ 2,796 more rows popd_sf = sf::st_as_sf(popdensity, coords = c(\"x\",\"y\"), crs = 4326) popd_sf ## Simple feature collection with 2806 features and 5 fields ## Geometry type: POINT ## Dimension: XY ## Bounding box: xmin: 74.9055 ymin: 18.2698 xmax: 134.269 ymax: 52.9346 ## Geodetic CRS: WGS 84 ## # A tibble: 2,806 × 6 ## popDensity DEM Tem Pre slop geometry ## * ## 1 780. 8 17.4 1528. 0.452 (116.912 30.4879) ## 2 395. 48 17.2 1487. 0.842 (116.755 30.5877) ## 3 261. 49 16.0 1456. 3.56 (116.541 30.7548) ## 4 258. 23 17.4 1555. 0.932 (116.241 30.104) ## 5 211. 101 16.3 1494. 3.34 (116.173 30.495) ## 6 386. 10 16.6 1382. 1.65 (116.935 30.9839) ## 7 350. 23 17.5 1569. 0.346 (116.677 30.2412) ## 8 470. 22 17.1 1493. 1.88 (117.066 30.6514) ## 9 1226. 11 17.4 1526. 0.208 (117.171 30.5558) ## 10 137. 598 13.9 1458. 5.92 (116.208 30.8983) ## # ℹ 2,796 more rows startTime = Sys.time() pd_res = gccm(data = popd_sf, cause = \"Pre\", effect = \"popDensity\", libsizes = seq(10, 2800, by = 100), E = 3, k = 4, nb = popd_nb, progressbar = FALSE) endTime = Sys.time() print(difftime(endTime,startTime, units =\"mins\")) ## Time difference of 19.59433 mins pd_res ## libsizes popDensity->Pre Pre->popDensity ## 1 10 0.01130395 0.06607465 ## 2 110 0.03306905 0.22689926 ## 3 210 0.04821180 0.28196395 ## 4 310 0.06475999 0.30785228 ## 5 410 0.07922017 0.33124862 ## 6 510 0.09428975 0.36226576 ## 7 610 0.10951603 0.39693375 ## 8 710 0.12249230 0.42302102 ## 9 810 0.13594244 0.44164444 ## 10 910 0.14767067 0.45689198 ## 11 1010 0.15863133 0.46853529 ## 12 1110 0.16852300 0.47657811 ## 13 1210 0.17808456 0.48683486 ## 14 1310 0.18761109 0.49750321 ## 15 1410 0.19697038 0.50708625 ## 16 1510 0.20507772 0.51660029 ## 17 1610 0.21264081 0.52744922 ## 18 1710 0.21969130 0.53845530 ## 19 1810 0.22618694 0.54912681 ## 20 1910 0.23207300 0.55982092 ## 21 2010 0.23780738 0.57043510 ## 22 2110 0.24300452 0.58089481 ## 23 2210 0.24773394 0.59104138 ## 24 2310 0.25208726 0.60092354 ## 25 2410 0.25628422 0.61050007 ## 26 2510 0.26039117 0.62015838 ## 27 2610 0.26436854 0.62986485 ## 28 2710 0.26826114 0.63868014 plot(pd_res,xlimits = c(0, 2800))"},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"an-example-of-grid-data-about-farmland-npp","dir":"Articles","previous_headings":"2. Examples","what":"2.3 An example of grid data about farmland NPP","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load data package: save computation time, aggregate data 3 times select 3000 non-NA pixels predict: Run GCCM: Visualize result:","code":"npp = terra::rast(system.file(\"extdata/npp.tif\", package = \"spEDM\")) npp ## class : SpatRaster ## dimensions : 404, 483, 3 (nrow, ncol, nlyr) ## resolution : 10000, 10000 (x, y) ## extent : -2625763, 2204237, 1877078, 5917078 (xmin, xmax, ymin, ymax) ## coord. ref. : CGCS2000_Albers ## source : npp.tif ## names : npp, pre, tem ## min values : 164.00, 384.3409, -47.8194 ## max values : 16606.33, 23878.3555, 263.6938 terra::plot(npp, nc = 3, mar = rep(0.1,4), oma = rep(0.1,4), axes = FALSE, legend = FALSE) npp = terra::aggregate(npp, fact = 3, na.rm = TRUE) terra::global(npp,\"isNA\") ## isNA ## npp 14815 ## pre 14766 ## tem 14766 terra::ncell(npp) ## [1] 21735 namat = terra::as.matrix(!is.na(npp[[1]]), wide = TRUE) pred = terra::rowColFromCell(npp,which(namat)) dim(pred) ## [1] 6920 2 set.seed(42) indices = sample(nrow(pred), size = 3000, replace = FALSE) pred = pred[indices,] startTime = Sys.time() npp_res = gccm(data = npp, cause = \"pre\", effect = \"npp\", libsizes = seq(10,130,5), E = 2, k = 5, RowCol = pred, progressbar = FALSE) endTime = Sys.time() print(difftime(endTime,startTime, units =\"mins\")) ## Time difference of 24.49013 mins npp_res ## libsizes npp->pre pre->npp ## 1 10 0.049237491 0.07312462 ## 2 15 0.063939456 0.10307461 ## 3 20 0.080009483 0.12935898 ## 4 25 0.097903289 0.14718470 ## 5 30 0.104758061 0.15943448 ## 6 35 0.111686523 0.17026742 ## 7 40 0.119169359 0.18985868 ## 8 45 0.132677547 0.21607528 ## 9 50 0.148968939 0.24764600 ## 10 55 0.165193950 0.28759045 ## 11 60 0.173868473 0.30697776 ## 12 65 0.179777011 0.31209341 ## 13 70 0.157231842 0.28574340 ## 14 75 0.108711472 0.24817243 ## 15 80 0.058977718 0.22701677 ## 16 85 -0.003501071 0.23364337 ## 17 90 -0.022853416 0.23577169 ## 18 95 -0.042780283 0.34364441 ## 19 100 -0.034298266 0.72561637 ## 20 105 -0.070605553 0.77999128 plot(npp_res,xlimits = c(9, 101),ylimits = c(-0.05,1)) ## Warning: Removed 1 row containing missing values or values outside the scale range (`geom_line()`). ## Removed 1 row containing missing values or values outside the scale range (`geom_line()`)."},{"path":"https://stscl.github.io/spEDM/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Wenbo Lv. Author, maintainer, copyright holder.","code":""},{"path":"https://stscl.github.io/spEDM/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lv W (2025). spEDM: Spatial Empirical Dynamic Modeling. R package version 1.2, https://github.com/stscl/spEDM, https://stscl.github.io/spEDM/.","code":"@Manual{, title = {spEDM: Spatial Empirical Dynamic Modeling}, author = {Wenbo Lv}, year = {2025}, note = {R package version 1.2, https://github.com/stscl/spEDM}, url = {https://stscl.github.io/spEDM/}, }"},{"path":"https://stscl.github.io/spEDM/index.html","id":"spedm-","dir":"","previous_headings":"","what":"spEDM | Spatial Empirical Dynamic Modeling\n","title":"spEDM | Spatial Empirical Dynamic Modeling\n","text":"Spatial Empirical Dynamic Modeling","code":""},{"path":"https://stscl.github.io/spEDM/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"spEDM | Spatial Empirical Dynamic Modeling\n","text":"Install CRAN : Install binary version R-universe : Install source code GitHub :","code":"install.packages(\"spEDM\", dep = TRUE) install.packages(\"spEDM\", repos = c(\"https://stscl.r-universe.dev\", \"https://cloud.r-project.org\"), dep = TRUE) if (!requireNamespace(\"devtools\")) { install.packages(\"devtools\") } devtools::install_github(\"stscl/spEDM\", build_vignettes = TRUE, dep = TRUE)"},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":null,"dir":"Reference","previous_headings":"","what":"geographical convergent cross mapping — gccm","title":"geographical convergent cross mapping — gccm","text":"geographical convergent cross mapping","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"geographical convergent cross mapping — gccm","text":"","code":"# S4 method for class 'sf' gccm( data, cause, effect, libsizes, E = 3, tau = 1, k = E + 1, nb = NULL, trendRM = TRUE, progressbar = TRUE ) # S4 method for class 'SpatRaster' gccm( data, cause, effect, libsizes, E = 3, tau = 1, k = E + 3, RowCol = NULL, trendRM = TRUE, progressbar = TRUE )"},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"geographical convergent cross mapping — gccm","text":"data observation data. cause Name causal variable. effect Name effect variable. libsizes vector library sizes use. E (optional) dimensions embedding. tau (optional) step spatial lags. k (optional) Number nearest neighbors use prediction. nb (optional) neighbours list. trendRM (optional) Whether remove linear trend. progressbar (optional) whether print progress bar. RowCol (optional) Matrix selected row cols numbers.","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"geographical convergent cross mapping — gccm","text":"list. xmap cross-mapping prediction outputs varname names causal effect variable","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"geographical convergent cross mapping — gccm","text":"","code":"columbus = sf::read_sf(system.file(\"shapes/columbus.gpkg\", package=\"spData\")[1], quiet=TRUE) # \\donttest{ g = gccm(columbus, \"HOVAL\", \"CRIME\", libsizes = seq(5,45,5)) #> Computing: [========================================] 100% (done) #> Computing: [========================================] 100% (done) g #> libsizes CRIME->HOVAL HOVAL->CRIME #> 1 5 0.08036917 0.2360232 #> 2 10 0.11368175 0.3207803 #> 3 15 0.08758561 0.3509119 #> 4 20 0.10310575 0.3638976 #> 5 25 0.11585893 0.3814201 #> 6 30 0.12976658 0.4063601 #> 7 35 0.14387488 0.4355102 #> 8 40 0.15749070 0.4612822 #> 9 45 0.19913895 0.4838568 plot(g, ylimits = c(0,0.65)) # }"},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-12","dir":"Changelog","previous_headings":"","what":"spEDM 1.2","title":"spEDM 1.2","text":"Encapsulate gccm function using S4 class (#72). Add options tau, k, progressbar gccm (#69). Add print plot s3 methods gccm result (#64).","code":""},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-11","dir":"Changelog","previous_headings":"","what":"spEDM 1.1","title":"spEDM 1.1","text":"CRAN release: 2024-12-19 Resolve CRAN auto check issues, significant API changes.","code":""},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-10","dir":"Changelog","previous_headings":"","what":"spEDM 1.0","title":"spEDM 1.0","text":"CRAN release: 2024-12-16 Implementing GCCM method spatial lattice grid data using pure C++11.","code":""}]
+[{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"the-principle-of-geographical-convergent-cross-mapping-gccm","dir":"Articles","previous_headings":"","what":"1. The principle of geographical convergent cross mapping (GCCM)","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Takens’ theory proves , dynamic system \\(\\phi\\), trajectory converges attractor manifold \\(M\\), consisted bounded invariant set states, mapping \\(\\phi\\) M can built time series observations \\(\\phi\\) can used construct \\(M\\). According generalized embedding theorem, compact \\(d\\)-dimensional manifold \\(M\\) set observation functions \\(\\left\\), map \\(\\psi_{\\phi,h} = \\left\\) embedding \\(M\\) \\(L = 2d + 1\\). embedding means one--one map resolving singularities original manifold. elements \\(h_i\\) can lags observations single time series observations, lags observations multiple time series, multiple observation functions. first two constructions special cases third one. taking measured values one specific unit neighbors (named spatial lags spatial statistics) set observation functions, \\(\\psi_{\\phi,h} \\left(x,s\\right) = \\left\\) embedding, \\(s\\) focal unit currently investigation \\(s\\left(\\right)\\) \\(\\)-th order spatial lags. \\(h_s\\left(x\\right)\\) \\(h_{s\\left(\\right)}\\left(x\\right)\\) observation functions respectively. (Hereinafter, use \\(\\psi \\left(x,s\\right)\\) present \\(\\psi_{\\phi,h} \\left(x,s\\right)\\) short). two spatial variables \\(X\\) \\(Y\\) set spatial units, values spatial lags can regarded observation functions reading values spatial unit. spatial lags order contain one spatial units, observation function can set mean spatial units summary functions considering spatial direction, assure one--one mapping original manifold \\(M\\). cross-mapping prediction defined : \\[ \\hat{Y}_s \\mid M_x = \\sum\\limits_{=1}^{L+1} \\left(\\omega_{si}Y_{si} \\mid M_x \\right) \\] \\(s\\) represents spatial unit value \\(Y\\) needs predicted, \\(\\hat{Y}_s\\) prediction result, \\(L\\) number dimensions embedding, \\(si\\) spatial unit used prediction, \\(Y_{si}\\) observation value \\(si\\) simultaneously first component state \\(M_y\\), noted \\(\\psi\\left(y,s_i\\right)\\). , \\(\\psi\\left(y,s_i\\right)\\) determined one--one mapping point \\(\\psi\\left(x,s_i\\right)\\), turn one \\(L+1\\) nearest neighbors focal state \\(M_x\\). \\(\\omega_{si}\\) corresponding weight defined : \\[ \\omega_{si} \\mid M_x = \\frac{weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)}{\\sum_{=1}^{L+1}weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)} \\] \\(weight \\left(\\ast,\\ast\\right)\\) weight function two states shadow manifold, defined : \\[ weight \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right) = \\exp \\left(- \\frac{dis \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right)}{dis \\left(\\psi\\left(x,s_1\\right),\\psi\\left(x,s\\right)\\right)} \\right) \\] \\(\\exp\\) exponential function \\(dis \\left(\\ast,\\ast\\right)\\) represents distance function two states shadow manifold defined : \\[ dis \\left(\\psi\\left(x,s_i\\right),\\psi\\left(x,s\\right)\\right) = \\frac{1}{L} \\left(\\left|h_{si}\\left(x\\right)-h_{s}\\left(x\\right)\\right| + \\sum_{k=1}^{L-1}abs \\left[h_{si\\left(k\\right)}\\left(x\\right),h_{s\\left(k\\right)}\\left(x\\right)\\right]\\right) \\] Note absolute value distance used . skill cross-mapping prediction measured Pearson correlation coefficient true observations corresponding predictions: \\[ \\rho = \\frac{Cov\\left(Y,\\hat{Y}\\right)}{\\sqrt{Var\\left(Y\\right) Var\\left(\\hat{Y}\\right)}} \\] prediction skill \\(\\rho\\) varies setting different sizes libraries, means quantity observations used reconstruction shadow manifold. can use convergence \\(\\rho\\) infer causal associations. GCCM, convergence means \\(\\rho\\) increases size libraries statistically significant library becomes largest. confidence interval \\(\\rho\\) can estimated based \\(z\\)-statistics normal distribution: \\[ t = \\rho \\sqrt{\\frac{n-2}{1-\\rho^2}} \\] \\(n\\) number observations predicted, \\[ z = \\frac{1}{2} \\ln \\left(\\frac{1+\\rho}{1-\\rho}\\right) \\]","code":""},{"path":[]},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"install-the-spedm-package","dir":"Articles","previous_headings":"2. Examples","what":"2.1 Install the spEDM package","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load spEDM package:","code":"install.packages(\"spEDM\", dep = TRUE) library(spEDM)"},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"an-example-of-lattice-data-about-county-level-population-density","dir":"Articles","previous_headings":"2. Examples","what":"2.2 An example of lattice data about county-level population density","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load data package: Run GCCM: Visualize result:","code":"popd_nb = spdep::read.gal(system.file(\"extdata/popdensity_nb.gal\", package = \"spEDM\")) ## Warning in spdep::read.gal(system.file(\"extdata/popdensity_nb.gal\", package = \"spEDM\")): ## neighbour object has 4 sub-graphs popd_nb ## Neighbour list object: ## Number of regions: 2806 ## Number of nonzero links: 15942 ## Percentage nonzero weights: 0.2024732 ## Average number of links: 5.681397 ## 4 disjoint connected subgraphs popdensity = readr::read_csv(system.file(\"extdata/popdensity.csv\", package = \"spEDM\")) ## Rows: 2806 Columns: 7 ## ── Column specification ─────────────────────────────────────────────────────────────────────── ## Delimiter: \",\" ## dbl (7): x, y, popDensity, DEM, Tem, Pre, slop ## ## ℹ Use `spec()` to retrieve the full column specification for this data. ## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. popdensity ## # A tibble: 2,806 × 7 ## x y popDensity DEM Tem Pre slop ## ## 1 117. 30.5 780. 8 17.4 1528. 0.452 ## 2 117. 30.6 395. 48 17.2 1487. 0.842 ## 3 117. 30.8 261. 49 16.0 1456. 3.56 ## 4 116. 30.1 258. 23 17.4 1555. 0.932 ## 5 116. 30.5 211. 101 16.3 1494. 3.34 ## 6 117. 31.0 386. 10 16.6 1382. 1.65 ## 7 117. 30.2 350. 23 17.5 1569. 0.346 ## 8 117. 30.7 470. 22 17.1 1493. 1.88 ## 9 117. 30.6 1226. 11 17.4 1526. 0.208 ## 10 116. 30.9 137. 598 13.9 1458. 5.92 ## # ℹ 2,796 more rows popd_sf = sf::st_as_sf(popdensity, coords = c(\"x\",\"y\"), crs = 4326) popd_sf ## Simple feature collection with 2806 features and 5 fields ## Geometry type: POINT ## Dimension: XY ## Bounding box: xmin: 74.9055 ymin: 18.2698 xmax: 134.269 ymax: 52.9346 ## Geodetic CRS: WGS 84 ## # A tibble: 2,806 × 6 ## popDensity DEM Tem Pre slop geometry ## * ## 1 780. 8 17.4 1528. 0.452 (116.912 30.4879) ## 2 395. 48 17.2 1487. 0.842 (116.755 30.5877) ## 3 261. 49 16.0 1456. 3.56 (116.541 30.7548) ## 4 258. 23 17.4 1555. 0.932 (116.241 30.104) ## 5 211. 101 16.3 1494. 3.34 (116.173 30.495) ## 6 386. 10 16.6 1382. 1.65 (116.935 30.9839) ## 7 350. 23 17.5 1569. 0.346 (116.677 30.2412) ## 8 470. 22 17.1 1493. 1.88 (117.066 30.6514) ## 9 1226. 11 17.4 1526. 0.208 (117.171 30.5558) ## 10 137. 598 13.9 1458. 5.92 (116.208 30.8983) ## # ℹ 2,796 more rows startTime = Sys.time() pd_res = gccm(data = popd_sf, cause = \"Pre\", effect = \"popDensity\", libsizes = seq(10, 2800, by = 100), E = 3, k = 4, nb = popd_nb, progressbar = FALSE) endTime = Sys.time() print(difftime(endTime,startTime, units =\"mins\")) ## Time difference of 19.59433 mins pd_res ## libsizes popDensity->Pre Pre->popDensity ## 1 10 0.01130395 0.06607465 ## 2 110 0.03306905 0.22689926 ## 3 210 0.04821180 0.28196395 ## 4 310 0.06475999 0.30785228 ## 5 410 0.07922017 0.33124862 ## 6 510 0.09428975 0.36226576 ## 7 610 0.10951603 0.39693375 ## 8 710 0.12249230 0.42302102 ## 9 810 0.13594244 0.44164444 ## 10 910 0.14767067 0.45689198 ## 11 1010 0.15863133 0.46853529 ## 12 1110 0.16852300 0.47657811 ## 13 1210 0.17808456 0.48683486 ## 14 1310 0.18761109 0.49750321 ## 15 1410 0.19697038 0.50708625 ## 16 1510 0.20507772 0.51660029 ## 17 1610 0.21264081 0.52744922 ## 18 1710 0.21969130 0.53845530 ## 19 1810 0.22618694 0.54912681 ## 20 1910 0.23207300 0.55982092 ## 21 2010 0.23780738 0.57043510 ## 22 2110 0.24300452 0.58089481 ## 23 2210 0.24773394 0.59104138 ## 24 2310 0.25208726 0.60092354 ## 25 2410 0.25628422 0.61050007 ## 26 2510 0.26039117 0.62015838 ## 27 2610 0.26436854 0.62986485 ## 28 2710 0.26826114 0.63868014 plot(pd_res,xlimits = c(0, 2800))"},{"path":"https://stscl.github.io/spEDM/articles/GCCM.html","id":"an-example-of-grid-data-about-farmland-npp","dir":"Articles","previous_headings":"2. Examples","what":"2.3 An example of grid data about farmland NPP","title":"Geographical Convergent Cross Mapping (GCCM)","text":"Load data package: save computation time, aggregate data 3 times select 3000 non-NA pixels predict: Run GCCM: Visualize result:","code":"npp = terra::rast(system.file(\"extdata/npp.tif\", package = \"spEDM\")) npp ## class : SpatRaster ## dimensions : 404, 483, 3 (nrow, ncol, nlyr) ## resolution : 10000, 10000 (x, y) ## extent : -2625763, 2204237, 1877078, 5917078 (xmin, xmax, ymin, ymax) ## coord. ref. : CGCS2000_Albers ## source : npp.tif ## names : npp, pre, tem ## min values : 164.00, 384.3409, -47.8194 ## max values : 16606.33, 23878.3555, 263.6938 terra::plot(npp, nc = 3, mar = rep(0.1,4), oma = rep(0.1,4), axes = FALSE, legend = FALSE) npp = terra::aggregate(npp, fact = 3, na.rm = TRUE) terra::global(npp,\"isNA\") ## isNA ## npp 14815 ## pre 14766 ## tem 14766 terra::ncell(npp) ## [1] 21735 namat = terra::as.matrix(!is.na(npp[[1]]), wide = TRUE) pred = terra::rowColFromCell(npp,which(namat)) dim(pred) ## [1] 6920 2 set.seed(42) indices = sample(nrow(pred), size = 3000, replace = FALSE) pred = pred[indices,] startTime = Sys.time() npp_res = gccm(data = npp, cause = \"pre\", effect = \"npp\", libsizes = seq(10,130,5), E = 2, k = 5, RowCol = pred, progressbar = FALSE) endTime = Sys.time() print(difftime(endTime,startTime, units =\"mins\")) ## Time difference of 24.49013 mins npp_res ## libsizes npp->pre pre->npp ## 1 10 0.049237491 0.07312462 ## 2 15 0.063939456 0.10307461 ## 3 20 0.080009483 0.12935898 ## 4 25 0.097903289 0.14718470 ## 5 30 0.104758061 0.15943448 ## 6 35 0.111686523 0.17026742 ## 7 40 0.119169359 0.18985868 ## 8 45 0.132677547 0.21607528 ## 9 50 0.148968939 0.24764600 ## 10 55 0.165193950 0.28759045 ## 11 60 0.173868473 0.30697776 ## 12 65 0.179777011 0.31209341 ## 13 70 0.157231842 0.28574340 ## 14 75 0.108711472 0.24817243 ## 15 80 0.058977718 0.22701677 ## 16 85 -0.003501071 0.23364337 ## 17 90 -0.022853416 0.23577169 ## 18 95 -0.042780283 0.34364441 ## 19 100 -0.034298266 0.72561637 ## 20 105 -0.070605553 0.77999128 plot(npp_res,xlimits = c(9, 101),ylimits = c(-0.05,1)) ## Warning: Removed 1 row containing missing values or values outside the scale range (`geom_line()`). ## Removed 1 row containing missing values or values outside the scale range (`geom_line()`)."},{"path":"https://stscl.github.io/spEDM/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Wenbo Lv. Author, maintainer, copyright holder.","code":""},{"path":"https://stscl.github.io/spEDM/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lv W (2025). spEDM: Spatial Empirical Dynamic Modeling. R package version 1.2, https://github.com/stscl/spEDM, https://stscl.github.io/spEDM/.","code":"@Manual{, title = {spEDM: Spatial Empirical Dynamic Modeling}, author = {Wenbo Lv}, year = {2025}, note = {R package version 1.2, https://github.com/stscl/spEDM}, url = {https://stscl.github.io/spEDM/}, }"},{"path":"https://stscl.github.io/spEDM/index.html","id":"spedm-","dir":"","previous_headings":"","what":"spEDM | Spatial Empirical Dynamic Modeling\n","title":"spEDM | Spatial Empirical Dynamic Modeling\n","text":"Spatial Empirical Dynamic Modeling","code":""},{"path":"https://stscl.github.io/spEDM/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"spEDM | Spatial Empirical Dynamic Modeling\n","text":"Install CRAN : Install binary version R-universe : Install source code GitHub :","code":"install.packages(\"spEDM\", dep = TRUE) install.packages(\"spEDM\", repos = c(\"https://stscl.r-universe.dev\", \"https://cloud.r-project.org\"), dep = TRUE) if (!requireNamespace(\"devtools\")) { install.packages(\"devtools\") } devtools::install_github(\"stscl/spEDM\", build_vignettes = TRUE, dep = TRUE)"},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":null,"dir":"Reference","previous_headings":"","what":"geographical convergent cross mapping — gccm","title":"geographical convergent cross mapping — gccm","text":"geographical convergent cross mapping","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"geographical convergent cross mapping — gccm","text":"","code":"# S4 method for class 'sf' gccm( data, cause, effect, libsizes, E = 3, tau = 1, k = E + 1, nb = NULL, trendRM = TRUE, progressbar = TRUE ) # S4 method for class 'SpatRaster' gccm( data, cause, effect, libsizes, E = 3, tau = 1, k = E + 3, RowCol = NULL, trendRM = TRUE, progressbar = TRUE )"},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"geographical convergent cross mapping — gccm","text":"data observation data. cause Name causal variable. effect Name effect variable. libsizes vector library sizes use. E (optional) dimensions embedding. tau (optional) step spatial lags. k (optional) Number nearest neighbors use prediction. nb (optional) neighbours list. trendRM (optional) Whether remove linear trend. progressbar (optional) whether print progress bar. RowCol (optional) Matrix selected row cols numbers.","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"geographical convergent cross mapping — gccm","text":"list. xmap cross-mapping prediction outputs varname names causal effect variable","code":""},{"path":"https://stscl.github.io/spEDM/reference/gccm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"geographical convergent cross mapping — gccm","text":"","code":"columbus = sf::read_sf(system.file(\"shapes/columbus.gpkg\", package=\"spData\")[1], quiet=TRUE) # \\donttest{ g = gccm(columbus, \"HOVAL\", \"CRIME\", libsizes = seq(5,45,5)) #> Computing: [========================================] 100% (done) #> Computing: [========================================] 100% (done) g #> libsizes CRIME->HOVAL HOVAL->CRIME #> 1 5 0.08036917 0.2360232 #> 2 10 0.11368175 0.3207803 #> 3 15 0.08758561 0.3509119 #> 4 20 0.10310575 0.3638976 #> 5 25 0.11585893 0.3814201 #> 6 30 0.12976658 0.4063601 #> 7 35 0.14387488 0.4355102 #> 8 40 0.15749070 0.4612822 #> 9 45 0.19913895 0.4838568 plot(g, ylimits = c(0,0.65)) # }"},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-12","dir":"Changelog","previous_headings":"","what":"spEDM 1.2","title":"spEDM 1.2","text":"Encapsulate gccm function using S4 class (#72). Add options tau, k, progressbar gccm (#69). Add print plot s3 methods gccm result (#64). Require sdsfun package version 0.7.0 higher (#61).","code":""},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-11","dir":"Changelog","previous_headings":"","what":"spEDM 1.1","title":"spEDM 1.1","text":"CRAN release: 2024-12-19 Resolve CRAN auto check issues, significant API changes.","code":""},{"path":"https://stscl.github.io/spEDM/news/index.html","id":"spedm-10","dir":"Changelog","previous_headings":"","what":"spEDM 1.0","title":"spEDM 1.0","text":"CRAN release: 2024-12-16 Implementing GCCM method spatial lattice grid data using pure C++11.","code":""}]