Why the Null Distribution Matters
Moran’s I summarizes whether nearby spots tend to have similar expression values, but a statistic alone does not say how surprising the observed spatial pattern is. Its interpretation depends on a reference distribution: what values of Moran’s I would arise if the observed expression values were assigned to locations without spatial pattern, while the neighborhood graph stayed fixed? This tutorial develops that comparison and its assumptions. It also explains why the answer depends on the graph, and why ties and missing spots require care.
The introductory material on global spatial autocorrelation motivates Moran’s I as a graph-based summary. Here, the emphasis is on the expectation and null distribution used to interpret that summary. A small p-value under a permutation null is evidence against exchangeability of the observed values across the specified locations; it is not, by itself, evidence that a particular biological mechanism caused the spatial pattern.
Statistic and Randomization Assumptions
The double sum counts ordered pairs. Thus, with symmetric binary weights, each undirected edge contributes twice, once in each direction, to both \(S_0\) and the numerator. Weight conventions matter: for example, row-standardizing a graph changes its weights and generally changes Moran’s I. The graph and weighting rule are part of the statistic, not incidental implementation details.
The permutation null holds the observed values and the graph fixed, then randomly reassigns the values among the \(n\) locations. This is a conditional randomization reference: under the null, every assignment of the observed values to locations is equally likely. It assumes exchangeability across those locations under the null and uses no self-weights. No normality assumption is needed to generate this permutation distribution. A small p-value is only meaningful relative to this null and the chosen graph.
Why the Expected Value Is Not Zero
Under random reassignment, the centered values travel together as a fixed set: their sum remains zero. Consequently, two distinct locations have a slightly negative expected product, even when assignment is random. This constraint explains the null expectation of Moran’s I.
To justify the result, write the randomly permuted centered value at location \(i\) as \(Z_i\), and let \(Q=\sum_i z_i^2\). Each location receives each centered value with equal probability, so \(E(Z_i)=0\) and \(E(Z_i^2)=Q/n\). Since \(\sum_i Z_i=0\) for every permutation, symmetry gives the same expected product \(c=E(Z_i Z_j)\) for every pair \(i\ne j\). Squaring the fixed zero sum and taking expectations gives
Because \(w_{ii}=0\), every weighted product is between distinct locations. Therefore the expected numerator is \(\sum_{i\ne j}w_{ij}c=S_0c\). The denominator is the fixed \(Q\), so
This expectation applies whether the fixed weights are symmetric or not, provided the stated conditions hold. It does not mean every graph has the same variance or shape of null distribution. Nor does it mean an observed I greater than zero is automatically significant. The graph and the actual multiset of values both influence the spread and discreteness of permutation outcomes.
Worked Example: Interpreting an Observed Value Relative to Its Expectation
Suppose four hypothetical spots lie on a line, with values \(1,2,4,5\) expression units. Use binary symmetric weights connecting adjacent spots only: \(1\leftrightarrow2\), \(2\leftrightarrow3\), and \(3\leftrightarrow4\). Calculate Moran’s I and its permutation-null expectation.
The mean is \(\bar{x}=(1+2+4+5)/4=3\) expression units, so the centered values are \((-2,-1,1,2)\). There are six ordered edges, giving \(S_0=6\). The denominator is
The three undirected adjacent products are \((-2)(-1)=2\), \((-1)(1)=-1\), and \((1)(2)=2\). Each is counted in both directions, so the weighted numerator is \(2(2-1+2)=6\). Hence
The observed value is above the null expectation, in a direction consistent with positive spatial autocorrelation for this graph. That comparison alone does not establish statistical significance: the permutation distribution is needed to assess how often values at least this large arise under random reassignment.
Permutation Distributions and P-Values
For an exact permutation distribution, calculate I for every distinct assignment of the observed values to the fixed locations, retaining the same graph and weights each time. With distinct values there are \(n!\) assignments; tied values yield fewer distinct value arrangements. The resulting distribution is conditional on the observed values, so it asks whether their particular allocation to locations is unusual under the specified exchangeability null.
For a test of positive autocorrelation, the upper-tail p-value is the proportion of null assignments with \(I_{\mathrm{perm}}\ge I_{\mathrm{obs}}\). For a test of negative autocorrelation, use the lower tail. A two-sided test can compare departures from the null expectation, counting outcomes for which \(\left|I_{\mathrm{perm}}+1/(n-1)\right|\ge\left|I_{\mathrm{obs}}+1/(n-1)\right|\). The direction and tail should match the scientific question and be chosen before interpreting the result.
When enumerating all distinct assignments is impractical, sample \(B\) random permutations. If \(b\) sampled statistics are at least as large as the observed value in an upper-tail test, a common Monte Carlo p-value is \((b+1)/(B+1)\). The added one accounts for the observed arrangement in the reference set and avoids reporting a zero p-value. With finite \(B\), the estimate has simulation error; use enough permutations that this error is small relative to the distinctions needed for the analysis.
Worked Example: A Monte Carlo Upper-Tail Test
For the four-spot example above, suppose a hypothetical analysis samples \(B=999\) random permutations using the same chain graph. Of these, \(b=87\) yield Moran’s I at least \(0.4000\). The estimated upper-tail p-value is
At significance level \(\alpha=0.05\), this result does not provide sufficient evidence against the random-assignment null in the positive direction. It is not evidence that the null is true, and it does not establish an absence of spatial structure. It says that, for this graph and this permutation test, the estimated upper-tail probability is 0.0880. More permutations could reduce Monte Carlo error, but would not change the null hypothesis being tested.
Graph Choice, Ties, and Missing Locations
A permutation test preserves the graph, so it cannot account for an unsuitable graph. A radius graph, a k-nearest-neighbor graph, and different weight standardizations define different pairs and potentially different Moran’s I values. Before interpreting the statistic, check that the graph represents the spatial neighborhood relevant to the question; inspect isolated spots, degree variation, and whether edges cross tissue gaps or boundaries. If \(S_0=0\), there are no weighted pairs and I is undefined. Results that change substantially under reasonable graph choices should be reported as graph-sensitive rather than treated as a single robust finding.
“Ties” can refer to two different issues. Equal expression values do not invalidate permutation testing: the exact null is conditional on the observed multiset, including its repeated values. But repeated values can make the null distribution more discrete, reducing the range of attainable p-values. If all values are equal, the denominator is zero and I is undefined. In contrast, tied distances when constructing a nearest-neighbor graph can make the edge set ambiguous. Specify a deterministic tie-breaking rule, or include all tied neighbors under a stated rule, and keep that rule fixed during the test. Otherwise, different implementations may be testing different graphs.
Missingness also affects what locations and values the test represents. If spots with missing expression are excluded, calculate the statistic using the observed values and a clearly stated graph on those spots—for example, the original graph restricted to observed spots. Rebuilding a nearest-neighbor graph among observed spots is another choice, but can create edges spanning a large gap. These choices change the spatial comparison. More importantly, ordinary unrestricted permutation assumes the observed values are exchangeable among the included locations under the null. If missingness depends on tissue region or expression, the observed set may be spatially selected; permuting only its observed values does not repair that selection or recover information from missing spots.
Worked Example: Missingness Can Change the Spatial Question
Consider five hypothetical spots on a line, with original edges only between consecutive spots. Their expression values are \(1,2,\text{missing},4,5\) units. Analyze the four observed spots while retaining only original edges whose two endpoints are observed. The remaining edges are \(1\leftrightarrow2\) and \(4\leftrightarrow5\), so \(S_0=4\). The observed mean is \((1+2+4+5)/4=3\) units, with centered values \((-2,-1,1,2)\). The denominator is \(10\), and the ordered-edge numerator is \(2[(-2)(-1)+(1)(2)]=8\). Thus
This statistic describes the two observed neighboring pairs, not continuity across the missing center. If instead a new nearest-neighbor graph connects the second and fourth spots, that graph adds a cross-gap comparison and defines a different statistic. If the center is missing because of spatially patterned tissue quality, neither permutation calculation accounts for the missingness mechanism; the result must be interpreted as conditional on the observed spots and the specified graph.
Diagnostics, Alternatives, and Limits
A useful report identifies the analyzed expression quantity, included spots, graph construction and weighting, permutation scheme, tail, number of permutations, observed I, and p-value. Diagnose the analysis before reading the p-value: confirm nonzero variation and \(S_0>0\); verify that the graph matches the intended neighborhood; inspect ties and missingness; and check whether the conclusion is sensitive to reasonable graph definitions. A permutation histogram can reveal discreteness, skewness, or unusual tail behavior that a normal approximation would conceal.
An analytical normal approximation is an alternative when its variance formula and assumptions are appropriate, but it can be inaccurate for small graphs, unusual degree patterns, or highly discrete data. Permutation inference avoids a normality requirement for the values, but it is not assumption-free: its exchangeability null may be implausible across distinct tissue regions or technical strata. Restricting permutations within defensible strata can address some exchangeability concerns, but changes the null question and may not have expectation \(-1/(n-1)\). The unrestricted expectation derived above should not be applied automatically to a restricted permutation scheme.
Finally, global Moran’s I compresses the entire graph into one number. A value near its null expectation does not rule out localized patterns that offset one another, and a significant global statistic does not identify where a pattern occurs. It also does not establish why expression varies spatially. The inference is about spatial arrangement relative to a specified randomization reference, not a causal claim or a complete description of tissue structure.
Check Your Understanding
Answer each question, then compare with the solutions.
- Why is the unrestricted permutation expectation of Moran’s I not zero?
- With \(n=6\) nonconstant values and no self-weights, what is the expected I under unrestricted random permutation?
- For an upper-tail test, \(B=499\) permutations produce \(b=24\) statistics at least as large as observed. Calculate the Monte Carlo p-value and interpret it.
- Why can equal expression values make a permutation p-value more discrete without invalidating the permutation procedure?
- What changes if missing spots are removed and a new nearest-neighbor graph is built among the remaining spots?
Solutions. 1. The centered values sum to zero in every permutation, so products at distinct locations have negative expected value; this gives \(E(I)=-1/(n-1)\). 2. \(E(I)=-1/(6-1)=-0.2000\). 3. \(\hat{p}_{\mathrm{perm}}=(24+1)/(499+1)=25/500=0.0500\). This is the estimated upper-tail probability under the specified permutation null; whether it meets a decision threshold depends on the prespecified \(\alpha\), and the result is conditional on the graph and exchangeability assumption. 4. The null remains conditional on the observed multiset, but repeated values yield fewer distinct assignments and thus fewer possible statistic values and p-values. 5. The new graph may connect spots that were not neighbors in the original graph, changing the weights, the statistic, and the spatial question; the missingness mechanism itself is not corrected by that rebuild.