{{Short description|Statistics of spatial association}}

'''Join count statistics''' are a method of spatial analysis used to assess the degree of association, in particular the autocorrelation, of categorical variables distributed over a spatial map. They were originally introduced by Australian statistician P. A. P. Moran.<ref>Moran PA. The interpretation of statistical maps. Journal of the Royal Statistical Society. Series B (Methodological). 1948 Jan 1;10(2):243-51.</ref> Join count statistics have found widespread use in econometrics,<ref>Anselin L. Spatial econometrics. Handbook of spatial analysis in the social sciences. 2022 Nov 15:101-22.</ref> remote sensing<ref>Congalton RG, Green K. Assessing the accuracy of remotely sensed data: principles and practices. CRC press; 2019 Aug 8.</ref> and ecology.<ref name="fortindale">Dale MR, Fortin MJ. Spatial analysis: a guide for ecologists. Cambridge University Press; 2014 Sep 11.</ref> Join count statistics can be computed in a number of software packages including PASSaGE,<ref>https://www.passagesoftware.net/</ref> GeoDA, PySAL<ref>{{cite web | url=https://pysal.org/esda/generated/esda.Join_Counts.html | title=Esda.Join_Counts — esda v0.1.dev1+ga296c39 Manual }}</ref> and spdep.<ref>{{cite web | url=https://rdrr.io/rforge/spdep/ | title=Spdep: Spatial Dependence: Weighting Schemes, Statistics and Models version 0.6-15 from R-Forge }}</ref>

== Binary data ==

thumb|Join counts for binary data on a <math>10 \times 10</math> grid using 'rook' (north, south, east, west) neighbors. Left: black is never next to black, nor white to white resulting in zeros values of <math>J_{BB}, J_{WW}</math>. Centre: random pattern shows no bias for pairing colours, resulting in approximately equal values for all join count statistics. Right: A solid patch of black in a white background results in high values for <math>J_{BB}, J_{WW}</math> and low values of <math>J_{BW}</math>, since black is only next to white along the patch boundary.

Given binary data <math>x_i \in \{0,1\}</math> distributed over <math>N</math> spatial sites, where the neighbour relations between regions <math>i</math> and <math>j</math> are encoded in the spatial weight matrix :<math>w_{ij} = \begin{cases} 1 \qquad &i\text{ neighbor of }j\\ 0 &\text{otherwise} \end{cases}</math> the join count statistics are defined as <ref name="clifford"> {{cite book | title=Spatial Processes: Models & Applications | author=Cliff, A.D. and Ord, J.K. | isbn=9780850860818 | url=https://books.google.com/books?id=Mi0OAAAAQAAJ | year=1981 | publisher=Pion }} </ref><ref name="fortindale"/> :<math> J = J_{BB} + J_{BW} + J_{WW} </math> Where :<math> J_{BB} = \frac{1}{2}\sum_{ij, i\neq j} w_{ij} x_i x_j </math> :<math> J_{BW} = \frac{1}{2}\sum_{ij, i\neq j} w_{ij} (x_i-x_j)^2 </math> :<math> J_{WW} = \frac{1}{2}\sum_{ij, i\neq j} w_{ij} (1-x_i) (1-x_j) </math> :<math> J = \frac{1}{2}\sum_{ij, i\neq j} w_{ij} </math> The <math>B,W</math> subscripts refer to 'black'=1 and 'white'=0 sites. The relation <math> J = J_{BB} + J_{BW} + J_{WW} </math> implies only three of the four numbers are independent. Generally speaking, large values of <math>J_{BB}</math> and <math>J_{WW}</math> relative to <math>J_{BW}</math> imply autocorrelation and relatively large values of <math>J_{BW}</math> imply anti-correlation.

To assess the statistical significance of these statistics, the expectation under various null models has been computed.<ref name="sokal">Sokal RR, Oden NL. Spatial autocorrelation in biology: 1. Methodology. Biological journal of the Linnean Society. 1978 Jun 1;10(2):199-228.</ref> For example, if the null hypothesis is that each sample is chosen at random according to a Bernoulli process with probability :<math>p = \frac{ \text{number of black cells} }{ N } = \frac{N_1}{N}</math> then Cliff and Ord <ref name="clifford" /> show that :<math> E(J_{BB}) = \frac{1}{2} S_0 p^2 </math> :<math> var(J_{BB}) = \frac{p^2(1-p)}{4} ([ S_1(1-p) + S_2p]) </math> :<math> E(J_{BW}) = S_0 p(1-p) </math> :<math> var(J_{BW}) = \frac{p(1-p)}{4} [ 4 S_1 + S_2(1-4p(1-p))] </math> where :<math>S_0 = \sum_{ij} w_{ij}</math> :<math>S_1 = \frac{1}{2}\sum_{ij}(w_{ji} + w_{ij})^2</math> :<math>S_2 = \sum_{i}( \sum_j w_{ji} + \sum_j w_{ij})^2</math> However in practice<ref>{{cite web | url=https://geodacenter.github.io/workbook/6d_local_discrete/lab6d.html#univariate-local-join-count-statistic | title=Local Spatial Autocorrelation (4) }}</ref> an approach based on random permutations is preferred, since it requires fewer assumptions.

== Local join count statistic ==

Anselin and Li introduced<ref name="localj">Anselin L, Li X. Operational local join count statistics for cluster detection. Journal of geographical systems. 2019 Jun 1;21:189-210.</ref><ref name="geodadoc">{{cite web | url=https://geodacenter.github.io/workbook/6d_local_discrete/lab6d.html#univariate-local-join-count-statistic | title=Local Spatial Autocorrelation (4) }}</ref> the idea of the '''local join count statistic''', following Anselin's general idea of a Local Indicator of Spatial Association (LISA).<ref>Anselin, Luc. 1995. “Local Indicators of Spatial Association — LISA.” Geographical Analysis 27: 93–115.</ref> Local Join Count is defined by e.g. :<math> J_{BBi} = x_i \sum_j w_{ij} x_j </math> with similar definitions for <math>BW</math> and <math>WW</math>. This is equivalent to the Getis–Ord statistics computed with binary data. Some analytic results for the expectation of the local statistics are available based on the hypergeometric distribution<ref name="localj" /> but due to the multiple comparisons problem a permutation based approach is again preferred in practice.<ref name="geodadoc" />

== Extension to multiple categories ==

thumb|Join counts for 3 category data on a <math>10 \times 10</math> grid using 'rook' (north, south, east, west) neighbors. Left: each category never has a neighbour of its own type, resulting in zeros on the diagonal. Centre: random pattern shows no bias for pairing colours, resulting in approximately equal values for all join count statistics. Right: Since different types are only adjacent on the edge of the patches this results in small values for <math>J_{r \neq s}</math>.

When there are <math>k \geq 2</math> categories join count statistics have been generalised<ref name="fortindale"/><ref name="clifford" /><ref name="sokal" /> :<math> J_{rs} = \frac{1}{2} \sum_{ij} I_r(x_i) I_s(x_j) </math> Where <math>I_r(x_i) = \delta_{r,x_i}</math> is an indicator function for the variable <math>x_i</math> belonging to the category <math>r</math>. Analytic results are available<ref>Epperson, B.K., 2003. Covariances among join-count spatial autocorrelation measures. Theoretical Population Biology, 64(1), pp.81-87.</ref> or a permutation approach can be used to test for significance as in the binary case.

Category:Spatial analysis Category:Covariance and correlation

== References == {{reflist}}