diff --git a/pkgdown.yml b/pkgdown.yml index fe928c9c..3dad681e 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,7 +5,7 @@ articles: OPGD: OPGD.html RGD: RGD.html SPADE: SPADE.html -last_built: 2024-06-21T03:15Z +last_built: 2024-06-21T03:47Z urls: reference: https://spatlyu.github.io/gdverse/reference article: https://spatlyu.github.io/gdverse/articles diff --git a/reference/psd_pseudop.html b/reference/psd_pseudop.html index aeaf9b07..8f1a06cb 100644 --- a/reference/psd_pseudop.html +++ b/reference/psd_pseudop.html @@ -85,7 +85,8 @@

Arguments diff --git a/reference/psmd_pseudop.html b/reference/psmd_pseudop.html index f301913d..b84c98c3 100644 --- a/reference/psmd_pseudop.html +++ b/reference/psmd_pseudop.html @@ -112,7 +112,8 @@

ArgumentsArguments ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 122. ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 174. ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 192. ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 213. ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 132. ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 137."},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"determine-optimal-discretization-parameters","dir":"Articles","previous_headings":"","what":"Determine optimal discretization parameters","title":"Optimal Parameters Geographical Detector(OPGD)","text":"lulc discrete category variable fvc data, need discretize others. can use gd_bestunidisc() discretize based geodetector q-statistic. new.fvc discrete result optimal discretization parameter based Q statistic geographic detector,can combine fvc lulc col fvc tibble now.","code":"tictoc::tic() g = gd_bestunidisc(fvc ~ .,data = select(fvc,-lulc),discnum = 3:15,cores = 6) tictoc::toc() ## 4.8 sec elapsed g ## $x ## [1] \"aspect\" \"elev\" \"ntl\" \"pop\" \"premax\" \"premin\" \"presum\" \"slope\" \"tmpavg\" \"tmpmax\" ## [11] \"tmpmin\" ## ## $k ## [1] 13 15 15 15 15 15 15 15 10 15 15 ## ## $method ## [1] \"pretty\" \"fisher\" \"fisher\" \"quantile\" \"fisher\" \"fisher\" \"fisher\" \"fisher\" ## [9] \"sd\" \"quantile\" \"fisher\" ## ## $disv ## # A tibble: 5,240 × 11 ## aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 7 9 3 2 7 1 1 5 8 9 2 ## 2 9 8 3 5 7 1 1 3 8 11 2 ## 3 10 9 3 2 7 1 1 5 8 9 2 ## 4 11 9 2 2 8 1 1 5 7 7 2 ## 5 7 9 4 1 7 2 1 4 8 9 2 ## 6 7 8 3 1 7 1 1 3 8 11 3 ## 7 7 8 3 3 6 1 1 2 8 11 3 ## 8 11 8 3 2 7 1 1 3 8 11 3 ## 9 9 9 4 7 7 1 1 5 8 9 2 ## 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows new.fvc = g$disv new.fvc ## # A tibble: 5,240 × 11 ## aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 7 9 3 2 7 1 1 5 8 9 2 ## 2 9 8 3 5 7 1 1 3 8 11 2 ## 3 10 9 3 2 7 1 1 5 8 9 2 ## 4 11 9 2 2 8 1 1 5 7 7 2 ## 5 7 9 4 1 7 2 1 4 8 9 2 ## 6 7 8 3 1 7 1 1 3 8 11 3 ## 7 7 8 3 3 6 1 1 2 8 11 3 ## 8 11 8 3 2 7 1 1 3 8 11 3 ## 9 9 9 4 7 7 1 1 5 8 9 2 ## 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) new.fvc ## # A tibble: 5,240 × 13 ## fvc lulc aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 0.188 10 7 9 3 2 7 1 1 5 8 9 2 ## 2 0.162 10 9 8 3 5 7 1 1 3 8 11 2 ## 3 0.168 10 10 9 3 2 7 1 1 5 8 9 2 ## 4 0.186 10 11 9 2 2 8 1 1 5 7 7 2 ## 5 0.189 10 7 9 4 1 7 2 1 4 8 9 2 ## 6 0.171 10 7 8 3 1 7 1 1 3 8 11 3 ## 7 0.153 10 7 8 3 3 6 1 1 2 8 11 3 ## 8 0.163 10 11 8 3 2 7 1 1 3 8 11 3 ## 9 0.176 10 9 9 4 7 7 1 1 5 8 9 2 ## 10 0.177 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows"},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"run-geodetector","dir":"Articles","previous_headings":"","what":"Run geodetector","title":"Optimal Parameters Geographical Detector(OPGD)","text":", can run geodetector model gd() function.","code":"gd(fvc ~ .,data = new.fvc,type = 'factor') ## Spatial Stratified Heterogeneity Test ## ## Factor detector gd(fvc ~ .,data = new.fvc,type = 'interaction') ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"you-can-also-use-opgd-in-one-time-to-get-result-above-","dir":"Articles","previous_headings":"","what":"You can also use opgd() in one time to get result above.","title":"Optimal Parameters Geographical Detector(OPGD)","text":"","code":"fvc_opgd = opgd(fvc ~ ., data = fvc, discnum = 3:15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction')) str(fvc_opgd) ## List of 2 ## $ :List of 1 ## ..$ factor: tibble [12 × 3] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable : chr [1:12] \"presum\" \"lulc\" \"premin\" \"tmpmin\" ... ## .. ..$ Q-statistic: num [1:12] 0.661 0.66 0.466 0.436 0.254 ... ## .. ..$ P-value : num [1:12] 8.34e-10 8.78e-10 3.61e-10 8.54e-10 7.85e-10 ... ## ..- attr(*, \"class\")= chr \"factor_detector\" ## $ :List of 1 ## ..$ interaction: tibble [66 × 6] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable1 : chr [1:66] \"lulc\" \"lulc\" \"lulc\" \"lulc\" ... ## .. ..$ variable2 : chr [1:66] \"aspect\" \"elev\" \"ntl\" \"pop\" ... ## .. ..$ Interaction : chr [1:66] \"Enhance, nonlinear\" \"Enhance, bi-\" \"Enhance, nonlinear\" \"Enhance, bi-\" ... ## .. ..$ Variable1 Q-statistics : num [1:66] 0.66 0.66 0.66 0.66 0.66 ... ## .. ..$ Variable2 Q-statistics : num [1:66] 0.0186 0.2355 0.0173 0.1953 0.1451 ... ## .. ..$ Variable1 and Variable2 interact Q-statistics: num [1:66] 0.691 0.828 0.716 0.756 0.77 ... ## ..- attr(*, \"class\")= chr \"interaction_detector\" fvc_opgd[[1]] ## Spatial Stratified Heterogeneity Test ## ## Factor detector fvc_opgd[[2]] ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"set-up-your-python-dependence","dir":"Articles","previous_headings":"","what":"Set up your python dependence","title":"Robust Geographical Detector(RGD)","text":"install miniconda create new conda env geocompy use conda create -n geocompy python=3.9 -y activate env conda activate geocompy install mamba conda install -c conda-forge mamba -y. set python packages use mamba install -c conda-forge numpy==1.23.5 joblib pandas ruptures -y","code":""},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"load-data-and-package","dir":"Articles","previous_headings":"","what":"Load data and package","title":"Robust Geographical Detector(RGD)","text":"","code":"library(terra) ## terra 1.7.78 library(gdverse) library(tidyverse) ## ── Attaching core tidyverse packages ─────────────────────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ readr 2.1.5 ## ✔ forcats 1.0.0 ✔ stringr 1.5.1 ## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1 ## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1 ## ✔ purrr 1.0.2 ## ── Conflicts ───────────────────────────────────────────────────────── tidyverse_conflicts() ── ## ✖ tidyr::extract() masks terra::extract() ## ✖ dplyr::filter() masks gdverse::filter(), stats::filter() ## ✖ dplyr::lag() masks stats::lag() ## ℹ Use the conflicted package () to force all conflicts to become errors reticulate::use_condaenv('geocompy') fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = aggregate(fvc,fact = 5) fvc ## class : SpatRaster ## dimensions : 84, 114, 13 (nrow, ncol, nlyr) ## resolution : 5000, 5000 (x, y) ## extent : -92742.16, 477257.8, 3589385, 4009385 (xmin, xmax, ymin, ymax) ## coord. ref. : Asia_North_Albers_Equal_Area_Conic ## source(s) : memory ## names : fvc, premax, premin, presum, tmpmax, tmpmin, ... ## min values : 0.1527159, 111.2089, 2.340401, 3834.887, 10.92638, -9.976424, ... ## max values : 0.8905939, 247.1408, 75.933422, 8276.911, 26.72104, 1.101411, ... names(fvc) ## [1] \"fvc\" \"premax\" \"premin\" \"presum\" \"tmpmax\" \"tmpmin\" \"tmpavg\" \"pop\" \"ntl\" \"lulc\" ## [11] \"elev\" \"slope\" \"aspect\""},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"convert-data-from-spatraster-to-tibble","dir":"Articles","previous_headings":"","what":"Convert data from SpatRaster to tibble","title":"Robust Geographical Detector(RGD)","text":"","code":"fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) head(fvc) ## # A tibble: 6 × 13 ## fvc premax premin presum tmpmax tmpmin tmpavg pop ntl lulc elev slope aspect ## ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 122. ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 174. ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 192. ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 213. ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 132. ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 137."},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"determine-discretization-use-offline-change-point-detection","dir":"Articles","previous_headings":"","what":"Determine discretization use offline change point detection","title":"Robust Geographical Detector(RGD)","text":"lulc discrete category variable fvc data, need discretize others. can use robust_disc() discretize based offline change point detection. new.fvc discrete result,can combine fvc lulc col fvc tibble now.","code":"tictoc::tic() new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 15,cores = 6) tictoc::toc() ## 2661.41 sec elapsed new.fvc ## # A tibble: 5,240 × 11 ## premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect ## ## 1 group10 group1 group1 group8 group4 group5 group7 group14 group13 group10 group4 ## 2 group10 group1 group1 group9 group4 group7 group10 group14 group11 group10 group14 ## 3 group11 group1 group1 group8 group4 group5 group8 group14 group13 group10 group14 ## 4 group13 group1 group1 group8 group2 group4 group7 group14 group13 group11 group14 ## 5 group10 group1 group1 group8 group4 group5 group1 group14 group13 group10 group7 ## 6 group10 group1 group1 group9 group4 group5 group2 group14 group11 group10 group7 ## 7 group10 group1 group1 group9 group4 group7 group8 group14 group9 group6 group4 ## 8 group10 group1 group1 group9 group4 group7 group8 group14 group9 group10 group14 ## 9 group10 group1 group1 group8 group4 group5 group10 group14 group13 group10 group14 ## 10 group11 group1 group1 group8 group4 group5 group9 group14 group9 group10 group14 ## # ℹ 5,230 more rows new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) new.fvc ## # A tibble: 5,240 × 13 ## fvc lulc premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect ## ## 1 0.188 10 group10 group1 group1 group8 group4 group5 group7 group14 group13 group… group4 ## 2 0.162 10 group10 group1 group1 group9 group4 group7 group10 group14 group11 group… group… ## 3 0.168 10 group11 group1 group1 group8 group4 group5 group8 group14 group13 group… group… ## 4 0.186 10 group13 group1 group1 group8 group2 group4 group7 group14 group13 group… group… ## 5 0.189 10 group10 group1 group1 group8 group4 group5 group1 group14 group13 group… group7 ## 6 0.171 10 group10 group1 group1 group9 group4 group5 group2 group14 group11 group… group7 ## 7 0.153 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group6 group4 ## 8 0.163 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group… group… ## 9 0.176 10 group10 group1 group1 group8 group4 group5 group10 group14 group13 group… group… ## 10 0.177 10 group11 group1 group1 group8 group4 group5 group9 group14 group9 group… group… ## # ℹ 5,230 more rows"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"run-geodetector","dir":"Articles","previous_headings":"","what":"Run geodetector","title":"Robust Geographical Detector(RGD)","text":",can run geodetector model gd() function.","code":"gd(fvc ~ .,data = new.fvc,type = 'factor') ## Spatial Stratified Heterogeneity Test ## ## Factor detector gd(fvc ~ .,data = new.fvc,type = 'interaction') ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"you-can-also-use-rgd-in-one-time-to-get-result-above-","dir":"Articles","previous_headings":"","what":"You can also use rgd() in one time to get result above.","title":"Robust Geographical Detector(RGD)","text":"","code":"fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction')) str(fvc_rgd) ## List of 2 ## $ :List of 1 ## ..$ factor: tibble [12 × 3] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable : chr [1:12] \"presum\" \"lulc\" \"premin\" \"tmpmin\" ... ## .. ..$ Q-statistic: num [1:12] 0.674 0.66 0.486 0.458 0.282 ... ## .. ..$ P-value : num [1:12] 6.17e-10 8.78e-10 5.46e-10 6.23e-10 5.85e-10 ... ## ..- attr(*, \"class\")= chr \"factor_detector\" ## $ :List of 1 ## ..$ interaction: tibble [66 × 6] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable1 : chr [1:66] \"lulc\" \"lulc\" \"lulc\" \"lulc\" ... ## .. ..$ variable2 : chr [1:66] \"premax\" \"premin\" \"presum\" \"tmpmax\" ... ## .. ..$ Interaction : chr [1:66] \"Enhance, bi-\" \"Enhance, bi-\" \"Enhance, bi-\" \"Enhance, bi-\" ... ## .. ..$ Variable1 Q-statistics : num [1:66] 0.66 0.66 0.66 0.66 0.66 ... ## .. ..$ Variable2 Q-statistics : num [1:66] 0.167 0.486 0.674 0.282 0.458 ... ## .. ..$ Variable1 and Variable2 interact Q-statistics: num [1:66] 0.771 0.791 0.817 0.82 0.848 ... ## ..- attr(*, \"class\")= chr \"interaction_detector\" fvc_rgd[[1]] ## Spatial Stratified Heterogeneity Test ## ## Factor detector fvc_rgd[[2]] ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"load-data-and-package","dir":"Articles","previous_headings":"","what":"Load data and package","title":"Spatial Association Detector(SPADE)","text":"study area map USFI_Xian data polygon spatial data streets divided based roads within Ring expressway Xi’City, attribute data SUHI(surface urban heat island effect) influence factors.","code":"library(sf) library(gdverse) library(magrittr) library(tidyverse) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) usfi ## Simple feature collection with 1037 features and 19 fields ## Geometry type: POLYGON ## Dimension: XY ## Bounding box: xmin: 295713 ymin: 3784916 xmax: 324202.2 ymax: 3804669 ## Projected CRS: WGS 84 / UTM zone 49N ## # A tibble: 1,037 × 20 ## LPI LSI GAR DAR WAR TER NDVI NDWI DTH DTP DTR DTW BH BD ## ## 1 57.2 10.5 0.630 0.273 0.00219 0.979 0.497 -0.356 5.66 1.08 0.934 1.16 3.16 0.635 ## 2 85.7 2.35 0.905 0.0952 0 0.977 0.514 -0.288 5.66 1.41 0.0807 1.57 0.310 0.139 ## 3 41.2 7.85 0.436 0.449 0.000672 0.972 0.365 -0.296 4.38 1.88 0.516 2.37 3.99 0.671 ## 4 39.1 5.40 0.534 0.377 0 0.966 0.395 -0.299 4.25 1.97 0.442 2.81 4.63 0.634 ## 5 32.0 8.04 0.405 0.437 0 0.968 0.354 -0.302 3.65 1.34 0.615 2.55 4.07 0.642 ## 6 58.3 7.91 0.332 0.615 0.000377 0.966 0.312 -0.271 3.69 0.700 0.592 2.25 7.91 0.777 ## 7 98.4 3.34 0.984 0.0161 0 0.948 0.451 -0.248 5.39 1.36 0.124 3.64 0.216 0.111 ## 8 44.6 17.6 0.416 0.502 0.000672 0.949 0.365 -0.295 5.11 1.20 0.926 2.50 6.49 0.747 ## 9 35.9 9.81 0.464 0.467 0.00134 0.936 0.379 -0.309 7.10 2.01 1.03 2.75 5.49 0.692 ## 10 44.3 9.49 0.403 0.504 0.000547 0.926 0.310 -0.278 8.51 2.68 0.658 3.20 3.27 0.601 ## # ℹ 1,027 more rows ## # ℹ 6 more variables: RL , RFD , SVF , FAR , SUHI , geom "},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"global-spatial-autocorrelation-of-suhi","dir":"Articles","previous_headings":"Spatial pattern of SUHI","what":"global spatial autocorrelation of SUHI","title":"Spatial Association Detector(SPADE)","text":"use sfdep calculate global Moran’s global Moran’s Index 0.5359564 P value 5.0780594 × 10-217,shows SUHI main urban area Xi’significant positive spatial autocorrelation global scale.","code":"global_moranI = \\(data,col,nb,wt){ I = sfdep::global_moran(dplyr::pull(data,{{col}}), dplyr::pull(data,{{nb}}), dplyr::pull(data,{{wt}}), na_ok = T)$I PValue = sfdep::global_moran_test(dplyr::pull(data,{{col}}), dplyr::pull(data,{{nb}}), dplyr::pull(data,{{wt}}), na.action = na.omit)$p.value moranI = c(I,PValue) names(moranI) = c(\"Moran'I Index\",\"P Value\") return(moranI) } usfi |> dplyr::filter(!if_any(everything(),is.na)) |> mutate(nb = sfdep::st_contiguity(geom), wt = sfdep::st_weights(nb)) |> dplyr::select(SUHI,nb,wt) -> new_usfi new_usfi ## Simple feature collection with 1037 features and 3 fields ## Geometry type: POLYGON ## Dimension: XY ## Bounding box: xmin: 295713 ymin: 3784916 xmax: 324202.2 ymax: 3804669 ## Projected CRS: WGS 84 / UTM zone 49N ## # A tibble: 1,037 × 4 ## SUHI nb wt geom ## ## 1 1.76 ((297871.4 3787333, 297864.8 3787343, 297852.8 3787362, 297840.8… ## 2 0.519 ((297398.6 3788768, 297397.5 3788779, 297395.2 3788804, 297393.2… ## 3 3.04 ((297391.4 3789405, 297391 3789429, 297390.5 3789454, 297390.1 3… ## 4 3.22 ((297244.1 3790712, 297240.4 3790729, 297235 3790751, 297229.6 3… ## 5 3.47 ((296806.9 3791969, 296806.7 3791970, 296797.7 3791990, 296788.8… ## 6 4.71 ((296484.5 3792805, 296481.4 3792815, 296474.7 3792837, 296467.9… ## 7 1.24 ((296356.5 3793294, 296355.5 3793298, 296351.3 3793316, 296347.5… ## 8 4.30 ((296154.6 3794673, 296152.3 3794688, 296148.6 3794713, 296144.9… ## 9 3.76 ((296261.4 3798947, 296268.7 3798960, 296280.2 3798979, 296287.8… ## 10 4.23 ((296996.6 3800017, 297000.9 3800022, 297013.3 3800038, 297025.5… ## # ℹ 1,027 more rows set.seed(123456789) gmi = new_usfi |> global_moranI(SUHI,nb,wt) gmi ## Moran'I Index P Value ## 5.359564e-01 5.078059e-217"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"local-spatial-autocorrelation-of-suhi","dir":"Articles","previous_headings":"Spatial pattern of SUHI","what":"local spatial autocorrelation of SUHI","title":"Spatial Association Detector(SPADE)","text":"use tidyrgeoda run LISA, details see LISA SUHI Xi’Main City global local spatial autocorrelation shows SUHI’s strong spatial dependence. Spatial dependence neglected native geodetector, led SPADE spatial association detector.","code":"library(tidyrgeoda) new_usfi %>% mutate(lisa = st_local_moran(.,'SUHI', wt = st_contiguity_weights(.), significance_cutoff = 0.05)) %>% select(lisa) %>% ggplot() + geom_sf(aes(fill = lisa),lwd = .1,color = 'grey') + scale_fill_lisa(name = 'SUHI-LISA') + theme_bw() + theme( axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank(), panel.grid = element_blank(), legend.title = element_text(size = 5), legend.text = element_text(size = 5), legend.key.size = unit(.3, 'cm') )"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"opgd-modeling","dir":"Articles","previous_headings":"","what":"OPGD modeling","title":"Spatial Association Detector(SPADE)","text":"can access detailed q statistics usfi_opgd$factor","code":"usfi_opgd = opgd(SUHI ~ ., data = st_drop_geometry(usfi), discnum = 3:15, discvar = names(select(st_drop_geometry(usfi),-SUHI)),cores = 6) usfi_opgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector usfi_opgd$factor ## # A tibble: 18 × 3 ## variable `Q-statistic` `P-value` ## ## 1 DAR 0.439 4.88e-10 ## 2 NDVI 0.397 2.02e-10 ## 3 GAR 0.382 8.25e-10 ## 4 RFD 0.267 7.40e-10 ## 5 BD 0.265 3.25e-10 ## 6 BH 0.248 8.79e-11 ## 7 NDWI 0.208 6.59e-10 ## 8 FAR 0.198 1.35e-10 ## 9 SVF 0.131 4.97e-10 ## 10 RL 0.123 8.89e-10 ## 11 TER 0.116 6.77e- 8 ## 12 WAR 0.106 5.57e-10 ## 13 LSI 0.0767 3.21e- 6 ## 14 DTH 0.0763 7.67e- 6 ## 15 DTP 0.0748 7.95e-10 ## 16 DTW 0.0558 4.07e- 4 ## 17 DTR 0.0529 3.94e- 7 ## 18 LPI 0.0288 8.16e- 1"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"spade-modeling","dir":"Articles","previous_headings":"","what":"SPADE modeling","title":"Spatial Association Detector(SPADE)","text":"SPADE explicitly considers spatial variance assigning weight influence based spatial distribution also minimizes influence number levels PD values using multilevel discretization considering information loss due discretization. response variable strong spatial dependence, maybe SPADE best choice. biggest difference SPADE native GD OPGD actual modeling SPADE requires spatial weight matrix calculate spatial variance. gdverse, provide spatial weight matrix, use 1st order inverse distance weight, can created inverse_distance_weight(). can also use gravity weight assigning power parameter inverse_distance_weight() function. can also use spatial weight matrix sfdep(invoke spdep) tidyrgeoda(invoke `rgeoda``)","code":"coords = usfi |> st_centroid() |> st_coordinates() wt1 = inverse_distance_weight(coords[,1],coords[,2]) wt2 = inverse_distance_weight(coords[,1],coords[,2],power = 2)"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"using-spatial-weight-matrix-from-sfdep","dir":"Articles","previous_headings":"SPADE modeling","what":"using spatial weight matrix from sfdep","title":"Spatial Association Detector(SPADE)","text":"","code":"wt3 = usfi |> dplyr::filter(!if_any(everything(),is.na)) |> mutate(nb = sfdep::st_contiguity(geom), wt = sfdep::st_weights(nb)) %$% sfdep::wt_as_matrix(nb,wt)"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"using-spatial-weight-matrix-from-tidyrgeoda","dir":"Articles","previous_headings":"SPADE modeling","what":"using spatial weight matrix from tidyrgeoda","title":"Spatial Association Detector(SPADE)","text":"wt3 identical wt4 recommend using inverse distance weight function inverse_distance_weight() gdverse package construct spatial weight matrix ’re sure spatial weight matrix used SPADE paper using .practice, appropriate spatial weight matrix selected considering characteristics research object research area! following section execute SPADE model using spatial weight matrix wt3 constructed queen contiguity.","code":"wt4 = tidyrgeoda::st_contiguity_weights(usfi) |> as.matrix() |> apply(1,\\(x) x/sum(x)) |> t() identical(wt3,wt4) ## [1] TRUE"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"run-spade","dir":"Articles","previous_headings":"SPADE modeling","what":"run SPADE","title":"Spatial Association Detector(SPADE)","text":"can also access detailed q statistics usfi_spade$factor result WAR NA,can see big difference OPGD SPADE model. results SPADE reliable cases. demonstrate rationality NA values calculated WAR following section:","code":"usfi_spade = spade(SUHI ~ ., data = st_drop_geometry(usfi), wt = wt3, discnum = 3:15, discvar = names(select(st_drop_geometry(usfi),-SUHI)),cores = 6) usfi_spade ## Spatial Stratified Heterogeneity Test ## ## Factor detector usfi_spade$factor ## # A tibble: 18 × 3 ## variable `Q-statistic` `P-value` ## ## 1 NDVI 0.465 0.01 ## 2 DAR 0.416 0.01 ## 3 GAR 0.395 0.01 ## 4 RFD 0.322 0.01 ## 5 NDWI 0.288 0.01 ## 6 BD 0.276 0.01 ## 7 DTW 0.253 0.01 ## 8 DTR 0.247 0.01 ## 9 BH 0.241 0.01 ## 10 DTP 0.241 0.01 ## 11 FAR 0.224 0.01 ## 12 TER 0.217 0.01 ## 13 LPI 0.165 0.01 ## 14 SVF 0.155 0.01 ## 15 RL 0.132 0.01 ## 16 LSI 0.131 0.01 ## 17 DTH 0.0969 0.01 ## 18 WAR NaN NA"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"spade-na-results-explained","dir":"Articles","previous_headings":"","what":"SPADE NA results explained","title":"Spatial Association Detector(SPADE)","text":"Data summary Variable type: numeric Histogram WAR Variable histogram WAR,skewness result shapiro.test, find WAR variable heavily skewed, large number zeros, provide sufficient information modeling SUHI. fact, WAR variable represents proportion water area block, WAR value NA SPADE result probably provide sufficient information modeling SUHI. cases, use linear regression explore linear relationships variables select appropriate variables subsequent modeling methods VIF.examine effect removing WAR variable VIF linear models can see model change much removing WAR variable.words, WAR much model SUHI. suggests another use SPADE selection modeling variables","code":"WAR = usfi$WAR skimr::skim(WAR) ggplot(data = usfi) + geom_histogram(aes(WAR), color='white', fill='gray60') + scale_y_continuous(expand = c(0,0)) + theme_classic() moments::skewness(WAR) ## [1] 11.6917 shapiro.test(WAR) ## ## Shapiro-Wilk normality test ## ## data: WAR ## W = 0.14693, p-value < 2.2e-16 lm.modelOne = lm(SUHI ~ ., data = st_drop_geometry(usfi)) summary(lm.modelOne) ## ## Call: ## lm(formula = SUHI ~ ., data = st_drop_geometry(usfi)) ## ## Residuals: ## Min 1Q Median 3Q Max ## -4.1991 -0.6899 -0.0366 0.6837 3.7666 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 22.156854 5.003326 4.428 1.05e-05 *** ## LPI -0.002280 0.002701 -0.844 0.39872 ## LSI -0.004190 0.023320 -0.180 0.85746 ## GAR 6.869974 0.902865 7.609 6.27e-14 *** ## DAR 6.746594 0.829310 8.135 1.19e-15 *** ## WAR 5.283058 1.784052 2.961 0.00313 ** ## TER -1.388985 0.670337 -2.072 0.03851 * ## NDVI -15.268701 1.620501 -9.422 < 2e-16 *** ## NDWI -15.408610 2.127737 -7.242 8.72e-13 *** ## DTH 0.015604 0.012255 1.273 0.20318 ## DTP 0.091178 0.098705 0.924 0.35584 ## DTR -0.069387 0.064638 -1.073 0.28331 ## DTW -0.195546 0.067418 -2.901 0.00381 ** ## BH 0.197986 0.034505 5.738 1.26e-08 *** ## BD 6.151962 2.181999 2.819 0.00490 ** ## RL 0.008593 0.228118 0.038 0.96996 ## RFD 0.117208 0.741697 0.158 0.87447 ## SVF -22.397352 4.954590 -4.521 6.89e-06 *** ## FAR -1.260657 0.112759 -11.180 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 1.06 on 1018 degrees of freedom ## Multiple R-squared: 0.6173, Adjusted R-squared: 0.6106 ## F-statistic: 91.23 on 18 and 1018 DF, p-value: < 2.2e-16 car::vif(lm.modelOne) |> tibble::as_tibble_row() |> tidyr::pivot_longer(everything(), names_to = 'variable', values_to = 'VIF') ## # A tibble: 18 × 2 ## variable VIF ## ## 1 LPI 1.68 ## 2 LSI 1.50 ## 3 GAR 31.1 ## 4 DAR 28.5 ## 5 WAR 5.85 ## 6 TER 1.18 ## 7 NDVI 20.5 ## 8 NDWI 13.2 ## 9 DTH 1.15 ## 10 DTP 2.06 ## 11 DTR 1.15 ## 12 DTW 2.00 ## 13 BH 31.9 ## 14 BD 105. ## 15 RL 2.96 ## 16 RFD 89.4 ## 17 SVF 3.02 ## 18 FAR 31.3 lm.modelTwo = lm(SUHI ~ ., data = st_drop_geometry(usfi) |> select(-WAR)) summary(lm.modelTwo) ## ## Call: ## lm(formula = SUHI ~ ., data = select(st_drop_geometry(usfi), ## -WAR)) ## ## Residuals: ## Min 1Q Median 3Q Max ## -4.1752 -0.7118 -0.0227 0.6896 3.6784 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 21.011090 5.007323 4.196 2.95e-05 *** ## LPI -0.000917 0.002671 -0.343 0.731475 ## LSI -0.002172 0.023399 -0.093 0.926046 ## GAR 5.283103 0.729402 7.243 8.64e-13 *** ## DAR 5.300795 0.672909 7.877 8.53e-15 *** ## TER -1.174510 0.668949 -1.756 0.079431 . ## NDVI -13.026040 1.438097 -9.058 < 2e-16 *** ## NDWI -10.693806 1.416860 -7.548 9.82e-14 *** ## DTH 0.011362 0.012217 0.930 0.352593 ## DTP 0.115158 0.098747 1.166 0.243809 ## DTR -0.058443 0.064778 -0.902 0.367161 ## DTW -0.226617 0.066850 -3.390 0.000726 *** ## BH 0.192503 0.034587 5.566 3.34e-08 *** ## BD 5.951972 2.189252 2.719 0.006665 ** ## RL 0.061282 0.228288 0.268 0.788413 ## RFD 0.100502 0.744497 0.135 0.892644 ## SVF -19.414910 4.869603 -3.987 7.17e-05 *** ## FAR -1.227348 0.112624 -10.898 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 1.064 on 1019 degrees of freedom ## Multiple R-squared: 0.614, Adjusted R-squared: 0.6076 ## F-statistic: 95.36 on 17 and 1019 DF, p-value: < 2.2e-16 car::vif(lm.modelTwo) |> tibble::as_tibble_row() |> tidyr::pivot_longer(everything(), names_to = 'variable', values_to = 'VIF') ## # A tibble: 17 × 2 ## variable VIF ## ## 1 LPI 1.63 ## 2 LSI 1.50 ## 3 GAR 20.2 ## 4 DAR 18.6 ## 5 TER 1.16 ## 6 NDVI 16.0 ## 7 NDWI 5.83 ## 8 DTH 1.13 ## 9 DTP 2.05 ## 10 DTR 1.15 ## 11 DTW 1.96 ## 12 BH 31.8 ## 13 BD 104. ## 14 RL 2.94 ## 15 RFD 89.4 ## 16 SVF 2.90 ## 17 FAR 31.0"},{"path":"https://spatlyu.github.io/gdverse/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Wenbo Lv. Author, maintainer.","code":""},{"path":"https://spatlyu.github.io/gdverse/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lv W (2024). gdverse: Geographical detector models. R package version 0.1.0.9000, https://github.com/SpatLyu/gdverse, https://spatlyu.github.io/gdverse/.","code":"@Manual{, title = {gdverse: Geographical detector models}, author = {Wenbo Lv}, year = {2024}, note = {R package version 0.1.0.9000, https://github.com/SpatLyu/gdverse}, url = {https://spatlyu.github.io/gdverse/}, }"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"gdverse-","dir":"","previous_headings":"","what":"gdverse | Geodetector Models In R\n","title":"gdverse | Geodetector Models In R\n","text":"goal gdverse support geodetector model variants.","code":""},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"gdverse | Geodetector Models In R\n","text":"can install development version gdverse github : install gdverse r-universe:","code":"# install.packages(\"devtools\") devtools::install_github(\"SpatLyu/gdverse\",build_vignettes = T,dep = T) install.packages('gdverse', repos='https://spatlyu.r-universe.dev')"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"load-data-and-package","dir":"","previous_headings":"Installation","what":"Load data and package","title":"gdverse | Geodetector Models In R\n","text":"","code":"library(terra) library(tidyverse) library(gdverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) head(fvc) ## # A tibble: 6 × 13 ## fvc premax premin presum tmpmax tmpmin tmpavg pop ntl lulc elev slope ## ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 ## # ℹ 1 more variable: aspect "},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"opgd-model","dir":"","previous_headings":"Installation","what":"OPGD model","title":"gdverse | Geodetector Models In R\n","text":"","code":"tictoc::tic() fvc_opgd = opgd(fvc ~ ., data = fvc, discnum = 3:15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = 'factor') tictoc::toc() ## 2.91 sec elapsed fvc_opgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"gozh-model","dir":"","previous_headings":"Installation","what":"GOZH model","title":"gdverse | Geodetector Models In R\n","text":"","code":"g = gozh(fvc ~ ., data = fvc, cores = 6) g ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"rgd-model","dir":"","previous_headings":"Installation","what":"RGD model","title":"gdverse | Geodetector Models In R\n","text":"run RGD,remember set python dependence, see RGD vignette get details.","code":"reticulate::use_condaenv('geocompy') tictoc::tic() fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 10, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = 'factor') tictoc::toc() ## 1844.56 sec elapsed fvc_rgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":null,"dir":"Reference","previous_headings":"","what":"measure information loss by information entropy — F_informationloss","title":"measure information loss by information entropy — F_informationloss","text":"Function measure information loss information entropy.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"measure information loss by information entropy — F_informationloss","text":"","code":"F_informationloss(xvar, xdisc)"},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"measure information loss by information entropy — F_informationloss","text":"xvar original un-discretized vector. xdisc discretized vector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"measure information loss by information entropy — F_informationloss","text":"value information loss measured information entropy.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"measure information loss by information entropy — F_informationloss","text":"power spatial determinant formula \\(F = -\\sum\\limits_{=1}^N p_{()}\\log_2 p_{()} - \\left(-\\sum\\limits_{h=1}^L p_{(h)}\\log_2 p_{(h)}\\right)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"measure information loss by information entropy — F_informationloss","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"compensated power of spatial determinant(CPSD) — cpsd_spade","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Function calculate compensated power spatial determinant \\(Q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"","code":"cpsd_spade(yobs, xobs, xdisc, wt)"},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"yobs Variable Y xobs original un-discretized covariable X. xdisc discretized covariable X. wt spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"value compensated power spatial determinant \\(Q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"power compensated spatial determinant formula \\(Q_s = \\frac{q_s}{q_{s_{inforkep}}} = \\frac{1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_{kdep}}{N \\Gamma_{totaldep}}}{1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_{hind}}{N \\Gamma_{totalind}}}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() wt = inverse_distance_weight(coord[,1],coord[,2]) BH = usfi$BH BH_disc = st_unidisc(usfi$BH,12) SUHI = usfi$SUHI cpsd_spade(SUHI,BH,BH_disc,wt) }"},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"ecological detector — ecological_detector","title":"ecological detector — ecological_detector","text":"Compare effects two factors \\(X_1\\) \\(X_2\\) spatial distribution attribute \\(Y\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ecological detector — ecological_detector","text":"","code":"ecological_detector(y, x1, x2, alpha = 0.95)"},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ecological detector — ecological_detector","text":"y Dependent variable, continuous numeric vector. x1 Covariable \\(X_1\\), factor, character discrete numeric. x2 Covariable \\(X_2\\), factor, character discrete numeric. alpha (optional) Confidence level interval,default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ecological detector — ecological_detector","text":"list contains F statistics, p-values, significant difference two factors \\(X_1\\) \\(X_2\\) spatial distribution attribute \\(Y\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ecological detector — ecological_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"factor detector — factor_detector","title":"factor detector — factor_detector","text":"factor detector q-statistic measures spatial stratified heterogeneity variable Y, determinant power covariate X Y.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"factor detector — factor_detector","text":"","code":"factor_detector(y, x)"},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"factor detector — factor_detector","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"factor detector — factor_detector","text":"list contains Q-statistic p-value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"factor detector — factor_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":null,"dir":"Reference","previous_headings":"","what":"original geographical detector model — gd","title":"original geographical detector model — gd","text":"Function original geographical detector model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"original geographical detector model — gd","text":"","code":"gd(formula, data, type = \"factor\", ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"original geographical detector model — gd","text":"formula formula geographical detector model. data data.frame tibble observation data. type (optional) type geographical detector,must one factor(default), interaction, risk, ecological. ... (optional) Specifies size alpha (confidence level).Default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"original geographical detector model — gd","text":"tibble corresponding result stored corresponding detector type.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"original geographical detector model — gd","text":"Jin‐Feng Wang, Xin‐Hu Li, George Christakos, Yi‐Lan Liao, Tin Zhang, XueGu & Xiao‐Ying Zheng (2010) Geographical Detectors‐Based Health Risk Assessment Application Neural Tube Defects Study Heshun Region, China, International Journal Geographical Information Science, 24:1, 107-127, DOI: 10.1080/13658810802443457","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"original geographical detector model — gd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"original geographical detector model — gd","text":"","code":"gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3)))) #> Spatial Stratified Heterogeneity Test #> #> Factor detector #> #> ---------------------------------- #> variable Q-statistic P-value #> ---------- ------------- --------- #> x2 0.8929 0.03168 #> #> x1 0.7714 0.07936 #> ---------------------------------- #> gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'interaction') #> Spatial Stratified Heterogeneity Test #> #> Interaction detector #> #> ------------------------------------------ #> Interactive variable Interaction #> ---------------------- ------------------- #> x1 ∩ x2 Weaken, nonlinear #> ------------------------------------------ #> gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'risk',alpha = 0.95) #> Spatial Stratified Heterogeneity Test #> #> Risk detector #> #> -------------------------------------- #> Variable x1: #> #> | |x |y |z | #> |:--|:--|:---|:---| #> |x |NA |No |No | #> |y |No |NA |Yes | #> |z |No |Yes |NA | #> -------------------------------------- #> Variable x2: #> #> | |a |b |c | #> |:--|:---|:---|:---| #> |a |NA |No |Yes | #> |b |No |NA |Yes | #> |c |Yes |Yes |NA | gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'ecological',alpha = 0.95) #> Spatial Stratified Heterogeneity Test #> #> ecological detector #> #> -------------------------------------- #> #> #> | |x2 | #> |:--|:--| #> |x1 |No |"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":null,"dir":"Reference","previous_headings":"","what":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"Function determining best univariate discretization based geodetector q-statistic.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"","code":"gd_bestunidisc( formula, data, discnum = NULL, discmethod = NULL, cores = 1, return_disc = TRUE, seed = 123456789, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"formula formula best univariate discretization. data data.frame tibble observation data. discnum (optional) vector number classes discretization. Default 3:15. discmethod (optional) vector methods discretization,default using c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. return_disc (optional) Whether return discretized result used optimal parameter. Default TRUE. seed (optional) Random seed number, default 123456789.Setting random seed useful sample size greater 3000(default value largeN) data discretized sampling 10%(default value samp_prop). ... (optional) arguments passed st_unidisc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"list optimal parameter provided parameter combination k, method disc(return_disc TRUE).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) g = gd_bestunidisc(fvc ~ .,data = select(fvc,-lulc),discnum = 3:15,cores = 6) g }"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":null,"dir":"Reference","previous_headings":"","what":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"q-statistics geographical detector based recursive partitioning","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"","code":"gd_rpart(formula, data, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"formula formula. data data.frame tibble observation data. ... (optional) arguments passed rpart::rpart().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"tibble contains Q-statistic p-value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"Luo, P., Song, Y., Huang, X., Ma, H., Liu, J., Yao, Y., & Meng, L. (2022). Identifying determinants spatio-temporal disparities soil moisture Northern Hemisphere using geographically optimal zones-based heterogeneity model. ISPRS Journal Photogrammetry Remote Sensing: Official Publication International Society Photogrammetry Remote Sensing (ISPRS), 185, 111–128. https://doi.org/10.1016/j.isprsjprs.2022.01.009","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":null,"dir":"Reference","previous_headings":"","what":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Function comparison size effects spatial units spatial heterogeneity analysis based optimal parameters geographical detector(OPGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"","code":"gd_sesu( formula, datalist, su, discvar, discnum = NULL, discmethod = NULL, cores = 1, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"formula formula comparison size effects spatial units. datalist list data.frame tibble. su vector sizes spatial units. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) vector number classes discretization. Default 2:15. discmethod (optional) vector methods discretization,default used c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. ... (optional) arguments passed gd_bestunidisc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"nested tibble spatial_units, sesu_result data.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Song, Y., Wang, J., Ge, Y. & Xu, C. (2020) optimal parameters-based geographical detector model enhances geographic characteristics explanatory variables spatial heterogeneity analysis: Cases different types spatial data, GIScience & Remote Sensing, 57(5), 593-610. doi: 10.1080/15481603.2020.1760434.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"","code":"if (FALSE) { library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc1000 = fvc %>% terra::as.data.frame(na.rm = T) %>% as_tibble() fvc5000 = fvc %>% terra::aggregate(fact = 5) %>% terra::as.data.frame(na.rm = T) %>% as_tibble() gd_sesu(fvc ~ ., datalist = list(fvc1000,fvc5000), su = c(1000,5000), discnum = 2:15, discvar = names(select(fvc5000,-c(fvc,lulc))), cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":null,"dir":"Reference","previous_headings":"","what":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Function geographically optimal zones-based heterogeneity(GOZH) model","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"","code":"gozh(formula, data, cores = 1, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"formula formula GOZH model. data data.frame tibble observation data. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. ... (optional) arguments passed rpart::rpart().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"list GOZH model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Luo, P., Song, Y., Huang, X., Ma, H., Liu, J., Yao, Y., & Meng, L. (2022). Identifying determinants spatio-temporal disparities soil moisture Northern Hemisphere using geographically optimal zones-based heterogeneity model. ISPRS Journal Photogrammetry Remote Sensing: Official Publication International Society Photogrammetry Remote Sensing (ISPRS), 185, 111–128. https://doi.org/10.1016/j.isprsjprs.2022.01.009","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"","code":"if (FALSE) { ndvi = GD::ndvi_40 g = gozh(NDVIchange ~ ., data = ndvi) g }"},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"interaction detector — interaction_detector","title":"interaction detector — interaction_detector","text":"Identify interaction different risk factors, , assess whether factors X1 X2 together increase decrease explanatory power dependent variable Y, whether effects factors Y independent .","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"interaction detector — interaction_detector","text":"","code":"interaction_detector(y, x1, x2)"},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"interaction detector — interaction_detector","text":"y Dependent variable, continuous numeric vector. x1 Covariable \\(X_1\\), factor, character discrete numeric. x2 Covariable \\(X_2\\), factor, character discrete numeric.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"interaction detector — interaction_detector","text":"list contains Q statistic factors \\(X_1\\) \\(X_1\\) act \\(Y\\) alone Q statistic two interact \\(Y\\) together result type interaction detector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"interaction detector — interaction_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":null,"dir":"Reference","previous_headings":"","what":"calculate inverse distance weight — inverse_distance_weight","title":"calculate inverse distance weight — inverse_distance_weight","text":"Function calculate inverse distance weight.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"calculate inverse distance weight — inverse_distance_weight","text":"","code":"inverse_distance_weight(locx, locy, power = 1, is_arc = FALSE)"},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"calculate inverse distance weight — inverse_distance_weight","text":"locx x axis location. locy y axis location. power (optional) Default 1. Set 2 gravity weights. is_arc (optional) FALSE (default) TRUE, whether compute arc distance.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"calculate inverse distance weight — inverse_distance_weight","text":"inverse distance weight matrices class matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"calculate inverse distance weight — inverse_distance_weight","text":"inverse distance weight formula \\(w_{ij} = 1 / d_{ij}^\\alpha\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"calculate inverse distance weight — inverse_distance_weight","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"calculate inverse distance weight — inverse_distance_weight","text":"","code":"x = 1:10 y = 1:10 inverse_distance_weight(x,y) #> 1 2 3 4 5 6 7 #> 1 0.00000000 0.70710678 0.3535534 0.2357023 0.1767767 0.1414214 0.1178511 #> 2 0.70710678 0.00000000 0.7071068 0.3535534 0.2357023 0.1767767 0.1414214 #> 3 0.35355339 0.70710678 0.0000000 0.7071068 0.3535534 0.2357023 0.1767767 #> 4 0.23570226 0.35355339 0.7071068 0.0000000 0.7071068 0.3535534 0.2357023 #> 5 0.17677670 0.23570226 0.3535534 0.7071068 0.0000000 0.7071068 0.3535534 #> 6 0.14142136 0.17677670 0.2357023 0.3535534 0.7071068 0.0000000 0.7071068 #> 7 0.11785113 0.14142136 0.1767767 0.2357023 0.3535534 0.7071068 0.0000000 #> 8 0.10101525 0.11785113 0.1414214 0.1767767 0.2357023 0.3535534 0.7071068 #> 9 0.08838835 0.10101525 0.1178511 0.1414214 0.1767767 0.2357023 0.3535534 #> 10 0.07856742 0.08838835 0.1010153 0.1178511 0.1414214 0.1767767 0.2357023 #> 8 9 10 #> 1 0.1010153 0.08838835 0.07856742 #> 2 0.1178511 0.10101525 0.08838835 #> 3 0.1414214 0.11785113 0.10101525 #> 4 0.1767767 0.14142136 0.11785113 #> 5 0.2357023 0.17677670 0.14142136 #> 6 0.3535534 0.23570226 0.17677670 #> 7 0.7071068 0.35355339 0.23570226 #> 8 0.0000000 0.70710678 0.35355339 #> 9 0.7071068 0.00000000 0.70710678 #> 10 0.3535534 0.70710678 0.00000000 inverse_distance_weight(x,y,is_arc = TRUE) #> 1 2 3 4 5 #> 1 0.000000e+00 6.374455e-06 3.187704e-06 2.125559e-06 1.594567e-06 #> 2 6.374455e-06 0.000000e+00 6.376358e-06 3.188893e-06 2.126512e-06 #> 3 3.187704e-06 6.376358e-06 0.000000e+00 6.379213e-06 3.190559e-06 #> 4 2.125559e-06 3.188893e-06 6.379213e-06 0.000000e+00 6.383020e-06 #> 5 1.594567e-06 2.126512e-06 3.190559e-06 6.383020e-06 0.000000e+00 #> 6 1.276036e-06 1.595401e-06 2.127782e-06 3.192702e-06 6.387781e-06 #> 7 1.063735e-06 1.276799e-06 1.596473e-06 2.129370e-06 3.195321e-06 #> 8 9.121387e-07 1.064452e-06 1.277753e-06 1.597785e-06 2.131276e-06 #> 9 7.984820e-07 9.128220e-07 1.065328e-06 1.278899e-06 1.599335e-06 #> 10 7.101191e-07 7.991407e-07 9.136421e-07 1.066363e-06 1.280236e-06 #> 6 7 8 9 10 #> 1 1.276036e-06 1.063735e-06 9.121387e-07 7.984820e-07 7.101191e-07 #> 2 1.595401e-06 1.276799e-06 1.064452e-06 9.128220e-07 7.991407e-07 #> 3 2.127782e-06 1.596473e-06 1.277753e-06 1.065328e-06 9.136421e-07 #> 4 3.192702e-06 2.129370e-06 1.597785e-06 1.278899e-06 1.066363e-06 #> 5 6.387781e-06 3.195321e-06 2.131276e-06 1.599335e-06 1.280236e-06 #> 6 0.000000e+00 6.393494e-06 3.198417e-06 2.133500e-06 1.601124e-06 #> 7 6.393494e-06 0.000000e+00 6.400162e-06 3.201991e-06 2.136043e-06 #> 8 3.198417e-06 6.400162e-06 0.000000e+00 6.407785e-06 3.206043e-06 #> 9 2.133500e-06 3.201991e-06 6.407785e-06 0.000000e+00 6.416364e-06 #> 10 1.601124e-06 2.136043e-06 3.206043e-06 6.416364e-06 0.000000e+00"},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":null,"dir":"Reference","previous_headings":"","what":"optimal parameters geographical detector(OPGD) model — opgd","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Function optimal parameters geographical detector(OPGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"","code":"opgd( formula, data, discvar, discnum = NULL, discmethod = NULL, cores = 1, type = \"factor\", alpha = 0.95, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"formula formula OPGD model. data data.frame tibble observation data. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) vector number classes discretization. Default 3:15. discmethod (optional) vector methods discretization,default using c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. type (optional) type geographical detector,must factor(default), interaction, risk, ecological.can run one time. alpha (optional) Specifies size confidence level.Default 0.95. ... (optional) arguments passed gd_bestunidisc().useful parameter seed, used set random number seed.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"list OPGD model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Song, Y., Wang, J., Ge, Y. & Xu, C. (2020) optimal parameters-based geographical detector model enhances geographic characteristics explanatory variables spatial heterogeneity analysis: Cases different types spatial data, GIScience & Remote Sensing, 57(5), 593-610. doi: 10.1080/15481603.2020.1760434.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) opgd(fvc ~ ., data = fvc, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type =c('factor','interaction')) }"},{"path":"https://spatlyu.github.io/gdverse/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print ecological detector — print.ecological_detector","title":"print ecological detector — print.ecological_detector","text":"S3 method format output ecological detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print ecological detector — print.ecological_detector","text":"","code":"# S3 method for ecological_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print ecological detector — print.ecological_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print ecological detector — print.ecological_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print ecological detector — print.ecological_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print factor detector — print.factor_detector","title":"print factor detector — print.factor_detector","text":"S3 method format output factor detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print factor detector — print.factor_detector","text":"","code":"# S3 method for factor_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print factor detector — print.factor_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print factor detector — print.factor_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print factor detector — print.factor_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print interaction detector — print.interaction_detector","title":"print interaction detector — print.interaction_detector","text":"S3 method format output interaction detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print interaction detector — print.interaction_detector","text":"","code":"# S3 method for interaction_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print interaction detector — print.interaction_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print interaction detector — print.interaction_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print interaction detector — print.interaction_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print risk detector — print.risk_detector","title":"print risk detector — print.risk_detector","text":"S3 method format output risk detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print risk detector — print.risk_detector","text":"","code":"# S3 method for risk_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print risk detector — print.risk_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print risk detector — print.risk_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print risk detector — print.risk_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":null,"dir":"Reference","previous_headings":"","what":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Function calculate power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"","code":"psd_pseudop(y, x, wt, cores = 6, seed = 123456789, permutations = 99)"},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. wt spatial weight matrix. cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"tibble power spatial determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"power spatial determinant formula \\(q_s = 1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_h}{N \\Gamma}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial determinant(PSD) — psd_spade","title":"power of spatial determinant(PSD) — psd_spade","text":"Function calculate power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial determinant(PSD) — psd_spade","text":"","code":"psd_spade(y, x, wt)"},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial determinant(PSD) — psd_spade","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. wt spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial determinant(PSD) — psd_spade","text":"value power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial determinant(PSD) — psd_spade","text":"power spatial determinant formula \\(q_s = 1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_h}{N \\Gamma}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial determinant(PSD) — psd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial determinant(PSD) — psd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial determinant(PSD) — psd_spade","text":"","code":"if (FALSE) { library(sf) library(tidyverse) ntdspath = system.file(\"extdata\", \"NTDs.gpkg\",package = 'gdverse') watershed = read_sf(ntdspath,layer = 'watershed') elevation = read_sf(ntdspath,layer = 'elevation') soiltype = read_sf(ntdspath,layer = 'soiltype') disease = read_sf(ntdspath,layer = 'disease') NTDs = disease %>% st_centroid() %>% st_join(watershed[,\"watershed\"]) %>% st_join(elevation[,\"elevation\"]) %>% st_join(soiltype[,\"soiltype\"])%>% dplyr::filter(if_all(everything(),~!is.na(.x))) NTDs = NTDs %>% st_coordinates() %>% dplyr::bind_cols(NTDs,.) wt = inverse_distance_weight(NTDs$X,NTDs$Y) psd_spade(NTDs$disease,NTDs$soiltype,wt) }"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Function calculate power spatial multilevel discretization determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"","code":"psmd_pseudop( formula, data, wt = NULL, locations = NULL, discnum = NULL, discmethod = NULL, cores = 6, seed = 123456789, permutations = 99, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"formula formula calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\). data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc().Now support one discmethod one time. cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"tibble power spatial multilevel discretization determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"power spatial multilevel discretization determinant formula \\(PSMDQ_s = MEAN(Q_s)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() tictoc::tic() pp = psmd_pseudop('SUHI ~ BH',data = dplyr::select(usfi,SUHI,BH,X,Y), locations = c('X','Y'),cores = 6) tictoc::toc() pp }"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Function calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"","code":"psmd_spade( formula, data, wt = NULL, locations = NULL, discnum = NULL, discmethod = NULL, cores = 1, seed = 123456789, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"formula formula calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\). data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc().Now support one discmethod one time. cores (optional) positive integer(default 1). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"value power spatial multilevel discretization determinant \\(PSMDQ_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"power spatial multilevel discretization determinant formula \\(PSMDQ_s = MEAN(Q_s)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() psmd_spade('SUHI ~ BH',data = dplyr::select(usfi,SUHI,BH,X,Y), locations = c('X','Y'),cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"rescale continuous vector to specified minimum and maximum — rescale_vector","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"rescale continuous vector specified minimum maximum","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"","code":"rescale_vector(x, to_left = 0, to_right = 1)"},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"x continuous numeric vector. to_left (optional) Specified minimum. Default 0. to_right (optional) Specified maximum. Default 1.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"continuous vector rescaled.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"","code":"rescale_vector(c(-5,1,5),0.01,0.99) #> [1] 0.010 0.598 0.990"},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":null,"dir":"Reference","previous_headings":"","what":"robust geographical detector(RGD) model — rgd","title":"robust geographical detector(RGD) model — rgd","text":"Function robust geographical detector(RGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"robust geographical detector(RGD) model — rgd","text":"","code":"rgd( formula, data, discvar, discnum = NULL, minsize = NULL, cores = 1, type = \"factor\", alpha = 0.95, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"robust geographical detector(RGD) model — rgd","text":"formula formula RGD model. data data.frame tibble observation data. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum numeric vector discretized classes columns need discretized. Default discvar use 10. minsize (optional) min size discretization group.Default use 1. cores (optional) Positive integer(default 1). cores > 1, use python's joblib package parallel computation. type (optional) type geographical detector,must factor(default), interaction, risk, ecological.can run one time. alpha (optional) Specifies size confidence level.Default 0.95. ... (optional) arguments passed robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"robust geographical detector(RGD) model — rgd","text":"list RGD model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"robust geographical detector(RGD) model — rgd","text":"Zhang, Z., Song, Y.*, & Wu, P., 2022. Robust geographical detector. International Journal Applied Earth Observation Geoinformation. 109, 102782. DOI: 10.1016/j.jag.2022.102782.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"robust geographical detector(RGD) model — rgd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"robust geographical detector(RGD) model — rgd","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) rgd(fvc ~ ., data = fvc, discnum = 10, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type =c('factor','interaction')) }"},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"risk detector — risk_detector","title":"risk detector — risk_detector","text":"Determine whether significant difference attribute means two subregions.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"risk detector — risk_detector","text":"","code":"risk_detector(y, x, alpha = 0.95)"},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"risk detector — risk_detector","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. alpha (optional) Confidence level interval,default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"risk detector — risk_detector","text":"tibble contains different combinations covariate X level student t-test statistics, degrees freedom, p-values, whether risk (Yes ).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"risk detector — risk_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":null,"dir":"Reference","previous_headings":"","what":"univariate discretization based on offline change point detection. — robust_disc","title":"univariate discretization based on offline change point detection. — robust_disc","text":"Determines discretization interval breaks using optimization algorithm variance-based change point detection.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"univariate discretization based on offline change point detection. — robust_disc","text":"","code":"robust_disc(formula, data, discnum, minsize = NULL, cores = 1)"},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"univariate discretization based on offline change point detection. — robust_disc","text":"formula formula univariate discretization. data data.frame tibble observation data. discnum numeric vector discretized classes columns need discretized. minsize (optional) min size discretization group.Default use 1. cores (optional) positive integer(default 1). cores > 1, use python's joblib package parallel computation.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"univariate discretization based on offline change point detection. — robust_disc","text":"tibble discretized classes columns need discretized.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"univariate discretization based on offline change point detection. — robust_disc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"univariate discretization based on offline change point detection. — robust_disc","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 10,cores = 6) new.fvc }"},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"randomly shuffling vector — shuffle_vector","title":"randomly shuffling vector — shuffle_vector","text":"randomly shuffling vector","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"randomly shuffling vector — shuffle_vector","text":"","code":"shuffle_vector(x, shuffle_rate, seed = 123456789)"},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"randomly shuffling vector — shuffle_vector","text":"x vector. shuffle_rate shuffling rate. seed (optional) Random seed number. Default 123456789.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"randomly shuffling vector — shuffle_vector","text":"shuffled vector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":null,"dir":"Reference","previous_headings":"","what":"spatial association detector (SPADE) model — spade","title":"spatial association detector (SPADE) model — spade","text":"Function spatial association detector (SPADE) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"spatial association detector (SPADE) model — spade","text":"","code":"spade( formula, data, wt = NULL, locations = NULL, discvar = NULL, discnum = NULL, discmethod = NULL, cores = 6, seed = 123456789, permutations = 99, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"spatial association detector (SPADE) model — spade","text":"formula formula spatial association detector (SPADE) model. data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc() cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"spatial association detector (SPADE) model — spade","text":"list SPADE model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"spatial association detector (SPADE) model — spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"spatial association detector (SPADE) model — spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"spatial association detector (SPADE) model — spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() wt = inverse_distance_weight(coord[,1],coord[,2]) usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() spade('SUHI~.', data = usfi,locations = c('X','Y'), discvar = c('BH','NDVI'), cores = 6) spade('SUHI~.', data = usfi, wt = wt, discvar = c('BH','NDVI'),locations = c('X','Y'), discmethod = c('sd','equal'),cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":null,"dir":"Reference","previous_headings":"","what":"spatial variance — spvar","title":"spatial variance — spvar","text":"Function calculate inverse distance weight.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"spatial variance — spvar","text":"","code":"spvar(yn, wtn)"},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"spatial variance — spvar","text":"yn numerical vector response variable. wtn spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"spatial variance — spvar","text":"spatial variance","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"spatial variance — spvar","text":"spatial variance formula \\(\\Gamma = \\frac{\\sum_i \\sum_{j \\neq } \\omega_{ij}\\frac{(y_i-y_j)^2}{2}}{\\sum_i \\sum_{j \\neq } \\omega_{ij}}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"spatial variance — spvar","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"spatial variance — spvar","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"spatial variance — spvar","text":"","code":"y = c(42,56,73) wt1 = inverse_distance_weight(1:length(y),1:length(y)) wt2 = matrix(1,ncol = length(y),nrow = length(y)) diag(wt2) = 0 spvar(y,wt1) #> [1] 193.1 spvar(y,wt2) #> [1] 241 var(y) #> [1] 241"},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":null,"dir":"Reference","previous_headings":"","what":"univariate discretization — st_unidisc","title":"univariate discretization — st_unidisc","text":"Function classify univariate vector interval,wrapper classInt::classify_intervals().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"univariate discretization — st_unidisc","text":"","code":"st_unidisc(x, k, method = \"quantile\", factor = FALSE, seed = 123456789, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"univariate discretization — st_unidisc","text":"x continuous numerical variable. k (optional) Number classes required, missing, grDevices::nclass.Sturges() used; see also \"dpih\" \"headtails\" styles automatic choice number classes. k must greater 3 ! method Chosen classify style: one \"fixed\", \"sd\", \"equal\", \"pretty\", \"quantile\", \"kmeans\", \"hclust\", \"bclust\", \"fisher\", \"jenks\", \"dpih\", \"headtails\", \"maximum\", \"box\".Default quantile. factor (optional) Default FALSE, TRUE returns cols factor intervals labels rather integers. seed (optional) Random seed number, default 123456789.Setting random seed useful sample size greater 3000(default value largeN) data discretized sampling 10%(default value samp_prop). ... (optional) arguments passed classInt::classify_intervals(), see ?classInt::classify_intervals().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"univariate discretization — st_unidisc","text":"discrete vectors classified.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"univariate discretization — st_unidisc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"univariate discretization — st_unidisc","text":"","code":"xvar = c(22361, 9573, 4836, 5309, 10384, 4359, 11016, 4414, 3327, 3408, 17816, 6909, 6936, 7990, 3758, 3569, 21965, 3605, 2181, 1892, 2459, 2934, 6399, 8578, 8537, 4840, 12132, 3734, 4372, 9073, 7508, 5203) st_unidisc(xvar,k = 6,method = 'sd') #> [1] 5 3 2 2 3 2 3 2 2 2 5 2 2 3 2 2 5 2 2 1 2 2 2 3 3 2 3 2 2 3 3 2"},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"gdverse-development-version","dir":"Changelog","previous_headings":"","what":"gdverse (development version)","title":"gdverse (development version)","text":"Support geodetector model variants fix bugs gdverse.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.1.0","text":"Support SPADE model. Change default random seed number 12345678 123456789.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-3","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.3","text":"Support GOZH model.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-2","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.2","text":"Solve computational stability problem OPGD model.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-1","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.1","text":"Can now work well OPGD RGD model.","code":""}] +[{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"load-data-and-package","dir":"Articles","previous_headings":"","what":"Load data and package","title":"Optimal Parameters Geographical Detector(OPGD)","text":"","code":"library(terra) library(tidyverse) library(gdverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = aggregate(fvc,fact = 5) fvc ## class : SpatRaster ## dimensions : 84, 114, 13 (nrow, ncol, nlyr) ## resolution : 5000, 5000 (x, y) ## extent : -92742.16, 477257.8, 3589385, 4009385 (xmin, xmax, ymin, ymax) ## coord. ref. : Asia_North_Albers_Equal_Area_Conic ## source(s) : memory ## names : fvc, premax, premin, presum, tmpmax, tmpmin, ... ## min values : 0.1527159, 111.2089, 2.340401, 3834.887, 10.92638, -9.976424, ... ## max values : 0.8905939, 247.1408, 75.933422, 8276.911, 26.72104, 1.101411, ... names(fvc) ## [1] \"fvc\" \"premax\" \"premin\" \"presum\" \"tmpmax\" \"tmpmin\" \"tmpavg\" \"pop\" \"ntl\" \"lulc\" ## [11] \"elev\" \"slope\" \"aspect\""},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"convert-data-from-spatraster-to-tibble","dir":"Articles","previous_headings":"","what":"Convert data from SpatRaster to tibble","title":"Optimal Parameters Geographical Detector(OPGD)","text":"","code":"fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) head(fvc) ## # A tibble: 6 × 13 ## fvc premax premin presum tmpmax tmpmin tmpavg pop ntl lulc elev slope aspect ## ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 122. ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 174. ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 192. ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 213. ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 132. ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 137."},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"determine-optimal-discretization-parameters","dir":"Articles","previous_headings":"","what":"Determine optimal discretization parameters","title":"Optimal Parameters Geographical Detector(OPGD)","text":"lulc discrete category variable fvc data, need discretize others. can use gd_bestunidisc() discretize based geodetector q-statistic. new.fvc discrete result optimal discretization parameter based Q statistic geographic detector,can combine fvc lulc col fvc tibble now.","code":"tictoc::tic() g = gd_bestunidisc(fvc ~ .,data = select(fvc,-lulc),discnum = 3:15,cores = 6) tictoc::toc() ## 4.8 sec elapsed g ## $x ## [1] \"aspect\" \"elev\" \"ntl\" \"pop\" \"premax\" \"premin\" \"presum\" \"slope\" \"tmpavg\" \"tmpmax\" ## [11] \"tmpmin\" ## ## $k ## [1] 13 15 15 15 15 15 15 15 10 15 15 ## ## $method ## [1] \"pretty\" \"fisher\" \"fisher\" \"quantile\" \"fisher\" \"fisher\" \"fisher\" \"fisher\" ## [9] \"sd\" \"quantile\" \"fisher\" ## ## $disv ## # A tibble: 5,240 × 11 ## aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 7 9 3 2 7 1 1 5 8 9 2 ## 2 9 8 3 5 7 1 1 3 8 11 2 ## 3 10 9 3 2 7 1 1 5 8 9 2 ## 4 11 9 2 2 8 1 1 5 7 7 2 ## 5 7 9 4 1 7 2 1 4 8 9 2 ## 6 7 8 3 1 7 1 1 3 8 11 3 ## 7 7 8 3 3 6 1 1 2 8 11 3 ## 8 11 8 3 2 7 1 1 3 8 11 3 ## 9 9 9 4 7 7 1 1 5 8 9 2 ## 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows new.fvc = g$disv new.fvc ## # A tibble: 5,240 × 11 ## aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 7 9 3 2 7 1 1 5 8 9 2 ## 2 9 8 3 5 7 1 1 3 8 11 2 ## 3 10 9 3 2 7 1 1 5 8 9 2 ## 4 11 9 2 2 8 1 1 5 7 7 2 ## 5 7 9 4 1 7 2 1 4 8 9 2 ## 6 7 8 3 1 7 1 1 3 8 11 3 ## 7 7 8 3 3 6 1 1 2 8 11 3 ## 8 11 8 3 2 7 1 1 3 8 11 3 ## 9 9 9 4 7 7 1 1 5 8 9 2 ## 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) new.fvc ## # A tibble: 5,240 × 13 ## fvc lulc aspect elev ntl pop premax premin presum slope tmpavg tmpmax tmpmin ## ## 1 0.188 10 7 9 3 2 7 1 1 5 8 9 2 ## 2 0.162 10 9 8 3 5 7 1 1 3 8 11 2 ## 3 0.168 10 10 9 3 2 7 1 1 5 8 9 2 ## 4 0.186 10 11 9 2 2 8 1 1 5 7 7 2 ## 5 0.189 10 7 9 4 1 7 2 1 4 8 9 2 ## 6 0.171 10 7 8 3 1 7 1 1 3 8 11 3 ## 7 0.153 10 7 8 3 3 6 1 1 2 8 11 3 ## 8 0.163 10 11 8 3 2 7 1 1 3 8 11 3 ## 9 0.176 10 9 9 4 7 7 1 1 5 8 9 2 ## 10 0.177 10 11 8 3 3 7 1 1 4 8 10 2 ## # ℹ 5,230 more rows"},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"run-geodetector","dir":"Articles","previous_headings":"","what":"Run geodetector","title":"Optimal Parameters Geographical Detector(OPGD)","text":", can run geodetector model gd() function.","code":"gd(fvc ~ .,data = new.fvc,type = 'factor') ## Spatial Stratified Heterogeneity Test ## ## Factor detector gd(fvc ~ .,data = new.fvc,type = 'interaction') ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/OPGD.html","id":"you-can-also-use-opgd-in-one-time-to-get-result-above-","dir":"Articles","previous_headings":"","what":"You can also use opgd() in one time to get result above.","title":"Optimal Parameters Geographical Detector(OPGD)","text":"","code":"fvc_opgd = opgd(fvc ~ ., data = fvc, discnum = 3:15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction')) str(fvc_opgd) ## List of 2 ## $ :List of 1 ## ..$ factor: tibble [12 × 3] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable : chr [1:12] \"presum\" \"lulc\" \"premin\" \"tmpmin\" ... ## .. ..$ Q-statistic: num [1:12] 0.661 0.66 0.466 0.436 0.254 ... ## .. ..$ P-value : num [1:12] 8.34e-10 8.78e-10 3.61e-10 8.54e-10 7.85e-10 ... ## ..- attr(*, \"class\")= chr \"factor_detector\" ## $ :List of 1 ## ..$ interaction: tibble [66 × 6] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable1 : chr [1:66] \"lulc\" \"lulc\" \"lulc\" \"lulc\" ... ## .. ..$ variable2 : chr [1:66] \"aspect\" \"elev\" \"ntl\" \"pop\" ... ## .. ..$ Interaction : chr [1:66] \"Enhance, nonlinear\" \"Enhance, bi-\" \"Enhance, nonlinear\" \"Enhance, bi-\" ... ## .. ..$ Variable1 Q-statistics : num [1:66] 0.66 0.66 0.66 0.66 0.66 ... ## .. ..$ Variable2 Q-statistics : num [1:66] 0.0186 0.2355 0.0173 0.1953 0.1451 ... ## .. ..$ Variable1 and Variable2 interact Q-statistics: num [1:66] 0.691 0.828 0.716 0.756 0.77 ... ## ..- attr(*, \"class\")= chr \"interaction_detector\" fvc_opgd[[1]] ## Spatial Stratified Heterogeneity Test ## ## Factor detector fvc_opgd[[2]] ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"set-up-your-python-dependence","dir":"Articles","previous_headings":"","what":"Set up your python dependence","title":"Robust Geographical Detector(RGD)","text":"install miniconda create new conda env geocompy use conda create -n geocompy python=3.9 -y activate env conda activate geocompy install mamba conda install -c conda-forge mamba -y. set python packages use mamba install -c conda-forge numpy==1.23.5 joblib pandas ruptures -y","code":""},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"load-data-and-package","dir":"Articles","previous_headings":"","what":"Load data and package","title":"Robust Geographical Detector(RGD)","text":"","code":"library(terra) ## terra 1.7.78 library(gdverse) library(tidyverse) ## ── Attaching core tidyverse packages ─────────────────────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ readr 2.1.5 ## ✔ forcats 1.0.0 ✔ stringr 1.5.1 ## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1 ## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1 ## ✔ purrr 1.0.2 ## ── Conflicts ───────────────────────────────────────────────────────── tidyverse_conflicts() ── ## ✖ tidyr::extract() masks terra::extract() ## ✖ dplyr::filter() masks gdverse::filter(), stats::filter() ## ✖ dplyr::lag() masks stats::lag() ## ℹ Use the conflicted package () to force all conflicts to become errors reticulate::use_condaenv('geocompy') fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = aggregate(fvc,fact = 5) fvc ## class : SpatRaster ## dimensions : 84, 114, 13 (nrow, ncol, nlyr) ## resolution : 5000, 5000 (x, y) ## extent : -92742.16, 477257.8, 3589385, 4009385 (xmin, xmax, ymin, ymax) ## coord. ref. : Asia_North_Albers_Equal_Area_Conic ## source(s) : memory ## names : fvc, premax, premin, presum, tmpmax, tmpmin, ... ## min values : 0.1527159, 111.2089, 2.340401, 3834.887, 10.92638, -9.976424, ... ## max values : 0.8905939, 247.1408, 75.933422, 8276.911, 26.72104, 1.101411, ... names(fvc) ## [1] \"fvc\" \"premax\" \"premin\" \"presum\" \"tmpmax\" \"tmpmin\" \"tmpavg\" \"pop\" \"ntl\" \"lulc\" ## [11] \"elev\" \"slope\" \"aspect\""},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"convert-data-from-spatraster-to-tibble","dir":"Articles","previous_headings":"","what":"Convert data from SpatRaster to tibble","title":"Robust Geographical Detector(RGD)","text":"","code":"fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) head(fvc) ## # A tibble: 6 × 13 ## fvc premax premin presum tmpmax tmpmin tmpavg pop ntl lulc elev slope aspect ## ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 122. ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 174. ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 192. ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 213. ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 132. ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 137."},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"determine-discretization-use-offline-change-point-detection","dir":"Articles","previous_headings":"","what":"Determine discretization use offline change point detection","title":"Robust Geographical Detector(RGD)","text":"lulc discrete category variable fvc data, need discretize others. can use robust_disc() discretize based offline change point detection. new.fvc discrete result,can combine fvc lulc col fvc tibble now.","code":"tictoc::tic() new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 15,cores = 6) tictoc::toc() ## 2661.41 sec elapsed new.fvc ## # A tibble: 5,240 × 11 ## premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect ## ## 1 group10 group1 group1 group8 group4 group5 group7 group14 group13 group10 group4 ## 2 group10 group1 group1 group9 group4 group7 group10 group14 group11 group10 group14 ## 3 group11 group1 group1 group8 group4 group5 group8 group14 group13 group10 group14 ## 4 group13 group1 group1 group8 group2 group4 group7 group14 group13 group11 group14 ## 5 group10 group1 group1 group8 group4 group5 group1 group14 group13 group10 group7 ## 6 group10 group1 group1 group9 group4 group5 group2 group14 group11 group10 group7 ## 7 group10 group1 group1 group9 group4 group7 group8 group14 group9 group6 group4 ## 8 group10 group1 group1 group9 group4 group7 group8 group14 group9 group10 group14 ## 9 group10 group1 group1 group8 group4 group5 group10 group14 group13 group10 group14 ## 10 group11 group1 group1 group8 group4 group5 group9 group14 group9 group10 group14 ## # ℹ 5,230 more rows new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) new.fvc ## # A tibble: 5,240 × 13 ## fvc lulc premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect ## ## 1 0.188 10 group10 group1 group1 group8 group4 group5 group7 group14 group13 group… group4 ## 2 0.162 10 group10 group1 group1 group9 group4 group7 group10 group14 group11 group… group… ## 3 0.168 10 group11 group1 group1 group8 group4 group5 group8 group14 group13 group… group… ## 4 0.186 10 group13 group1 group1 group8 group2 group4 group7 group14 group13 group… group… ## 5 0.189 10 group10 group1 group1 group8 group4 group5 group1 group14 group13 group… group7 ## 6 0.171 10 group10 group1 group1 group9 group4 group5 group2 group14 group11 group… group7 ## 7 0.153 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group6 group4 ## 8 0.163 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group… group… ## 9 0.176 10 group10 group1 group1 group8 group4 group5 group10 group14 group13 group… group… ## 10 0.177 10 group11 group1 group1 group8 group4 group5 group9 group14 group9 group… group… ## # ℹ 5,230 more rows"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"run-geodetector","dir":"Articles","previous_headings":"","what":"Run geodetector","title":"Robust Geographical Detector(RGD)","text":",can run geodetector model gd() function.","code":"gd(fvc ~ .,data = new.fvc,type = 'factor') ## Spatial Stratified Heterogeneity Test ## ## Factor detector gd(fvc ~ .,data = new.fvc,type = 'interaction') ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/RGD.html","id":"you-can-also-use-rgd-in-one-time-to-get-result-above-","dir":"Articles","previous_headings":"","what":"You can also use rgd() in one time to get result above.","title":"Robust Geographical Detector(RGD)","text":"","code":"fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction')) str(fvc_rgd) ## List of 2 ## $ :List of 1 ## ..$ factor: tibble [12 × 3] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable : chr [1:12] \"presum\" \"lulc\" \"premin\" \"tmpmin\" ... ## .. ..$ Q-statistic: num [1:12] 0.674 0.66 0.486 0.458 0.282 ... ## .. ..$ P-value : num [1:12] 6.17e-10 8.78e-10 5.46e-10 6.23e-10 5.85e-10 ... ## ..- attr(*, \"class\")= chr \"factor_detector\" ## $ :List of 1 ## ..$ interaction: tibble [66 × 6] (S3: tbl_df/tbl/data.frame) ## .. ..$ variable1 : chr [1:66] \"lulc\" \"lulc\" \"lulc\" \"lulc\" ... ## .. ..$ variable2 : chr [1:66] \"premax\" \"premin\" \"presum\" \"tmpmax\" ... ## .. ..$ Interaction : chr [1:66] \"Enhance, bi-\" \"Enhance, bi-\" \"Enhance, bi-\" \"Enhance, bi-\" ... ## .. ..$ Variable1 Q-statistics : num [1:66] 0.66 0.66 0.66 0.66 0.66 ... ## .. ..$ Variable2 Q-statistics : num [1:66] 0.167 0.486 0.674 0.282 0.458 ... ## .. ..$ Variable1 and Variable2 interact Q-statistics: num [1:66] 0.771 0.791 0.817 0.82 0.848 ... ## ..- attr(*, \"class\")= chr \"interaction_detector\" fvc_rgd[[1]] ## Spatial Stratified Heterogeneity Test ## ## Factor detector fvc_rgd[[2]] ## Spatial Stratified Heterogeneity Test ## ## Interaction detector"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"load-data-and-package","dir":"Articles","previous_headings":"","what":"Load data and package","title":"Spatial Association Detector(SPADE)","text":"study area map USFI_Xian data polygon spatial data streets divided based roads within Ring expressway Xi’City, attribute data SUHI(surface urban heat island effect) influence factors.","code":"library(sf) library(gdverse) library(magrittr) library(tidyverse) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) usfi ## Simple feature collection with 1037 features and 19 fields ## Geometry type: POLYGON ## Dimension: XY ## Bounding box: xmin: 295713 ymin: 3784916 xmax: 324202.2 ymax: 3804669 ## Projected CRS: WGS 84 / UTM zone 49N ## # A tibble: 1,037 × 20 ## LPI LSI GAR DAR WAR TER NDVI NDWI DTH DTP DTR DTW BH BD ## ## 1 57.2 10.5 0.630 0.273 0.00219 0.979 0.497 -0.356 5.66 1.08 0.934 1.16 3.16 0.635 ## 2 85.7 2.35 0.905 0.0952 0 0.977 0.514 -0.288 5.66 1.41 0.0807 1.57 0.310 0.139 ## 3 41.2 7.85 0.436 0.449 0.000672 0.972 0.365 -0.296 4.38 1.88 0.516 2.37 3.99 0.671 ## 4 39.1 5.40 0.534 0.377 0 0.966 0.395 -0.299 4.25 1.97 0.442 2.81 4.63 0.634 ## 5 32.0 8.04 0.405 0.437 0 0.968 0.354 -0.302 3.65 1.34 0.615 2.55 4.07 0.642 ## 6 58.3 7.91 0.332 0.615 0.000377 0.966 0.312 -0.271 3.69 0.700 0.592 2.25 7.91 0.777 ## 7 98.4 3.34 0.984 0.0161 0 0.948 0.451 -0.248 5.39 1.36 0.124 3.64 0.216 0.111 ## 8 44.6 17.6 0.416 0.502 0.000672 0.949 0.365 -0.295 5.11 1.20 0.926 2.50 6.49 0.747 ## 9 35.9 9.81 0.464 0.467 0.00134 0.936 0.379 -0.309 7.10 2.01 1.03 2.75 5.49 0.692 ## 10 44.3 9.49 0.403 0.504 0.000547 0.926 0.310 -0.278 8.51 2.68 0.658 3.20 3.27 0.601 ## # ℹ 1,027 more rows ## # ℹ 6 more variables: RL , RFD , SVF , FAR , SUHI , geom "},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"global-spatial-autocorrelation-of-suhi","dir":"Articles","previous_headings":"Spatial pattern of SUHI","what":"global spatial autocorrelation of SUHI","title":"Spatial Association Detector(SPADE)","text":"use sfdep calculate global Moran’s global Moran’s Index 0.5359564 P value 5.0780594 × 10-217,shows SUHI main urban area Xi’significant positive spatial autocorrelation global scale.","code":"global_moranI = \\(data,col,nb,wt){ I = sfdep::global_moran(dplyr::pull(data,{{col}}), dplyr::pull(data,{{nb}}), dplyr::pull(data,{{wt}}), na_ok = T)$I PValue = sfdep::global_moran_test(dplyr::pull(data,{{col}}), dplyr::pull(data,{{nb}}), dplyr::pull(data,{{wt}}), na.action = na.omit)$p.value moranI = c(I,PValue) names(moranI) = c(\"Moran'I Index\",\"P Value\") return(moranI) } usfi |> dplyr::filter(!if_any(everything(),is.na)) |> mutate(nb = sfdep::st_contiguity(geom), wt = sfdep::st_weights(nb)) |> dplyr::select(SUHI,nb,wt) -> new_usfi new_usfi ## Simple feature collection with 1037 features and 3 fields ## Geometry type: POLYGON ## Dimension: XY ## Bounding box: xmin: 295713 ymin: 3784916 xmax: 324202.2 ymax: 3804669 ## Projected CRS: WGS 84 / UTM zone 49N ## # A tibble: 1,037 × 4 ## SUHI nb wt geom ## ## 1 1.76 ((297871.4 3787333, 297864.8 3787343, 297852.8 3787362, 297840.8… ## 2 0.519 ((297398.6 3788768, 297397.5 3788779, 297395.2 3788804, 297393.2… ## 3 3.04 ((297391.4 3789405, 297391 3789429, 297390.5 3789454, 297390.1 3… ## 4 3.22 ((297244.1 3790712, 297240.4 3790729, 297235 3790751, 297229.6 3… ## 5 3.47 ((296806.9 3791969, 296806.7 3791970, 296797.7 3791990, 296788.8… ## 6 4.71 ((296484.5 3792805, 296481.4 3792815, 296474.7 3792837, 296467.9… ## 7 1.24 ((296356.5 3793294, 296355.5 3793298, 296351.3 3793316, 296347.5… ## 8 4.30 ((296154.6 3794673, 296152.3 3794688, 296148.6 3794713, 296144.9… ## 9 3.76 ((296261.4 3798947, 296268.7 3798960, 296280.2 3798979, 296287.8… ## 10 4.23 ((296996.6 3800017, 297000.9 3800022, 297013.3 3800038, 297025.5… ## # ℹ 1,027 more rows set.seed(123456789) gmi = new_usfi |> global_moranI(SUHI,nb,wt) gmi ## Moran'I Index P Value ## 5.359564e-01 5.078059e-217"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"local-spatial-autocorrelation-of-suhi","dir":"Articles","previous_headings":"Spatial pattern of SUHI","what":"local spatial autocorrelation of SUHI","title":"Spatial Association Detector(SPADE)","text":"use tidyrgeoda run LISA, details see LISA SUHI Xi’Main City global local spatial autocorrelation shows SUHI’s strong spatial dependence. Spatial dependence neglected native geodetector, led SPADE spatial association detector.","code":"library(tidyrgeoda) new_usfi %>% mutate(lisa = st_local_moran(.,'SUHI', wt = st_contiguity_weights(.), significance_cutoff = 0.05)) %>% select(lisa) %>% ggplot() + geom_sf(aes(fill = lisa),lwd = .1,color = 'grey') + scale_fill_lisa(name = 'SUHI-LISA') + theme_bw() + theme( axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank(), panel.grid = element_blank(), legend.title = element_text(size = 5), legend.text = element_text(size = 5), legend.key.size = unit(.3, 'cm') )"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"opgd-modeling","dir":"Articles","previous_headings":"","what":"OPGD modeling","title":"Spatial Association Detector(SPADE)","text":"can access detailed q statistics usfi_opgd$factor","code":"usfi_opgd = opgd(SUHI ~ ., data = st_drop_geometry(usfi), discnum = 3:15, discvar = names(select(st_drop_geometry(usfi),-SUHI)),cores = 6) usfi_opgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector usfi_opgd$factor ## # A tibble: 18 × 3 ## variable `Q-statistic` `P-value` ## ## 1 DAR 0.439 4.88e-10 ## 2 NDVI 0.397 2.02e-10 ## 3 GAR 0.382 8.25e-10 ## 4 RFD 0.267 7.40e-10 ## 5 BD 0.265 3.25e-10 ## 6 BH 0.248 8.79e-11 ## 7 NDWI 0.208 6.59e-10 ## 8 FAR 0.198 1.35e-10 ## 9 SVF 0.131 4.97e-10 ## 10 RL 0.123 8.89e-10 ## 11 TER 0.116 6.77e- 8 ## 12 WAR 0.106 5.57e-10 ## 13 LSI 0.0767 3.21e- 6 ## 14 DTH 0.0763 7.67e- 6 ## 15 DTP 0.0748 7.95e-10 ## 16 DTW 0.0558 4.07e- 4 ## 17 DTR 0.0529 3.94e- 7 ## 18 LPI 0.0288 8.16e- 1"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"spade-modeling","dir":"Articles","previous_headings":"","what":"SPADE modeling","title":"Spatial Association Detector(SPADE)","text":"SPADE explicitly considers spatial variance assigning weight influence based spatial distribution also minimizes influence number levels PD values using multilevel discretization considering information loss due discretization. response variable strong spatial dependence, maybe SPADE best choice. biggest difference SPADE native GD OPGD actual modeling SPADE requires spatial weight matrix calculate spatial variance. gdverse, provide spatial weight matrix, use 1st order inverse distance weight, can created inverse_distance_weight(). can also use gravity weight assigning power parameter inverse_distance_weight() function. can also use spatial weight matrix sfdep(invoke spdep) tidyrgeoda(invoke `rgeoda``)","code":"coords = usfi |> st_centroid() |> st_coordinates() wt1 = inverse_distance_weight(coords[,1],coords[,2]) wt2 = inverse_distance_weight(coords[,1],coords[,2],power = 2)"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"using-spatial-weight-matrix-from-sfdep","dir":"Articles","previous_headings":"SPADE modeling","what":"using spatial weight matrix from sfdep","title":"Spatial Association Detector(SPADE)","text":"","code":"wt3 = usfi |> dplyr::filter(!if_any(everything(),is.na)) |> mutate(nb = sfdep::st_contiguity(geom), wt = sfdep::st_weights(nb)) %$% sfdep::wt_as_matrix(nb,wt)"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"using-spatial-weight-matrix-from-tidyrgeoda","dir":"Articles","previous_headings":"SPADE modeling","what":"using spatial weight matrix from tidyrgeoda","title":"Spatial Association Detector(SPADE)","text":"wt3 identical wt4 recommend using inverse distance weight function inverse_distance_weight() gdverse package construct spatial weight matrix ’re sure spatial weight matrix used SPADE paper using .practice, appropriate spatial weight matrix selected considering characteristics research object research area! following section execute SPADE model using spatial weight matrix wt3 constructed queen contiguity.","code":"wt4 = tidyrgeoda::st_contiguity_weights(usfi) |> as.matrix() |> apply(1,\\(x) x/sum(x)) |> t() identical(wt3,wt4) ## [1] TRUE"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"run-spade","dir":"Articles","previous_headings":"SPADE modeling","what":"run SPADE","title":"Spatial Association Detector(SPADE)","text":"can also access detailed q statistics usfi_spade$factor result WAR NA,can see big difference OPGD SPADE model. results SPADE reliable cases. demonstrate rationality NA values calculated WAR following section:","code":"usfi_spade = spade(SUHI ~ ., data = st_drop_geometry(usfi), wt = wt3, discnum = 3:15, discvar = names(select(st_drop_geometry(usfi),-SUHI)),cores = 6) usfi_spade ## Spatial Stratified Heterogeneity Test ## ## Factor detector usfi_spade$factor ## # A tibble: 18 × 3 ## variable `Q-statistic` `P-value` ## ## 1 NDVI 0.465 0.01 ## 2 DAR 0.416 0.01 ## 3 GAR 0.395 0.01 ## 4 RFD 0.322 0.01 ## 5 NDWI 0.288 0.01 ## 6 BD 0.276 0.01 ## 7 DTW 0.253 0.01 ## 8 DTR 0.247 0.01 ## 9 BH 0.241 0.01 ## 10 DTP 0.241 0.01 ## 11 FAR 0.224 0.01 ## 12 TER 0.217 0.01 ## 13 LPI 0.165 0.01 ## 14 SVF 0.155 0.01 ## 15 RL 0.132 0.01 ## 16 LSI 0.131 0.01 ## 17 DTH 0.0969 0.01 ## 18 WAR NaN NA"},{"path":"https://spatlyu.github.io/gdverse/articles/SPADE.html","id":"spade-na-results-explained","dir":"Articles","previous_headings":"","what":"SPADE NA results explained","title":"Spatial Association Detector(SPADE)","text":"Data summary Variable type: numeric Histogram WAR Variable histogram WAR,skewness result shapiro.test, find WAR variable heavily skewed, large number zeros, provide sufficient information modeling SUHI. fact, WAR variable represents proportion water area block, WAR value NA SPADE result probably provide sufficient information modeling SUHI. cases, use linear regression explore linear relationships variables select appropriate variables subsequent modeling methods VIF.examine effect removing WAR variable VIF linear models can see model change much removing WAR variable.words, WAR much model SUHI. suggests another use SPADE selection modeling variables","code":"WAR = usfi$WAR skimr::skim(WAR) ggplot(data = usfi) + geom_histogram(aes(WAR), color='white', fill='gray60') + scale_y_continuous(expand = c(0,0)) + theme_classic() moments::skewness(WAR) ## [1] 11.6917 shapiro.test(WAR) ## ## Shapiro-Wilk normality test ## ## data: WAR ## W = 0.14693, p-value < 2.2e-16 lm.modelOne = lm(SUHI ~ ., data = st_drop_geometry(usfi)) summary(lm.modelOne) ## ## Call: ## lm(formula = SUHI ~ ., data = st_drop_geometry(usfi)) ## ## Residuals: ## Min 1Q Median 3Q Max ## -4.1991 -0.6899 -0.0366 0.6837 3.7666 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 22.156854 5.003326 4.428 1.05e-05 *** ## LPI -0.002280 0.002701 -0.844 0.39872 ## LSI -0.004190 0.023320 -0.180 0.85746 ## GAR 6.869974 0.902865 7.609 6.27e-14 *** ## DAR 6.746594 0.829310 8.135 1.19e-15 *** ## WAR 5.283058 1.784052 2.961 0.00313 ** ## TER -1.388985 0.670337 -2.072 0.03851 * ## NDVI -15.268701 1.620501 -9.422 < 2e-16 *** ## NDWI -15.408610 2.127737 -7.242 8.72e-13 *** ## DTH 0.015604 0.012255 1.273 0.20318 ## DTP 0.091178 0.098705 0.924 0.35584 ## DTR -0.069387 0.064638 -1.073 0.28331 ## DTW -0.195546 0.067418 -2.901 0.00381 ** ## BH 0.197986 0.034505 5.738 1.26e-08 *** ## BD 6.151962 2.181999 2.819 0.00490 ** ## RL 0.008593 0.228118 0.038 0.96996 ## RFD 0.117208 0.741697 0.158 0.87447 ## SVF -22.397352 4.954590 -4.521 6.89e-06 *** ## FAR -1.260657 0.112759 -11.180 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 1.06 on 1018 degrees of freedom ## Multiple R-squared: 0.6173, Adjusted R-squared: 0.6106 ## F-statistic: 91.23 on 18 and 1018 DF, p-value: < 2.2e-16 car::vif(lm.modelOne) |> tibble::as_tibble_row() |> tidyr::pivot_longer(everything(), names_to = 'variable', values_to = 'VIF') ## # A tibble: 18 × 2 ## variable VIF ## ## 1 LPI 1.68 ## 2 LSI 1.50 ## 3 GAR 31.1 ## 4 DAR 28.5 ## 5 WAR 5.85 ## 6 TER 1.18 ## 7 NDVI 20.5 ## 8 NDWI 13.2 ## 9 DTH 1.15 ## 10 DTP 2.06 ## 11 DTR 1.15 ## 12 DTW 2.00 ## 13 BH 31.9 ## 14 BD 105. ## 15 RL 2.96 ## 16 RFD 89.4 ## 17 SVF 3.02 ## 18 FAR 31.3 lm.modelTwo = lm(SUHI ~ ., data = st_drop_geometry(usfi) |> select(-WAR)) summary(lm.modelTwo) ## ## Call: ## lm(formula = SUHI ~ ., data = select(st_drop_geometry(usfi), ## -WAR)) ## ## Residuals: ## Min 1Q Median 3Q Max ## -4.1752 -0.7118 -0.0227 0.6896 3.6784 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 21.011090 5.007323 4.196 2.95e-05 *** ## LPI -0.000917 0.002671 -0.343 0.731475 ## LSI -0.002172 0.023399 -0.093 0.926046 ## GAR 5.283103 0.729402 7.243 8.64e-13 *** ## DAR 5.300795 0.672909 7.877 8.53e-15 *** ## TER -1.174510 0.668949 -1.756 0.079431 . ## NDVI -13.026040 1.438097 -9.058 < 2e-16 *** ## NDWI -10.693806 1.416860 -7.548 9.82e-14 *** ## DTH 0.011362 0.012217 0.930 0.352593 ## DTP 0.115158 0.098747 1.166 0.243809 ## DTR -0.058443 0.064778 -0.902 0.367161 ## DTW -0.226617 0.066850 -3.390 0.000726 *** ## BH 0.192503 0.034587 5.566 3.34e-08 *** ## BD 5.951972 2.189252 2.719 0.006665 ** ## RL 0.061282 0.228288 0.268 0.788413 ## RFD 0.100502 0.744497 0.135 0.892644 ## SVF -19.414910 4.869603 -3.987 7.17e-05 *** ## FAR -1.227348 0.112624 -10.898 < 2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 1.064 on 1019 degrees of freedom ## Multiple R-squared: 0.614, Adjusted R-squared: 0.6076 ## F-statistic: 95.36 on 17 and 1019 DF, p-value: < 2.2e-16 car::vif(lm.modelTwo) |> tibble::as_tibble_row() |> tidyr::pivot_longer(everything(), names_to = 'variable', values_to = 'VIF') ## # A tibble: 17 × 2 ## variable VIF ## ## 1 LPI 1.63 ## 2 LSI 1.50 ## 3 GAR 20.2 ## 4 DAR 18.6 ## 5 TER 1.16 ## 6 NDVI 16.0 ## 7 NDWI 5.83 ## 8 DTH 1.13 ## 9 DTP 2.05 ## 10 DTR 1.15 ## 11 DTW 1.96 ## 12 BH 31.8 ## 13 BD 104. ## 14 RL 2.94 ## 15 RFD 89.4 ## 16 SVF 2.90 ## 17 FAR 31.0"},{"path":"https://spatlyu.github.io/gdverse/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Wenbo Lv. Author, maintainer.","code":""},{"path":"https://spatlyu.github.io/gdverse/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Lv W (2024). gdverse: Geographical detector models. R package version 0.1.0.9000, https://github.com/SpatLyu/gdverse, https://spatlyu.github.io/gdverse/.","code":"@Manual{, title = {gdverse: Geographical detector models}, author = {Wenbo Lv}, year = {2024}, note = {R package version 0.1.0.9000, https://github.com/SpatLyu/gdverse}, url = {https://spatlyu.github.io/gdverse/}, }"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"gdverse-","dir":"","previous_headings":"","what":"gdverse | Geodetector Models In R\n","title":"gdverse | Geodetector Models In R\n","text":"goal gdverse support geodetector model variants.","code":""},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"gdverse | Geodetector Models In R\n","text":"can install development version gdverse github : install gdverse r-universe:","code":"# install.packages(\"devtools\") devtools::install_github(\"SpatLyu/gdverse\",build_vignettes = T,dep = T) install.packages('gdverse', repos='https://spatlyu.r-universe.dev')"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"load-data-and-package","dir":"","previous_headings":"Installation","what":"Load data and package","title":"gdverse | Geodetector Models In R\n","text":"","code":"library(terra) library(tidyverse) library(gdverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) head(fvc) ## # A tibble: 6 × 13 ## fvc premax premin presum tmpmax tmpmin tmpavg pop ntl lulc elev slope ## ## 1 0.188 163. 6.86 3992. 21.2 -7.09 8.54 5.64 9.10 10 1645. 2.96 ## 2 0.162 162. 5.23 3922. 21.7 -6.90 8.92 23.1 10.5 10 1539. 1.86 ## 3 0.168 168. 4.15 4040. 21.2 -7.22 8.53 9.73 5.58 10 1611. 3.19 ## 4 0.186 174. 5.99 4254. 20.8 -7.42 8.21 6.84 2.89 10 1677. 3.32 ## 5 0.189 164. 7.86 4047. 21.2 -7.00 8.58 2.36 12.3 10 1643. 2.79 ## 6 0.171 161. 5.23 3944. 21.7 -6.85 8.91 3.17 10.1 10 1553. 1.93 ## # ℹ 1 more variable: aspect "},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"opgd-model","dir":"","previous_headings":"Installation","what":"OPGD model","title":"gdverse | Geodetector Models In R\n","text":"","code":"tictoc::tic() fvc_opgd = opgd(fvc ~ ., data = fvc, discnum = 3:15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = 'factor') tictoc::toc() ## 2.91 sec elapsed fvc_opgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"gozh-model","dir":"","previous_headings":"Installation","what":"GOZH model","title":"gdverse | Geodetector Models In R\n","text":"","code":"g = gozh(fvc ~ ., data = fvc, cores = 6) g ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/index.html","id":"rgd-model","dir":"","previous_headings":"Installation","what":"RGD model","title":"gdverse | Geodetector Models In R\n","text":"run RGD,remember set python dependence, see RGD vignette get details.","code":"reticulate::use_condaenv('geocompy') tictoc::tic() fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 10, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = 'factor') tictoc::toc() ## 1844.56 sec elapsed fvc_rgd ## Spatial Stratified Heterogeneity Test ## ## Factor detector"},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":null,"dir":"Reference","previous_headings":"","what":"measure information loss by information entropy — F_informationloss","title":"measure information loss by information entropy — F_informationloss","text":"Function measure information loss information entropy.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"measure information loss by information entropy — F_informationloss","text":"","code":"F_informationloss(xvar, xdisc)"},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"measure information loss by information entropy — F_informationloss","text":"xvar original un-discretized vector. xdisc discretized vector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"measure information loss by information entropy — F_informationloss","text":"value information loss measured information entropy.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"measure information loss by information entropy — F_informationloss","text":"power spatial determinant formula \\(F = -\\sum\\limits_{=1}^N p_{()}\\log_2 p_{()} - \\left(-\\sum\\limits_{h=1}^L p_{(h)}\\log_2 p_{(h)}\\right)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/F_informationloss.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"measure information loss by information entropy — F_informationloss","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"compensated power of spatial determinant(CPSD) — cpsd_spade","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Function calculate compensated power spatial determinant \\(Q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"","code":"cpsd_spade(yobs, xobs, xdisc, wt)"},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"yobs Variable Y xobs original un-discretized covariable X. xdisc discretized covariable X. wt spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"value compensated power spatial determinant \\(Q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"power compensated spatial determinant formula \\(Q_s = \\frac{q_s}{q_{s_{inforkep}}} = \\frac{1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_{kdep}}{N \\Gamma_{totaldep}}}{1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_{hind}}{N \\Gamma_{totalind}}}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/cpsd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"compensated power of spatial determinant(CPSD) — cpsd_spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() wt = inverse_distance_weight(coord[,1],coord[,2]) BH = usfi$BH BH_disc = st_unidisc(usfi$BH,12) SUHI = usfi$SUHI cpsd_spade(SUHI,BH,BH_disc,wt) }"},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"ecological detector — ecological_detector","title":"ecological detector — ecological_detector","text":"Compare effects two factors \\(X_1\\) \\(X_2\\) spatial distribution attribute \\(Y\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ecological detector — ecological_detector","text":"","code":"ecological_detector(y, x1, x2, alpha = 0.95)"},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ecological detector — ecological_detector","text":"y Dependent variable, continuous numeric vector. x1 Covariable \\(X_1\\), factor, character discrete numeric. x2 Covariable \\(X_2\\), factor, character discrete numeric. alpha (optional) Confidence level interval,default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ecological detector — ecological_detector","text":"list contains F statistics, p-values, significant difference two factors \\(X_1\\) \\(X_2\\) spatial distribution attribute \\(Y\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/ecological_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ecological detector — ecological_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"factor detector — factor_detector","title":"factor detector — factor_detector","text":"factor detector q-statistic measures spatial stratified heterogeneity variable Y, determinant power covariate X Y.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"factor detector — factor_detector","text":"","code":"factor_detector(y, x)"},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"factor detector — factor_detector","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"factor detector — factor_detector","text":"list contains Q-statistic p-value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/factor_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"factor detector — factor_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":null,"dir":"Reference","previous_headings":"","what":"original geographical detector model — gd","title":"original geographical detector model — gd","text":"Function original geographical detector model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"original geographical detector model — gd","text":"","code":"gd(formula, data, type = \"factor\", ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"original geographical detector model — gd","text":"formula formula geographical detector model. data data.frame tibble observation data. type (optional) type geographical detector,must one factor(default), interaction, risk, ecological. ... (optional) Specifies size alpha (confidence level).Default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"original geographical detector model — gd","text":"tibble corresponding result stored corresponding detector type.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"original geographical detector model — gd","text":"Jin‐Feng Wang, Xin‐Hu Li, George Christakos, Yi‐Lan Liao, Tin Zhang, XueGu & Xiao‐Ying Zheng (2010) Geographical Detectors‐Based Health Risk Assessment Application Neural Tube Defects Study Heshun Region, China, International Journal Geographical Information Science, 24:1, 107-127, DOI: 10.1080/13658810802443457","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"original geographical detector model — gd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"original geographical detector model — gd","text":"","code":"gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3)))) #> Spatial Stratified Heterogeneity Test #> #> Factor detector #> #> ---------------------------------- #> variable Q-statistic P-value #> ---------- ------------- --------- #> x2 0.8929 0.03168 #> #> x1 0.7714 0.07936 #> ---------------------------------- #> gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'interaction') #> Spatial Stratified Heterogeneity Test #> #> Interaction detector #> #> ------------------------------------------ #> Interactive variable Interaction #> ---------------------- ------------------- #> x1 ∩ x2 Weaken, nonlinear #> ------------------------------------------ #> gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'risk',alpha = 0.95) #> Spatial Stratified Heterogeneity Test #> #> Risk detector #> #> -------------------------------------- #> Variable x1: #> #> | |x |y |z | #> |:--|:--|:---|:---| #> |x |NA |No |No | #> |y |No |NA |Yes | #> |z |No |Yes |NA | #> -------------------------------------- #> Variable x2: #> #> | |a |b |c | #> |:--|:---|:---|:---| #> |a |NA |No |Yes | #> |b |No |NA |Yes | #> |c |Yes |Yes |NA | gd(y ~ x1 + x2, tibble::tibble(y = 1:7, x1 = c('x',rep('y',3),rep('z',3)), x2 = c(rep('a',2),rep('b',2),rep('c',3))), type = 'ecological',alpha = 0.95) #> Spatial Stratified Heterogeneity Test #> #> ecological detector #> #> -------------------------------------- #> #> #> | |x2 | #> |:--|:--| #> |x1 |No |"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":null,"dir":"Reference","previous_headings":"","what":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"Function determining best univariate discretization based geodetector q-statistic.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"","code":"gd_bestunidisc( formula, data, discnum = NULL, discmethod = NULL, cores = 1, return_disc = TRUE, seed = 123456789, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"formula formula best univariate discretization. data data.frame tibble observation data. discnum (optional) vector number classes discretization. Default 3:15. discmethod (optional) vector methods discretization,default using c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. return_disc (optional) Whether return discretized result used optimal parameter. Default TRUE. seed (optional) Random seed number, default 123456789.Setting random seed useful sample size greater 3000(default value largeN) data discretized sampling 10%(default value samp_prop). ... (optional) arguments passed st_unidisc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"list optimal parameter provided parameter combination k, method disc(return_disc TRUE).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_bestunidisc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"best univariate discretization based on geodetector q-statistic — gd_bestunidisc","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) g = gd_bestunidisc(fvc ~ .,data = select(fvc,-lulc),discnum = 3:15,cores = 6) g }"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":null,"dir":"Reference","previous_headings":"","what":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"q-statistics geographical detector based recursive partitioning","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"","code":"gd_rpart(formula, data, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"formula formula. data data.frame tibble observation data. ... (optional) arguments passed rpart::rpart().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"tibble contains Q-statistic p-value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"Luo, P., Song, Y., Huang, X., Ma, H., Liu, J., Yao, Y., & Meng, L. (2022). Identifying determinants spatio-temporal disparities soil moisture Northern Hemisphere using geographically optimal zones-based heterogeneity model. ISPRS Journal Photogrammetry Remote Sensing: Official Publication International Society Photogrammetry Remote Sensing (ISPRS), 185, 111–128. https://doi.org/10.1016/j.isprsjprs.2022.01.009","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_rpart.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"q-statistics of geographical detector based on recursive partitioning — gd_rpart","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":null,"dir":"Reference","previous_headings":"","what":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Function comparison size effects spatial units spatial heterogeneity analysis based optimal parameters geographical detector(OPGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"","code":"gd_sesu( formula, datalist, su, discvar, discnum = NULL, discmethod = NULL, cores = 1, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"formula formula comparison size effects spatial units. datalist list data.frame tibble. su vector sizes spatial units. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) vector number classes discretization. Default 2:15. discmethod (optional) vector methods discretization,default used c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. ... (optional) arguments passed gd_bestunidisc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"nested tibble spatial_units, sesu_result data.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Song, Y., Wang, J., Ge, Y. & Xu, C. (2020) optimal parameters-based geographical detector model enhances geographic characteristics explanatory variables spatial heterogeneity analysis: Cases different types spatial data, GIScience & Remote Sensing, 57(5), 593-610. doi: 10.1080/15481603.2020.1760434.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gd_sesu.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"comparison of size effects of spatial units based on optimal parameters geographical detector(OPGD) model. — gd_sesu","text":"","code":"if (FALSE) { library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc1000 = fvc %>% terra::as.data.frame(na.rm = T) %>% as_tibble() fvc5000 = fvc %>% terra::aggregate(fact = 5) %>% terra::as.data.frame(na.rm = T) %>% as_tibble() gd_sesu(fvc ~ ., datalist = list(fvc1000,fvc5000), su = c(1000,5000), discnum = 2:15, discvar = names(select(fvc5000,-c(fvc,lulc))), cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":null,"dir":"Reference","previous_headings":"","what":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Function geographically optimal zones-based heterogeneity(GOZH) model","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"","code":"gozh(formula, data, cores = 1, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"formula formula GOZH model. data data.frame tibble observation data. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. ... (optional) arguments passed rpart::rpart().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"list GOZH model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Luo, P., Song, Y., Huang, X., Ma, H., Liu, J., Yao, Y., & Meng, L. (2022). Identifying determinants spatio-temporal disparities soil moisture Northern Hemisphere using geographically optimal zones-based heterogeneity model. ISPRS Journal Photogrammetry Remote Sensing: Official Publication International Society Photogrammetry Remote Sensing (ISPRS), 185, 111–128. https://doi.org/10.1016/j.isprsjprs.2022.01.009","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/gozh.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"geographically optimal zones-based heterogeneity(GOZH) model — gozh","text":"","code":"if (FALSE) { ndvi = GD::ndvi_40 g = gozh(NDVIchange ~ ., data = ndvi) g }"},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"interaction detector — interaction_detector","title":"interaction detector — interaction_detector","text":"Identify interaction different risk factors, , assess whether factors X1 X2 together increase decrease explanatory power dependent variable Y, whether effects factors Y independent .","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"interaction detector — interaction_detector","text":"","code":"interaction_detector(y, x1, x2)"},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"interaction detector — interaction_detector","text":"y Dependent variable, continuous numeric vector. x1 Covariable \\(X_1\\), factor, character discrete numeric. x2 Covariable \\(X_2\\), factor, character discrete numeric.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"interaction detector — interaction_detector","text":"list contains Q statistic factors \\(X_1\\) \\(X_1\\) act \\(Y\\) alone Q statistic two interact \\(Y\\) together result type interaction detector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/interaction_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"interaction detector — interaction_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":null,"dir":"Reference","previous_headings":"","what":"calculate inverse distance weight — inverse_distance_weight","title":"calculate inverse distance weight — inverse_distance_weight","text":"Function calculate inverse distance weight.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"calculate inverse distance weight — inverse_distance_weight","text":"","code":"inverse_distance_weight(locx, locy, power = 1, is_arc = FALSE)"},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"calculate inverse distance weight — inverse_distance_weight","text":"locx x axis location. locy y axis location. power (optional) Default 1. Set 2 gravity weights. is_arc (optional) FALSE (default) TRUE, whether compute arc distance.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"calculate inverse distance weight — inverse_distance_weight","text":"inverse distance weight matrices class matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"calculate inverse distance weight — inverse_distance_weight","text":"inverse distance weight formula \\(w_{ij} = 1 / d_{ij}^\\alpha\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"calculate inverse distance weight — inverse_distance_weight","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/inverse_distance_weight.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"calculate inverse distance weight — inverse_distance_weight","text":"","code":"x = 1:10 y = 1:10 inverse_distance_weight(x,y) #> 1 2 3 4 5 6 7 #> 1 0.00000000 0.70710678 0.3535534 0.2357023 0.1767767 0.1414214 0.1178511 #> 2 0.70710678 0.00000000 0.7071068 0.3535534 0.2357023 0.1767767 0.1414214 #> 3 0.35355339 0.70710678 0.0000000 0.7071068 0.3535534 0.2357023 0.1767767 #> 4 0.23570226 0.35355339 0.7071068 0.0000000 0.7071068 0.3535534 0.2357023 #> 5 0.17677670 0.23570226 0.3535534 0.7071068 0.0000000 0.7071068 0.3535534 #> 6 0.14142136 0.17677670 0.2357023 0.3535534 0.7071068 0.0000000 0.7071068 #> 7 0.11785113 0.14142136 0.1767767 0.2357023 0.3535534 0.7071068 0.0000000 #> 8 0.10101525 0.11785113 0.1414214 0.1767767 0.2357023 0.3535534 0.7071068 #> 9 0.08838835 0.10101525 0.1178511 0.1414214 0.1767767 0.2357023 0.3535534 #> 10 0.07856742 0.08838835 0.1010153 0.1178511 0.1414214 0.1767767 0.2357023 #> 8 9 10 #> 1 0.1010153 0.08838835 0.07856742 #> 2 0.1178511 0.10101525 0.08838835 #> 3 0.1414214 0.11785113 0.10101525 #> 4 0.1767767 0.14142136 0.11785113 #> 5 0.2357023 0.17677670 0.14142136 #> 6 0.3535534 0.23570226 0.17677670 #> 7 0.7071068 0.35355339 0.23570226 #> 8 0.0000000 0.70710678 0.35355339 #> 9 0.7071068 0.00000000 0.70710678 #> 10 0.3535534 0.70710678 0.00000000 inverse_distance_weight(x,y,is_arc = TRUE) #> 1 2 3 4 5 #> 1 0.000000e+00 6.374455e-06 3.187704e-06 2.125559e-06 1.594567e-06 #> 2 6.374455e-06 0.000000e+00 6.376358e-06 3.188893e-06 2.126512e-06 #> 3 3.187704e-06 6.376358e-06 0.000000e+00 6.379213e-06 3.190559e-06 #> 4 2.125559e-06 3.188893e-06 6.379213e-06 0.000000e+00 6.383020e-06 #> 5 1.594567e-06 2.126512e-06 3.190559e-06 6.383020e-06 0.000000e+00 #> 6 1.276036e-06 1.595401e-06 2.127782e-06 3.192702e-06 6.387781e-06 #> 7 1.063735e-06 1.276799e-06 1.596473e-06 2.129370e-06 3.195321e-06 #> 8 9.121387e-07 1.064452e-06 1.277753e-06 1.597785e-06 2.131276e-06 #> 9 7.984820e-07 9.128220e-07 1.065328e-06 1.278899e-06 1.599335e-06 #> 10 7.101191e-07 7.991407e-07 9.136421e-07 1.066363e-06 1.280236e-06 #> 6 7 8 9 10 #> 1 1.276036e-06 1.063735e-06 9.121387e-07 7.984820e-07 7.101191e-07 #> 2 1.595401e-06 1.276799e-06 1.064452e-06 9.128220e-07 7.991407e-07 #> 3 2.127782e-06 1.596473e-06 1.277753e-06 1.065328e-06 9.136421e-07 #> 4 3.192702e-06 2.129370e-06 1.597785e-06 1.278899e-06 1.066363e-06 #> 5 6.387781e-06 3.195321e-06 2.131276e-06 1.599335e-06 1.280236e-06 #> 6 0.000000e+00 6.393494e-06 3.198417e-06 2.133500e-06 1.601124e-06 #> 7 6.393494e-06 0.000000e+00 6.400162e-06 3.201991e-06 2.136043e-06 #> 8 3.198417e-06 6.400162e-06 0.000000e+00 6.407785e-06 3.206043e-06 #> 9 2.133500e-06 3.201991e-06 6.407785e-06 0.000000e+00 6.416364e-06 #> 10 1.601124e-06 2.136043e-06 3.206043e-06 6.416364e-06 0.000000e+00"},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":null,"dir":"Reference","previous_headings":"","what":"optimal parameters geographical detector(OPGD) model — opgd","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Function optimal parameters geographical detector(OPGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"","code":"opgd( formula, data, discvar, discnum = NULL, discmethod = NULL, cores = 1, type = \"factor\", alpha = 0.95, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"formula formula OPGD model. data data.frame tibble observation data. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) vector number classes discretization. Default 3:15. discmethod (optional) vector methods discretization,default using c(\"sd\",\"equal\",\"pretty\",\"quantile\",\"fisher\",\"headtails\",\"maximum\",\"box\")spEcula. cores (optional) positive integer(default 1). cores > 1, 'parallel' package cluster many cores created used. can also supply cluster object. type (optional) type geographical detector,must factor(default), interaction, risk, ecological.can run one time. alpha (optional) Specifies size confidence level.Default 0.95. ... (optional) arguments passed gd_bestunidisc().useful parameter seed, used set random number seed.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"list OPGD model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Song, Y., Wang, J., Ge, Y. & Xu, C. (2020) optimal parameters-based geographical detector model enhances geographic characteristics explanatory variables spatial heterogeneity analysis: Cases different types spatial data, GIScience & Remote Sensing, 57(5), 593-610. doi: 10.1080/15481603.2020.1760434.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/opgd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"optimal parameters geographical detector(OPGD) model — opgd","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) opgd(fvc ~ ., data = fvc, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type =c('factor','interaction')) }"},{"path":"https://spatlyu.github.io/gdverse/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print ecological detector — print.ecological_detector","title":"print ecological detector — print.ecological_detector","text":"S3 method format output ecological detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print ecological detector — print.ecological_detector","text":"","code":"# S3 method for ecological_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print ecological detector — print.ecological_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print ecological detector — print.ecological_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.ecological_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print ecological detector — print.ecological_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print factor detector — print.factor_detector","title":"print factor detector — print.factor_detector","text":"S3 method format output factor detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print factor detector — print.factor_detector","text":"","code":"# S3 method for factor_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print factor detector — print.factor_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print factor detector — print.factor_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.factor_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print factor detector — print.factor_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print interaction detector — print.interaction_detector","title":"print interaction detector — print.interaction_detector","text":"S3 method format output interaction detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print interaction detector — print.interaction_detector","text":"","code":"# S3 method for interaction_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print interaction detector — print.interaction_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print interaction detector — print.interaction_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.interaction_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print interaction detector — print.interaction_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"print risk detector — print.risk_detector","title":"print risk detector — print.risk_detector","text":"S3 method format output risk detector gd().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print risk detector — print.risk_detector","text":"","code":"# S3 method for risk_detector print(x, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print risk detector — print.risk_detector","text":"x Return gd(). ... arguments.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print risk detector — print.risk_detector","text":"Formatted string output","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/print.risk_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print risk detector — print.risk_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":null,"dir":"Reference","previous_headings":"","what":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Function calculate power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"","code":"psd_pseudop(y, x, wt, cores = 6, seed = 123456789, permutations = 99)"},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. wt spatial weight matrix. cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99. permutations 0, pseudo-p values calculated.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"tibble power spatial determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"power spatial determinant formula \\(q_s = 1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_h}{N \\Gamma}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_pseudop.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"calculate power of spatial determinant(PSD) and the corresponding pseudo-p value — psd_pseudop","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial determinant(PSD) — psd_spade","title":"power of spatial determinant(PSD) — psd_spade","text":"Function calculate power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial determinant(PSD) — psd_spade","text":"","code":"psd_spade(y, x, wt)"},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial determinant(PSD) — psd_spade","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. wt spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial determinant(PSD) — psd_spade","text":"value power spatial determinant \\(q_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial determinant(PSD) — psd_spade","text":"power spatial determinant formula \\(q_s = 1 - \\frac{\\sum_{h=1}^L N_h \\Gamma_h}{N \\Gamma}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial determinant(PSD) — psd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial determinant(PSD) — psd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial determinant(PSD) — psd_spade","text":"","code":"if (FALSE) { library(sf) library(tidyverse) ntdspath = system.file(\"extdata\", \"NTDs.gpkg\",package = 'gdverse') watershed = read_sf(ntdspath,layer = 'watershed') elevation = read_sf(ntdspath,layer = 'elevation') soiltype = read_sf(ntdspath,layer = 'soiltype') disease = read_sf(ntdspath,layer = 'disease') NTDs = disease %>% st_centroid() %>% st_join(watershed[,\"watershed\"]) %>% st_join(elevation[,\"elevation\"]) %>% st_join(soiltype[,\"soiltype\"])%>% dplyr::filter(if_all(everything(),~!is.na(.x))) NTDs = NTDs %>% st_coordinates() %>% dplyr::bind_cols(NTDs,.) wt = inverse_distance_weight(NTDs$X,NTDs$Y) psd_spade(NTDs$disease,NTDs$soiltype,wt) }"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Function calculate power spatial multilevel discretization determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"","code":"psmd_pseudop( formula, data, wt = NULL, locations = NULL, discnum = NULL, discmethod = NULL, cores = 6, seed = 123456789, permutations = 99, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"formula formula calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\). data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc().Now support one discmethod one time. cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99. permutations 0, pseudo-p values calculated. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"tibble power spatial multilevel discretization determinant corresponding pseudo-p value.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"power spatial multilevel discretization determinant formula \\(PSMDQ_s = MEAN(Q_s)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_pseudop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial and multilevel discretization determinant(PSMD) and the corresponding pseudo-p value — psmd_pseudop","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() tictoc::tic() pp = psmd_pseudop('SUHI ~ BH',data = dplyr::select(usfi,SUHI,BH,X,Y), locations = c('X','Y'),cores = 6) tictoc::toc() pp }"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":null,"dir":"Reference","previous_headings":"","what":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Function calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"","code":"psmd_spade( formula, data, wt = NULL, locations = NULL, discnum = NULL, discmethod = NULL, cores = 1, seed = 123456789, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"formula formula calculate power spatial multilevel discretization determinant \\(PSMDQ_s\\). data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc().Now support one discmethod one time. cores (optional) positive integer(default 1). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"value power spatial multilevel discretization determinant \\(PSMDQ_s\\).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"power spatial multilevel discretization determinant formula \\(PSMDQ_s = MEAN(Q_s)\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/psmd_spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"power of spatial and multilevel discretization determinant(PSMD) — psmd_spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() psmd_spade('SUHI ~ BH',data = dplyr::select(usfi,SUHI,BH,X,Y), locations = c('X','Y'),cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"rescale continuous vector to specified minimum and maximum — rescale_vector","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"rescale continuous vector specified minimum maximum","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"","code":"rescale_vector(x, to_left = 0, to_right = 1)"},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"x continuous numeric vector. to_left (optional) Specified minimum. Default 0. to_right (optional) Specified maximum. Default 1.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"continuous vector rescaled.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rescale_vector.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"rescale continuous vector to specified minimum and maximum — rescale_vector","text":"","code":"rescale_vector(c(-5,1,5),0.01,0.99) #> [1] 0.010 0.598 0.990"},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":null,"dir":"Reference","previous_headings":"","what":"robust geographical detector(RGD) model — rgd","title":"robust geographical detector(RGD) model — rgd","text":"Function robust geographical detector(RGD) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"robust geographical detector(RGD) model — rgd","text":"","code":"rgd( formula, data, discvar, discnum = NULL, minsize = NULL, cores = 1, type = \"factor\", alpha = 0.95, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"robust geographical detector(RGD) model — rgd","text":"formula formula RGD model. data data.frame tibble observation data. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum numeric vector discretized classes columns need discretized. Default discvar use 10. minsize (optional) min size discretization group.Default use 1. cores (optional) Positive integer(default 1). cores > 1, use python's joblib package parallel computation. type (optional) type geographical detector,must factor(default), interaction, risk, ecological.can run one time. alpha (optional) Specifies size confidence level.Default 0.95. ... (optional) arguments passed robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"robust geographical detector(RGD) model — rgd","text":"list RGD model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"robust geographical detector(RGD) model — rgd","text":"Zhang, Z., Song, Y.*, & Wu, P., 2022. Robust geographical detector. International Journal Applied Earth Observation Geoinformation. 109, 102782. DOI: 10.1016/j.jag.2022.102782.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"robust geographical detector(RGD) model — rgd","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/rgd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"robust geographical detector(RGD) model — rgd","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) rgd(fvc ~ ., data = fvc, discnum = 10, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type =c('factor','interaction')) }"},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":null,"dir":"Reference","previous_headings":"","what":"risk detector — risk_detector","title":"risk detector — risk_detector","text":"Determine whether significant difference attribute means two subregions.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"risk detector — risk_detector","text":"","code":"risk_detector(y, x, alpha = 0.95)"},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"risk detector — risk_detector","text":"y Variable Y, continuous numeric vector. x Covariable X, factor, character discrete numeric. alpha (optional) Confidence level interval,default 0.95.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"risk detector — risk_detector","text":"tibble contains different combinations covariate X level student t-test statistics, degrees freedom, p-values, whether risk (Yes ).","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/risk_detector.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"risk detector — risk_detector","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":null,"dir":"Reference","previous_headings":"","what":"univariate discretization based on offline change point detection. — robust_disc","title":"univariate discretization based on offline change point detection. — robust_disc","text":"Determines discretization interval breaks using optimization algorithm variance-based change point detection.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"univariate discretization based on offline change point detection. — robust_disc","text":"","code":"robust_disc(formula, data, discnum, minsize = NULL, cores = 1)"},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"univariate discretization based on offline change point detection. — robust_disc","text":"formula formula univariate discretization. data data.frame tibble observation data. discnum numeric vector discretized classes columns need discretized. minsize (optional) min size discretization group.Default use 1. cores (optional) positive integer(default 1). cores > 1, use python's joblib package parallel computation.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"univariate discretization based on offline change point detection. — robust_disc","text":"tibble discretized classes columns need discretized.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"univariate discretization based on offline change point detection. — robust_disc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/robust_disc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"univariate discretization based on offline change point detection. — robust_disc","text":"","code":"if (FALSE) { library(terra) library(tidyverse) fvcpath = \"https://github.com/SpatLyu/rdevdata/raw/main/FVC.tif\" fvc = terra::rast(paste0(\"/vsicurl/\",fvcpath)) fvc = terra::aggregate(fvc,fact = 5) fvc = as_tibble(terra::as.data.frame(fvc,na.rm = T)) new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 10,cores = 6) new.fvc }"},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":null,"dir":"Reference","previous_headings":"","what":"randomly shuffling vector — shuffle_vector","title":"randomly shuffling vector — shuffle_vector","text":"randomly shuffling vector","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"randomly shuffling vector — shuffle_vector","text":"","code":"shuffle_vector(x, shuffle_rate, seed = 123456789)"},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"randomly shuffling vector — shuffle_vector","text":"x vector. shuffle_rate shuffling rate. seed (optional) Random seed number. Default 123456789.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/shuffle_vector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"randomly shuffling vector — shuffle_vector","text":"shuffled vector.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":null,"dir":"Reference","previous_headings":"","what":"spatial association detector (SPADE) model — spade","title":"spatial association detector (SPADE) model — spade","text":"Function spatial association detector (SPADE) model.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"spatial association detector (SPADE) model — spade","text":"","code":"spade( formula, data, wt = NULL, locations = NULL, discvar = NULL, discnum = NULL, discmethod = NULL, cores = 6, seed = 123456789, permutations = 99, ... )"},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"spatial association detector (SPADE) model — spade","text":"formula formula spatial association detector (SPADE) model. data data.frame tibble observation data. wt (optional) spatial weight matrix.wt provided, must provide locations. gdverse use locations columns construct spatial weight use inverse_distance_weight(). locations (optional) geospatial locations coordinate columns name data. Useful must provided wt provided. discvar Name continuous variable columns need discretized.Noted formula discvar, data must columns. discnum (optional) Number multilevel discretization.Default use 3:15. discmethod (optional) discretization methods. Default use quantile. discmethod robust use robust_disc(), others use st_unidisc() cores (optional) positive integer(default 6). cores > 1, use parallel computation. seed (optional) Random seed number, default 123456789. permutations (optional) number permutations PSD computation. Default 99. permutations 0, pseudo-p values calculated. ... (optional) arguments passed st_unidisc() robust_disc().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"spatial association detector (SPADE) model — spade","text":"list SPADE model result.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"spatial association detector (SPADE) model — spade","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"spatial association detector (SPADE) model — spade","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spade.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"spatial association detector (SPADE) model — spade","text":"","code":"if (FALSE) { library(sf) usfi = read_sf(system.file('extdata/USFI_Xian.gpkg',package = 'gdverse')) |> dplyr::select(dplyr::all_of(c(\"NDVI\",\"BH\",\"SUHI\"))) coord = usfi |> st_centroid() |> st_coordinates() wt = inverse_distance_weight(coord[,1],coord[,2]) usfi = usfi |> dplyr::bind_cols(coord) |> st_drop_geometry() spade('SUHI~.', data = usfi,locations = c('X','Y'), discvar = c('BH','NDVI'), cores = 6) spade('SUHI~.', data = usfi, wt = wt, discvar = c('BH','NDVI'),locations = c('X','Y'), discmethod = c('sd','equal'),cores = 6) }"},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":null,"dir":"Reference","previous_headings":"","what":"spatial variance — spvar","title":"spatial variance — spvar","text":"Function calculate inverse distance weight.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"spatial variance — spvar","text":"","code":"spvar(yn, wtn)"},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"spatial variance — spvar","text":"yn numerical vector response variable. wtn spatial weight matrix.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"spatial variance — spvar","text":"spatial variance","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"spatial variance — spvar","text":"spatial variance formula \\(\\Gamma = \\frac{\\sum_i \\sum_{j \\neq } \\omega_{ij}\\frac{(y_i-y_j)^2}{2}}{\\sum_i \\sum_{j \\neq } \\omega_{ij}}\\)","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"spatial variance — spvar","text":"Xuezhi Cang & Wei Luo (2018) Spatial association detector (SPADE),International Journal Geographical Information Science, 32:10, 2055-2075, DOI: 10.1080/13658816.2018.1476693","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"spatial variance — spvar","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/spvar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"spatial variance — spvar","text":"","code":"y = c(42,56,73) wt1 = inverse_distance_weight(1:length(y),1:length(y)) wt2 = matrix(1,ncol = length(y),nrow = length(y)) diag(wt2) = 0 spvar(y,wt1) #> [1] 193.1 spvar(y,wt2) #> [1] 241 var(y) #> [1] 241"},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":null,"dir":"Reference","previous_headings":"","what":"univariate discretization — st_unidisc","title":"univariate discretization — st_unidisc","text":"Function classify univariate vector interval,wrapper classInt::classify_intervals().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"univariate discretization — st_unidisc","text":"","code":"st_unidisc(x, k, method = \"quantile\", factor = FALSE, seed = 123456789, ...)"},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"univariate discretization — st_unidisc","text":"x continuous numerical variable. k (optional) Number classes required, missing, grDevices::nclass.Sturges() used; see also \"dpih\" \"headtails\" styles automatic choice number classes. k must greater 3 ! method Chosen classify style: one \"fixed\", \"sd\", \"equal\", \"pretty\", \"quantile\", \"kmeans\", \"hclust\", \"bclust\", \"fisher\", \"jenks\", \"dpih\", \"headtails\", \"maximum\", \"box\".Default quantile. factor (optional) Default FALSE, TRUE returns cols factor intervals labels rather integers. seed (optional) Random seed number, default 123456789.Setting random seed useful sample size greater 3000(default value largeN) data discretized sampling 10%(default value samp_prop). ... (optional) arguments passed classInt::classify_intervals(), see ?classInt::classify_intervals().","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"univariate discretization — st_unidisc","text":"discrete vectors classified.","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"univariate discretization — st_unidisc","text":"Wenbo Lv lyu.geosocial@gmail.com","code":""},{"path":"https://spatlyu.github.io/gdverse/reference/st_unidisc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"univariate discretization — st_unidisc","text":"","code":"xvar = c(22361, 9573, 4836, 5309, 10384, 4359, 11016, 4414, 3327, 3408, 17816, 6909, 6936, 7990, 3758, 3569, 21965, 3605, 2181, 1892, 2459, 2934, 6399, 8578, 8537, 4840, 12132, 3734, 4372, 9073, 7508, 5203) st_unidisc(xvar,k = 6,method = 'sd') #> [1] 5 3 2 2 3 2 3 2 2 2 5 2 2 3 2 2 5 2 2 1 2 2 2 3 3 2 3 2 2 3 3 2"},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"gdverse-development-version","dir":"Changelog","previous_headings":"","what":"gdverse (development version)","title":"gdverse (development version)","text":"Support geodetector model variants fix bugs gdverse.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-1-0","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.1.0","text":"Support SPADE model. Change default random seed number 12345678 123456789.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-3","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.3","text":"Support GOZH model.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-2","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.2","text":"Solve computational stability problem OPGD model.","code":""},{"path":[]},{"path":"https://spatlyu.github.io/gdverse/news/index.html","id":"major-changes-0-0-1","dir":"Changelog","previous_headings":"","what":"Major changes","title":"gdverse 0.0.1","text":"Can now work well OPGD RGD model.","code":""}]