Moran's I is a spatial autocorrelation statistic that measures the overall clustering of a gene expression pattern across a tissue, producing a single value ranging from -1 (perfectly dispersed) to +1 (perfectly clustered), with 0 indicating a random spatial distribution. It evaluates whether the expression values at neighboring locations are more similar than expected by chance, making it a critical first-pass tool for identifying spatially variable genes (SVGs) in spatial transcriptomics.
Glossary
Moran's I

What is Moran's I?
Moran's I is a foundational statistical measure that quantifies the degree of spatial autocorrelation in a dataset, determining whether the observed pattern of a variable across a tissue is clustered, dispersed, or random.
The statistic is calculated by comparing the covariance of expression values between spatial neighbors against the global variance of the entire tissue sample. A statistically significant positive Moran's I confirms that a gene exhibits a spatially cohesive expression domain, while a negative value suggests a repulsive, checkerboard-like pattern. The significance is typically assessed via a spatial permutation test, which randomly shuffles expression values across locations to generate a null distribution.
Key Properties of Moran's I
Moran's I is the foundational statistic for quantifying spatial autocorrelation in transcriptomics. It measures whether the expression of a gene is randomly distributed, clustered, or dispersed across a tissue section.
The Mathematical Definition
Moran's I is defined as a weighted cross-product of deviations from the mean, normalized by the variance. The formula is:
I = (N / W) * (Σᵢ Σⱼ wᵢⱼ (xᵢ - x̄)(xⱼ - x̄)) / (Σᵢ (xᵢ - x̄)²)
- N: Number of spatial units (spots or cells)
- W: Sum of all spatial weights
- wᵢⱼ: Spatial weight between locations i and j
- xᵢ: Gene expression value at location i
- x̄: Mean expression across all locations
The statistic produces a value typically ranging from -1 (perfect dispersion) to +1 (perfect clustering), with 0 indicating random spatial distribution.
Interpreting the Values
The output of Moran's I provides immediate insight into tissue organization:
- I > 0 (Positive Autocorrelation): Nearby locations have similar expression levels. This indicates spatial clustering—common for cell-type-specific marker genes confined to anatomical regions.
- I ≈ 0 (No Autocorrelation): Expression is randomly distributed across the tissue. Typical for housekeeping genes with uniform expression.
- I < 0 (Negative Autocorrelation): Nearby locations have dissimilar expression. This indicates spatial dispersion or a chessboard-like pattern, often seen in genes with mutually exclusive expression domains.
The magnitude indicates the strength of the pattern, while the sign indicates the direction.
Spatial Weights Matrix
The spatial weights matrix (W) defines what 'nearby' means and is the most critical user-defined parameter:
- Distance-based weights:
wᵢⱼ = 1if distance ≤ threshold, else0. Requires choosing a biologically meaningful radius. - K-Nearest Neighbors (KNN):
wᵢⱼ = 1if j is one of the k nearest neighbors of i. Adapts to local spot density. - Inverse distance weights:
wᵢⱼ = 1 / dᵢⱼᵖ. Nearby points have stronger influence; distant points have weaker influence. - Binary contiguity:
wᵢⱼ = 1if spots share a border. Common for grid-based spatial transcriptomics platforms like Visium.
The choice of weights matrix directly impacts the Moran's I value and must be reported for reproducibility.
Statistical Significance Testing
A raw Moran's I value alone is insufficient; its statistical significance must be assessed against a null hypothesis of spatial randomness:
- Permutation test: Randomly shuffle gene expression values across spatial locations and recalculate Moran's I. Repeat 999+ times to generate a null distribution.
- Z-score:
z = (I_observed - E[I]) / √Var[I]. Measures how many standard deviations the observed value is from the expected value under randomness. - P-value: The proportion of permuted I values as extreme or more extreme than the observed I.
- Multiple testing correction: When testing thousands of genes, apply Benjamini-Hochberg or Bonferroni correction to control false discovery rate.
Only genes with an adjusted p-value < 0.05 are considered spatially variable genes (SVGs).
Global vs. Local Moran's I
Moran's I exists in two complementary forms for spatial transcriptomics analysis:
- Global Moran's I: A single summary statistic for the entire tissue. Answers: 'Is this gene spatially autocorrelated anywhere in the tissue?' Best for initial screening of spatially variable genes.
- Local Indicators of Spatial Association (LISA): Decomposes the global statistic into a value for each spatial location. Answers: 'Where exactly are the clusters and outliers?' Identifies:
- High-High clusters: Hot spots of high expression
- Low-Low clusters: Cold spots of low expression
- High-Low outliers: A high-value spot surrounded by low values
- Low-High outliers: A low-value spot surrounded by high values
LISA is essential for identifying anatomical boundaries and transition zones.
Limitations and Assumptions
Moran's I has important limitations that must be considered in spatial transcriptomics:
- Stationarity assumption: Assumes the spatial process is constant across the tissue. Violated in complex tissues with multiple distinct regions.
- Sensitivity to scale: Results depend heavily on the chosen distance threshold or number of neighbors. Always test multiple scales.
- Global summary masking: A global Moran's I near zero can occur when a gene has both clustered and dispersed regions that cancel each other out.
- Spot-based data: For Visium data (55μm spots), each spot contains multiple cells. Moran's I measures spot-level, not single-cell, autocorrelation.
- Not a causal measure: High Moran's I does not imply that spatial proximity causes the expression pattern—only that a pattern exists.
Complement with Ripley's K function or SPARK for multi-scale or model-based alternatives.
Frequently Asked Questions
Clear, technical answers to the most common questions about Moran's I and its application in spatial transcriptomics analysis.
Moran's I is a spatial autocorrelation statistic that measures the degree to which a variable's values at nearby locations are similar to each other compared to a random spatial distribution. It produces a single summary value ranging from -1 (perfect dispersion) to +1 (perfect clustering), with 0 indicating complete spatial randomness. The statistic works by calculating the covariance between each location's value and the weighted average of its neighbors' values, then normalizing this by the overall variance of the dataset. A spatial weights matrix defines the neighborhood structure—typically using distance thresholds, k-nearest neighbors, or contiguity. The resulting I value is tested for statistical significance against a null hypothesis of spatial randomness using a Z-score and p-value derived from either a normal approximation or a spatial permutation test.
Moran's I vs. Other Spatial Statistics
A technical comparison of Moran's I with other core spatial statistics used to quantify gene expression patterns in tissue architecture.
| Feature | Moran's I | Geary's C | Ripley's K Function | Getis-Ord Gi* |
|---|---|---|---|---|
Primary Measurement | Global spatial autocorrelation | Global spatial autocorrelation | Spatial point pattern clustering across distances | Local hot spot and cold spot detection |
Value Range | -1 to +1 | 0 to 2 | Positive continuous values | Z-score (positive or negative) |
Null Hypothesis Interpretation | 0 = random distribution | 1 = random distribution | Observed K(r) = theoretical Poisson K(r) | 0 = no local clustering |
Sensitivity to Distance Scale | Single global statistic | Single global statistic | Function evaluated across multiple radii (r) | Local statistic with neighborhood definition |
Identifies Local Clusters | ||||
Handles Point Pattern Data | ||||
Typical Spatial Transcriptomics Use Case | Quantifying overall gene expression clustering in tissue | Assessing global spatial heterogeneity of a marker | Analyzing cell-type dispersion at varying distances | Identifying tumor microenvironment hot spots |
Computational Complexity | O(n²) naive; O(n log n) optimized | O(n²) naive; O(n log n) optimized | O(n²) for edge correction | O(n²) for local neighborhood computation |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts and complementary methods for understanding and applying spatial autocorrelation in transcriptomic analysis.
Spatial Autocorrelation
The foundational concept measured by Moran's I. It quantifies the degree to which a variable's values at nearby locations are more similar than expected by random chance. In spatial transcriptomics, positive spatial autocorrelation indicates that a gene's expression is clustered in specific tissue regions, while negative autocorrelation suggests a dispersed, checkerboard-like pattern. This principle underpins the identification of spatially variable genes (SVGs) and the definition of tissue microenvironments.
Geary's C
A complementary spatial autocorrelation statistic that is more sensitive to local differences between neighboring observations than Moran's I. While Moran's I focuses on covariance from the global mean, Geary's C uses squared differences between adjacent values, making it particularly effective at detecting sharp boundaries or edges between tissue domains. A value of C < 1 indicates positive autocorrelation, C = 1 suggests randomness, and C > 1 indicates negative autocorrelation. Often used alongside Moran's I for a more complete spatial characterization.
Local Indicators of Spatial Association (LISA)
A decomposition of global Moran's I into location-specific statistics that identify hot spots, cold spots, and spatial outliers within a tissue. LISA maps visualize where statistically significant clustering of high or low gene expression occurs, enabling researchers to pinpoint the exact anatomical regions driving global autocorrelation patterns. This is essential for discovering spatially variable genes that define specific histological structures or pathological lesions.
Spatial Neighborhood Graph
The data structure that defines spatial weights for Moran's I calculation. It represents each cell or spot as a node, with edges connecting k-nearest neighbors or locations within a distance threshold. The choice of graph construction—such as Delaunay triangulation for single-cell data or grid-based adjacency for Visium spots—directly impacts the autocorrelation statistic. Proper graph definition is critical for accurately modeling the spatial relationships in heterogeneous tissues.
Spatial Permutation Test
A non-parametric statistical method for assessing the significance of an observed Moran's I value. It works by randomly shuffling gene expression values across spatial locations to generate a null distribution of autocorrelation statistics under the assumption of complete spatial randomness. The observed I is then compared against this distribution to compute an empirical p-value. This approach avoids parametric assumptions about the data's underlying distribution and is standard practice in spatial transcriptomics packages like Squidpy and Giotto.
Ripley's K Function
A multi-scale spatial point pattern analysis tool that evaluates clustering or dispersion across a range of distances, rather than a single neighborhood scale like Moran's I. It counts the number of neighboring points within concentric circles of increasing radius around each point. In spatial transcriptomics, it is used to determine whether specific cell types are randomly distributed, clustered, or regularly spaced at different length scales, revealing hierarchical tissue organization.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us