Why Neighborhood Scale Matters
A spatial statistic is not determined by expression values alone. It also depends on which locations count as neighbors and how strongly each neighbor contributes. In spatial transcriptomics, a radius of 100 micrometers emphasizes short-range structure, while a radius of 500 micrometers includes more distant spots and may connect distinct tissue regions. A fixed number of nearest neighbors makes neighborhood size adapt to local spot density, but can link spots that are physically far apart in sparse areas.
Consequently, a gene may appear strongly spatially structured at one scale and weakly structured, or differently structured, at another. The goal of sensitivity analysis is not to find the scale that produces the smallest p-value. It is to determine which conclusions persist across scientifically defensible definitions of neighborhood and to describe where conclusions change.
What Changes When the Scale Changes?
For \(n\) spots, let \(x_i\) be the expression value for one gene at spot \(i\), and let \(w_{ij}\) be the weight assigned to the connection from spot \(i\) to spot \(j\). A common global summary is Moran’s I:
The statistic compares the expression cross-products for connected spots with the overall variation in expression. Positive values indicate that connected spots tend to have similar deviations from the mean; negative values indicate a tendency for connected spots to have contrasting deviations. Its value depends on the weights \(w_{ij}\), so changing the radius, neighbor count, or weighting rule changes the statistic being calculated.
A radius graph connects spots whose physical distance is at most a chosen radius. A \(k\)-nearest-neighbor graph connects each spot to its \(k\) closest spots, though the resulting graph may be directed unless it is symmetrized. Binary weighting assigns each included edge weight 1. Distance weighting gives closer pairs greater weight, for example \(w_{ij}=1/d_{ij}\) for connected pairs at distance \(d_{ij}>0\). Row-standardized weighting rescales the weights leaving each spot to sum to 1. These choices are not interchangeable: they encode different notions of spatial influence.
A comparison is interpretable only when the data and analysis are otherwise held as constant as practical. For example, use the same spots, expression transformation, covariate adjustment, test direction, and permutation scheme across the scales being compared. State whether the graph is directed or symmetrized, whether weights are binary or transformed, and how isolates are handled. A spot with no neighbors contributes no spatial cross-products; if many spots are isolated, the statistic may describe only a selected portion of the tissue.
Worked Example: Changing a Radius Changes Moran’s I
Consider four hypothetical spots at positions 0, 100, 200, and 300 micrometers on a line. A gene has expression values \(0, 0, 10, 10\), respectively. Use an undirected binary graph, with an edge whenever the distance is no greater than the selected radius. There are no isolates at either radius considered.
The mean is \(\bar{x}=5\), so the centered values are \(-5,-5,5,5\), and the sum of squared deviations is \(100\). With radius 100 micrometers, the edges are (1,2), (2,3), and (3,4). The sum over directed pairs in the Moran numerator counts each undirected edge twice:
Thus \(I=(4/6)(50/100)=0.3333\). With radius 200 micrometers, the graph also includes (1,3) and (2,4). Each of those edges has centered cross-product \(-25\), so the numerator becomes \(50+2(-25-25)=-50\), while \(S_0=10\). Therefore \(I=(4/10)(-50/100)=-0.2000\). The same expression values show positive spatial autocorrelation at the shorter radius but a negative global statistic at the wider radius, because the wider graph adds links between spots in opposite expression blocks.
Weighting and Neighbor-Count Choices
A radius has a direct physical interpretation but produces varying neighbor counts when spot density varies. A fixed \(k\) gives each spot a similar number of neighbors, but the physical distances covered can vary substantially. Neither choice is universally preferable. Radius graphs are often easier to relate to a biological distance scale; \(k\)-nearest-neighbor graphs can avoid isolates in irregularly sampled tissue but may connect across gaps or across boundaries when local sampling is sparse.
Weights also matter after the graph’s edges have been chosen. Binary weights give every included connection equal influence. Distance weights prioritize nearby pairs, while row standardization gives each spot a fixed total outgoing weight and therefore changes the relative influence of spots with different degrees. With asymmetric weights, including some row-standardized graphs, the Moran numerator may treat \(i\) to \(j\) differently from \(j\) to \(i\). The graph and weights must therefore be reported, not merely described as “spatial.”
Worked Example: Reweighting a Fixed Graph
Use three hypothetical spots at positions 0, 100, and 300 micrometers, with expression values \(0,0,4\). Include pairs no more than 200 micrometers apart, giving edges (1,2) and (2,3). Compare binary weights with inverse-distance weights, measuring distance in units of 100 micrometers. The edge distances are therefore 1 and 2. The graph is undirected in both cases, with no self-edges or isolates.
Here \(\bar{x}=4/3\), the centered values are \(-4/3,-4/3,8/3\), and the sum of squared deviations is \(32/3\). With binary weights, the directed numerator is \(2\{16/9-32/9\}=-32/9\) and \(S_0=4\). Hence:
For inverse-distance weights, the two undirected edge weights are 1 and \(1/2\). The directed numerator is \(2\{16/9+(1/2)(-32/9)\}=0\); since the denominator is positive, \(I_{\mathrm{inverse\ distance}}=0\). The connections did not change, but the statistic did: the inverse-distance rule reduces the contribution of the contrasting, more distant pair.
Multiscale Testing and Gene Rankings
For each scale \(s\), denote the corresponding weights by \(w_{ij}^{(s)}\) and calculate a scale-specific statistic \(I_g^{(s)}\) for each gene \(g\). A permutation test can assess whether the observed statistic is unusual relative to a stated null model. For example, with a one-sided test for positive autocorrelation, expression values are permuted across locations while the graph is held fixed. If \(B\) permutations are used and \(b\) permuted statistics are at least as large as the observed statistic, the commonly used Monte Carlo p-value is \((b+1)/(B+1)\).
This procedure requires a defensible exchangeability assumption under the null: the values being permuted must be interchangeable across the locations being tested. Strong tissue-region structure, spatially patterned technical effects, or unadjusted covariates can make unrestricted permutation inappropriate. The earlier material on confounding between tissue regions and covariates is relevant here: a scale comparison cannot by itself separate a biological spatial pattern from a spatially patterned confounder. If the permutation scheme is restricted to preserve relevant design structure, apply the same restriction at every scale.
The following hypothetical results illustrate a ranking change. Suppose 999 permutations are used at each of two prespecified scales, and the p-value is calculated for a positive-autocorrelation alternative. The “exceedances” column gives \(b\); p-values are \((b+1)/1000\). Rankings are by raw p-value within each scale and are only a screening summary; formal gene-level conclusions should account for testing many genes.
| Scale | Gene | Observed Moran’s I | Exceedances \(b\) | Permutation p-value | Within-scale rank |
|---|---|---|---|---|---|
| Short range | A | 0.62 | 0 | 0.001 | 1 |
| Short range | B | 0.48 | 7 | 0.008 | 2 |
| Short range | C | 0.19 | 89 | 0.090 | 3 |
| Broad range | A | 0.23 | 38 | 0.039 | 2 |
| Broad range | B | 0.17 | 71 | 0.072 | 3 |
| Broad range | C | 0.55 | 1 | 0.002 | 1 |
Worked Example: Interpreting a Scale-Dependent Ranking
For gene A at the short-range scale, \(b=0\), so its Monte Carlo p-value is \((0+1)/(999+1)=0.001\). At the broad-range scale, \(b=38\), giving \(39/1000=0.039\). Gene C changes in the opposite direction: its p-value moves from \(90/1000=0.090\) to \(2/1000=0.002\). Therefore, A ranks ahead of C at short range, whereas C ranks ahead of A at broad range. This is evidence that their relative spatial-test results depend on the neighborhood definition; it does not establish that either gene has a causal role or that one scale is biologically correct.
The p-values are not directly interpretable as probabilities that the null hypotheses are true. Nor does a change in rank alone prove a meaningful change in effect: p-values depend on the statistic, its null distribution, and the permutation resolution. Report the scale-specific statistics alongside p-values, apply an appropriate multiplicity procedure across genes, and state how inference across the collection of scales is handled. If the scale was chosen after inspecting results, that selection must also be reflected in the inferential procedure or treated as exploratory.
Justifying the Scale Comparison
The basic reason to inspect multiple scales is visible in the Moran numerator: at each scale, a different set of weighted cross-products contributes. A change in \(I\) is therefore not a numerical nuisance; it can reveal that local similarity and broader tissue organization differ. However, the denominator and the graph normalization also affect the statistic, so a difference in Moran’s I across graphs should be described as a difference in the graph-specific summary, not automatically as a directly comparable change in biological effect size.
A practical multiscale analysis defines a scientifically defensible range before inspecting which scale gives the strongest result. It can include a small number of radii in physical units, selected values of \(k\), and a justified weighting rule. Plotting the statistic across scales often reveals whether the pattern changes gradually, has a local peak, or reverses direction. If uncertainty is displayed, it should reflect the actual test or estimation procedure at each scale; overlapping or non-overlapping intervals are not a substitute for a formal comparison between scales.
Set the radius or neighbor count, edge symmetrization rule, weights, and isolate handling. Explain why the candidates represent relevant physical or sampling scales.
Review degree distributions, connected components, isolates, and links crossing tissue gaps or region boundaries. Confirm that no self-edges or unintended links were introduced.
Use the same expression data, transformations, covariate handling, test direction, and valid null procedure across scales. Record scale-specific statistics as well as p-values.
Compare signs, magnitudes, and gene rankings; identify reversals and robust patterns. Correct for the relevant family of gene and scale tests, or label post-selection findings exploratory.
Diagnostics, Alternatives, and Limitations
Useful diagnostics include the distribution of physical edge lengths, number of neighbors per spot, proportion of isolates, and number of connected components. A radius that creates many isolated spots may be too small for a global statistic to summarize the section well. A large radius that yields a nearly complete graph can blur local structure and make broad tissue gradients dominate. For a \(k\)-nearest-neighbor graph, inspect the actual distances: a fixed \(k\) can require long edges in sparse regions. Also examine whether conclusions are driven by a few high-degree spots or by links between distinct tissue regions.
The main alternatives answer different questions. A fixed-radius graph anchors connectivity to physical distance but allows variable degree. A \(k\)-nearest-neighbor graph controls local neighbor count but allows variable physical range. Binary weights treat all selected links equally; distance or row-standardized weights impose different influence patterns. These are sensitivity choices, not interchangeable corrections. Empirical variograms, introduced in earlier material, summarize dependence by distance rather than by a single graph, and can offer a complementary view when a distance-based description is appropriate. They do not remove the need to assess sampling geometry or confounding.
A central limitation is that “scale” combines assumptions about biology, tissue geometry, and measurement. Results can also depend on expression normalization, spot density, region boundaries, and the null model. Multiscale agreement increases confidence that a result is not an artifact of one arbitrary graph, but does not guarantee that the shared result is unbiased or biologically specific. Conversely, disagreement is informative and should be reported rather than hidden by selecting the most favorable scale.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In a fixed-radius graph, what does an increase in radius change, and why can Moran’s I change sign?
- When might a \(k\)-nearest-neighbor graph be preferable to a radius graph, and what diagnostic is especially important?
- A permutation analysis uses \(B=999\) and observes \(b=4\) exceedances. Calculate the Monte Carlo p-value.
- Why is it not valid to report only the scale with the smallest p-value after searching many radii?
- What does a gene’s changing rank across scales establish, and what does it not establish by itself?
Solutions. (1) Increasing the radius adds eligible spot pairs, which changes the weighted cross-products and \(S_0\). Added pairs can have negative centered cross-products large enough to outweigh positive ones, changing the sign. (2) A \(k\)-nearest-neighbor graph can be useful when spot density varies and a radius would leave many locations isolated; inspect the physical distances of the selected edges, especially unusually long links. (3) The p-value is \((4+1)/(999+1)=0.005\). (4) Choosing the minimum after examining results creates selection across scales; the reported evidence must account for that search, or be labelled exploratory. (5) The rank change shows that the relative test results depend on the neighborhood definition. It does not alone establish a biological cause, a definitive preferred scale, or a change in effect size.