15.4 The rgeoda package
## name value
## 1 number of observations: 2495
## 2 is symmetric: TRUE
## 3 sparsity: 0.00228786229774178
## 4 # min neighbors: 1
## 5 # max neighbors: 13
## 6 # mean neighbors: 5.70821643286573
## 7 # median neighbors: 6
## 8 has isolates: FALSE
?queen_weights
Local Multivariate Geary Statistics
?local_multigeary
library(parallel)
lisa <- local_multigeary(Geoda_w,
pol_pres15[c("I_turnout", "II_turnout")],
cpu_threads = max(detectCores() - 1, 1),
permutations = 99999,
seed = 1)## [1] TRUE
Let’s use the Local Geary’s measure to compute local adaptation of Geary’s C statistic of spatial autocorrelation.
The Local Geary uses squared differences to measure dissimilarity unlike the Local Moran. Low values of the Local Geary indicate positive spatial autocorrelation and large refers to negative spatial autocorrelation.
?localC_perm returns a pseudo p-value
locMvC_p <- pol_pres15 |>
st_drop_geometry() |>
subset(select = c(I_turnout, II_turnout)) |>
localC_perm(lw_q_W, nsim=9999, iseed=1) ## [1] TRUE
## Pr(z != E(Ci)) Sim Pr(folded) Sim
## [1,] 0.0002 0.0001
## [2,] 0.9984 0.4992
## rgeoda
## spdep Positive <NA> Sum
## Positive 255 4 259
## <NA> 67 2169 2236
## Sum 322 2173 2495
library(tmap)
m5 <- tm_shape(pol_pres15) +
tm_fill("hs_MvCa",
palette = RColorBrewer::brewer.pal(4, "Set3")[c(4, 1)],
colorNA = "grey95",
textNA = "Not \"interesting\"",
title = "Both rounds turnout spdep\nLocal Multivariate Geary C")m6 <- tm_shape(pol_pres15) +
tm_fill("geoda_mvc",
palette = RColorBrewer::brewer.pal(4, "Set3")[c(4, 1)],
colorNA = "grey95",
textNA = "Not \"interesting\"",
title="Both rounds turnout rgeoda\nLocal Multivariate Geary C")