Chapter 14 Proximity and Areal Data

Learning objectives:

  • consider the definition of areal data
  • discuss matters of graph theory
  • explore various methods of finding neighbors
library("dbscan")     #density-based clustering
library("igraph")     #graph networks
library("Matrix")     #for sparse representation
library("sf")         #simple features
library("spatialreg") #spatial regression analysis
library("spdep")      #spatial dependence
library("tmap")       #quick, thematic maps

data(pol_pres15, package = "spDataLarge") #Poland 2015 election data

sessionInfo()
## R version 4.3.3 (2024-02-29)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
## 
## locale:
##  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
##  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
##  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
## [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
## 
## time zone: UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] tmap_3.3-4              spdep_1.3-3             spatialreg_1.3-2       
##  [4] spData_2.3.0            Matrix_1.6-5            igraph_2.0.3           
##  [7] dbscan_1.1-12           class_7.3-22            randomForest_4.7-1.1   
## [10] lubridate_1.9.3         forcats_1.0.0           stringr_1.5.1          
## [13] purrr_1.0.2             readr_2.1.5             tibble_3.2.1           
## [16] tidyverse_2.0.0         xts_0.13.2              zoo_1.8-12             
## [19] units_0.8-5             tidyr_1.3.1             spDataLarge_2.1.1      
## [22] MASS_7.3-60.0.1         cubelyr_1.0.2           colorspace_2.1-0       
## [25] stars_0.6-5             abind_1.4-5             s2_1.1.6               
## [28] rnaturalearthdata_1.0.0 rnaturalearth_1.0.1     maps_3.4.2             
## [31] ggplot2_3.5.0           dplyr_1.1.4             sf_1.0-16              
## 
## loaded via a namespace (and not attached):
##  [1] DBI_1.2.2          deldir_2.0-4       tmaptools_3.1-1    sandwich_3.1-0    
##  [5] rlang_1.1.3        magrittr_2.0.3     multcomp_1.4-25    e1071_1.7-14      
##  [9] compiler_4.3.3     png_0.1-8          vctrs_0.6.5        pkgconfig_2.0.3   
## [13] wk_0.9.1           fastmap_1.1.1      backports_1.4.1    leafem_0.2.3      
## [17] lwgeom_0.2-14      labeling_0.4.3     utf8_1.2.4         rmarkdown_2.26    
## [21] tzdb_0.4.0         xfun_0.43          cachem_1.0.8       jsonlite_1.8.8    
## [25] highr_0.10         terra_1.7-71       broom_1.0.5        parallel_4.3.3    
## [29] LearnBayes_2.15.1  R6_2.5.1           bslib_0.7.0        stringi_1.8.3     
## [33] RColorBrewer_1.1-3 boot_1.3-29        jquerylib_0.1.4    Rcpp_1.0.12       
## [37] bookdown_0.38      knitr_1.45         base64enc_0.1-3    splines_4.3.3     
## [41] timechange_0.3.0   tidyselect_1.2.1   dichromat_2.0-0.1  rstudioapi_0.16.0 
## [45] yaml_2.3.8         codetools_0.2-19   leafsync_0.1.0     lattice_0.22-5    
## [49] withr_3.0.0        coda_0.19-4.1      evaluate_0.23      survival_3.5-8    
## [53] proxy_0.4-27       pillar_1.9.0       KernSmooth_2.23-22 generics_0.1.3    
## [57] sp_2.1-3           hms_1.1.3          munsell_0.5.1      scales_1.3.0      
## [61] glue_1.7.0         tools_4.3.3        XML_3.99-0.16.1    mvtnorm_1.2-4     
## [65] grid_4.3.3         crosstalk_1.2.1    nlme_3.1-164       raster_3.6-26     
## [69] cli_3.6.2          fansi_1.0.6        viridisLite_0.4.2  gtable_0.3.4      
## [73] sass_0.4.9         digest_0.6.35      classInt_0.4-10    TH.data_1.1-2     
## [77] htmlwidgets_1.6.4  farver_2.1.1       htmltools_0.5.8.1  lifecycle_1.0.4   
## [81] leaflet_2.2.2      httr_1.4.7