The other classical global autocorrelation statistic. Where Moran's I is a correlation-like measure centred on \(-1/(n-1)\), Geary's C is a distance-like one centred on 1: below 1 means positive autocorrelation (neighbours are similar), above 1 means negative. It is more sensitive than Moran's I to local differences.
Arguments
- data
A country-level frame with
iso3cand the value column.- value
The value column (unquoted).
- weights
A
country_weights()object. Defaults to land-border contiguity, which excludes islands – prefercountry_weights("knn")for global work.- n_perm
Permutations for the pseudo-p-value (default
999; use0to skip the test, which leavesp_valueasNA).
Value
A one-row tibble: c (observed), expected (always 1), n
(countries used), n_excluded (countries with data that the weights could
not reach), n_links (non-zero weights), p_value and an excluded
list-column of the excluded iso3c codes. n and n_excluded sum to the
countries supplied with a value, and mean the same here as in
morans_i().
p_value is one-sided on the lower tail:
\((1 + \#\{C^{*} \le C_{obs}\}) / (n_{perm} + 1)\). The lower tail is
the clustered one, which is the opposite way round from Moran's I:
Geary's C runs from 0 (neighbours identical) through 1 (no
autocorrelation) upwards, so a small c is the evidence of positive
spatial association. Never exactly zero; the floor is
\(1/(n_{perm}+1)\). Set a seed beforehand for a reproducible p_value.
References
Geary, R. C. (1954). The contiguity ratio and statistical mapping. The Incorporated Statistician 5(3), 115-146. doi:10.2307/2986645
Examples
# \donttest{
snap <- countryatlas::world_snapshot$countries
gearys_c(snap, gdp_per_capita, weights = country_weights("knn", k = 5),
n_perm = 99)
#> # A tibble: 1 × 7
#> c expected n n_excluded n_links p_value excluded
#> <dbl> <dbl> <int> <int> <int> <dbl> <list>
#> 1 0.535 1 189 2 785 0.01 <chr [2]>
# }
