regression-tests.sample-tests
geary-c-test
(geary-c-test values neighbour-weights)
Executes a Geary's C test for checking spatial
autocorrelation in the sample of observations.
values: Sample values.
neighbour-weights: A hash-map of neighbour indexes
and associated weights.
returns: A Geary's C statistic (for sample).
## Usage
(require '[regression-tests.sample-tests :refer :all])
``````````` example from
``````````` Goodchild, M. F. (1986). Spatial Autocorrelation, CATMOG 47.
``````````` Geo Books, Norwich, UK, 56 pp.
``````````` example in 1.3.1 Geary's index (area objects, interval attributes), p. 14.
(def values [3 2 2 1])
(def neighbour-weights {[0 1] 1 [0 2] 1 [0 3] 1 [1 0] 1 [1 3] 1
[2 0] 1 [2 3] 1 [3 0] 1 [3 1] 1 [3 2] 1})
(geary-c-test values neighbour-weights)
=> 6/5
## References
[1] Geary, R. (1954). The Contiguity Ratio and Statistical Mapping.
The Incorporated Statistician, 5(3): 115-145. DOI: 10.2307/2986645.
geary-c-test-population
(geary-c-test-population values neighbour-weights)
Executes a Geary's C test for checking spatial
autocorrelation in the population of observations.
values: Population values.
neighbour-weights: A hash-map of neighbour indexes
and associated weights.
returns: A Geary's C statistic (for population).
## Usage
(require '[regression-tests.sample-tests :refer :all])
``````````` example from
``````````` Goodchild, M. F. (1986). Spatial Autocorrelation, CATMOG 47.
``````````` Geo Books, Norwich, UK, 56 pp.
``````````` example in 1.3.1 Geary's index (area objects, interval attributes), p. 14,
``````````` corrected with n/(n-1) to get population statistics.
(def values [3 2 2 1])
(def neighbour-weights {[0 1] 1 [0 2] 1 [0 3] 1 [1 0] 1 [1 3] 1
[2 0] 1 [2 3] 1 [3 0] 1 [3 1] 1 [3 2] 1})
(geary-c-test-population values neighbour-weights)
=> 1.6
## References
[1] Geary, R. (1954). The Contiguity Ratio and Statistical Mapping.
The Incorporated Statistician, 5(3): 115-145. DOI: 10.2307/2986645.
[2] Chen, Y. (2013). New Approaches for Calculating Moran’s Index of Spatial Autocorrelation.
PLoS ONE, 8(7): e68336. DOI:10.1371/journal.pone.0068336.
moran-i-test
(moran-i-test values neighbour-weights)
Executes a Moran's I test for checking spatial
autocorrelation in the sample of observations.
values: Sample values.
neighbour-weights: A hash-map of neighbour indexes
and associated weights.
returns: A Moran's I statistic.
## Usage
(require '[regression-tests.sample-tests :refer :all])
``````````` example from
``````````` vignettes for R package ape v. 3.4 Moran's I
``````````` https://cran.r-project.org/web/packages/ape/vignettes/MoranI.pdf
``````````` E. Paradis Moran's Autocorrelation Coefficient in Comparative Methods Nov. 29, 2015
``````````` example in 2.1 Phylogenetic Distances, pp. 2-4.
(def values [4.09434 3.61092 2.37024 2.02815 -1.46968])
(def neighbour-weights {[0 1] 0.505744983336052 [0 2] 0.216747850001166
[0 3] 0.171300720162211 [0 4] 0.106206446500571
[1 0] 0.505744983336052 [1 2] 0.216747850001166
[1 3] 0.171300720162211 [1 4] 0.106206446500571
[2 1] 0.304848067656604 [2 0] 0.304848067656604
[2 3] 0.240928311535057 [2 4] 0.149375553151735
[3 1] 0.276243093922652 [3 2] 0.276243093922652
[3 0] 0.276243093922652 [3 4] 0.171270718232044
[4 1] 0.25 [4 2] 0.25
[4 3] 0.25 [4 0] 0.25})
(moran-i-test values neighbour-weights)
=> -0.07312179438450675
## References
[1] Moran, P. (1950). Notes on Continuous Stochastic Phenomena.
Biometrika, 37(1-2): 17-23. DOI: 10.2307/2332142.