need derivation of join-count variance (spatial autocorrelation stat), know where it is? - Cross Validated most recent 30 from stats.stackexchange.com 2019-08-20T01:56:37Z https://stats.stackexchange.com/feeds/question/59913 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://stats.stackexchange.com/q/59913 1 need derivation of join-count variance (spatial autocorrelation stat), know where it is? wvguy8258 https://stats.stackexchange.com/users/5676 2013-05-24T03:37:52Z 2013-05-24T17:42:17Z <p>I am using interlibrary loan to get Cliff and Ord's book Spatial Processes, but the semester just ended and it is slow now. On page 18ish of this book, Cliff and Ord show how the variance for the join-count statistic is calculated and also how this variance was derived. I have the variance equation, but need to see the derivation because I need to calculate variance of join-counts WHILE taking edge effects into account. So, I must modify the variance but can only do this if I understand the steps in its derivation very well (which is hard to do when looking at a reduced form equation). Time is of the essence, has anyone seen an online reference that shows this derivation and can point me to it? It might take quite a while to have this book in hand, given the situation. Also, buying a book like this for a few pages is a bit extravagant given the cost of books like this. Thanks. I doubt anyone can help, it is too odd a question likely.</p> https://stats.stackexchange.com/questions/59913/-/59962#59962 2 Answer by whuber for need derivation of join-count variance (spatial autocorrelation stat), know where it is? whuber https://stats.stackexchange.com/users/919 2013-05-24T17:42:17Z 2013-05-24T17:42:17Z <p>The join-count statistic is a special case of a class that includes the Getis-Ord $G$, Moran, and Geary statistics [Haining, <em>Spatial Data Analysis Theory and Practice</em> (2003), p. 242]. They are united by a graph-theoretic abstraction in which spatial features are nodes, features $i$ and $j$ (with $i \ne j$) considered adjacent are joined by edges $e_{ij}$ having weights $\omega_{ij}$, and to each feature $i$ is assigned a definite attribute $z_i$. These statistics vary only in how they measure association of the attribute. The measure that defines the join-count statistic is the binary indicator of equality:</p> <p>$$\gamma_{ij} = \gamma(z_i, z_j) = I(z_i, z_j) = \begin{array}{ll} \{ &amp; \begin{array}{ll} 1 &amp; z_i=z_j \\ 0 &amp; z_i\ne z_j. \end{array} \end{array}$$</p> <p>Let $\Gamma = (V, E, \omega, z)$ designate the vertices, edges, their weights, and the attributes, respectively. The value of the statistic is obtained by the weighted sum of the $\gamma_{ij}$ over the edges:</p> <p>$$J(\gamma; \Gamma) = \sum_{e_{ij}\in E} \omega_{ij} \gamma_{ij}.$$</p> <p>The distribution of such a statistic depends on assumptions made about the distributions of the $z_i$. Although I have not seen this (classic) text, references to it indicate that in this section it assumes a <em>permutation distribution</em> ("sampling without replacement") for the $z_i$. That is, we take the multiset of $\{z_i\}$ as given and contemplate the distribution attained by $J$ when the $\{z_i\}$ undergo any permutation with equal probabilities.</p> <p>The variance of $J$ is obtained by calculating its first two moments. Let's begin with the first moment, its expectation. By linearity of expectation,</p> <p>$$\mathbb{E}[J] = \sum_{e_{ij}\in E} \omega_{ij} \mathbb{E}[\gamma_{ij}].$$</p> <p>For the join count statistic, </p> <p>$$\mathbb{E}[\gamma_{ij}] = \mathbb{E}[I(z_i,z_j)]$$</p> <p>is just the chance that $z_i$ and $z_j$ will have the same value when chosen randomly without replacement from the $\{z_i\}$. Let there be $n \gt 1$ vertices and suppose that one of the possible values of the $z_i$ is "black" and that $B$ of the $z_i$ have this value. This chance then obviously equals</p> <p>$$\mathbb{P}[z_i=\text{black} \wedge z_j=\text{black}] = \frac{B}{n}\frac{B-1}{n-1} = \frac{\binom{B}{2}}{\binom{n}{2}}.$$</p> <p>For instance, specializing to the case of just two attributes ("white" and "black") and equal weights $\omega_{ij}=1$ at all edges, we obtain</p> <p>$$\mathbb{E}[J] = \frac{\binom{B}{2}+\binom{W}{2}}{\binom{n}{2}}\sum_{e_{ij}\in E} \omega_{ij}.$$</p> <p>Further specializing to a toroidal grid, each vertex has exactly four edges and each edge is shared among two vertices, implying there are $2n$ edges, whence $W = \sum_{e_{ij}\in E} \omega_{ij} = 2n$, simplifying the expectation to $2n\left(\binom{B}{2}+\binom{W}{2}\right)/\binom{n}{2}$. (As a check, when $B\approx W\approx n/2$ this reduces approximately to $n/2$, which is the intuitively obvious result.)</p> <p>Armed with this preliminary success, let's tackle the second moment. It looks more complicated, but succumbs to the same treatment.</p> <p>$$\mathbb{E}[J^2] = \sum_{e_{ij}\in E}\sum_{e_{i'j'}\in E} \omega_{ij}\omega_{i'j'} \mathbb{E}[\gamma_{ij}\gamma_{i'j'}].$$</p> <p>Evidently we need to compute expectations of the form </p> <p>$$E_{i,j,i',j'} = \mathbb{E}[\gamma_{ij}\gamma_{i'j'}] = \mathbb{E}[I(z_i=z_j)I(z_{i'}=z_{j'})].$$</p> <p>The possibilities are exhausted by three disjoint cases:</p> <ol> <li><p>$\{i,j\} = \{i',j'\}$. Here, $I(z_i=z_j)I(z_{i'}=z_{j'})=I(z_i=z_j)$, so </p> <p>$$\mathbb{E}[I(z_i=z_j)I(z_{i'}=z_{j'})]=\mathbb{E}[I(z_i=z_j)],$$ </p> <p>which we have previously computed.</p></li> <li><p>$\{i,j,i',j'\}$ consists of three distinct indexes. It follows that $I(z_i=z_j)I(z_{i'}=z_{j'})=1$ if and only if all three associated values are equal, whence the expectation is</p> <p>$$\frac{\binom{B}{3} + \binom{W}{3}}{\binom{n}{3}}.$$</p></li> <li><p>$\{i,j, i',j'\}$ consists of four distinct indexes. Reasoning as before, the chance of this equals</p> <p>$$\frac{2\binom{B}{2}\binom{W}{2} + \binom{B}{2}\binom{W-2}{2} + \binom{B-2}{2}\binom{W}{2}}{\binom{n}{2}\binom{n-2}{2}}.$$</p></li> </ol> <p>That's as far as we need to go here, because all the ingredients are in place for computing the double summation for any weighted graph $(V, E, \omega_{ij})$. The actual answer depends on the graph structure. For unit weights $\omega_{ij}=1$, then given any edge $e_{ij}$, you will need to count the number of edges $e_{i'j'}$ of types (2) and (3) above.</p> <p>Calculations for sampling with replacement (another probability model) are a little simpler, so I won't provide the details. It amounts to replacing expressions $\binom{m}{k}$ by $m^k$ throughout.</p> <p>Don't forget at the end to compute the variance by subtracting the square of the expectation from the second moment!</p>