Moran's I Calculator

Statistics

Moran's I0.50
Expected value under randomness-0.25
Sum of squared deviations10.00
Ordered neighbour pairs W8
How this was calculated
  1. Moran's I on a five-zone transect: values 1, 2, 3, 4, 5 average 3.00, deviations -2.0, -1.0, 0.0, 1.0, 2.0.
  2. Adjacent products sum to 4.00 over the four joins, doubled for both directions gives 8.00 against squared deviations 10.00.
  3. I = (N / W) x (neighbour sum / deviation sum) = (5 / 8) x (8.00 / 10.00) = 0.50.
  4. Moran's I result: 0.50 against a random expectation of -0.25 - positive means neighbours resemble each other.

Maps often show patterns that the eye detects instantly — high values bunching together in one corner, low values in another — but an impression is not a measurement. This morans i calculator turns that impression into a single statistic for the simplest spatial layout that still teaches the idea: five zones in a row, where each zone's neighbours are the zones immediately beside it. Enter the five values and the calculator returns Moran's I, the value you would expect under a random arrangement, the sum of squared deviations, and the count of ordered neighbour pairs behind the weights.

Moran's I is a correlation coefficient adapted to geography. Where an ordinary correlation asks whether two variables move together, Moran's I asks whether a variable moves together with itself across space: do zones with values above the mean sit next to other zones above the mean, and do low zones keep low company? A positive answer means clustering, a negative answer means a dispersed, alternating pattern, and an answer near the random expectation means the arrangement carries no spatial structure worth reporting.

Worked examples

Smooth gradient 1, 2, 3, 4, 5

(1 · 2 · 3 · 4 · 5)

Moran's I0.50
Expected value under randomness-0.25
Sum of squared deviations10.00
Ordered neighbour pairs W8

Checkerboard 5, 1, 5, 1, 5

(5 · 1 · 5 · 1 · 5)

Moran's I-1.00
Expected value under randomness-0.25
Sum of squared deviations19.20
Ordered neighbour pairs W8

Mixed series 3, 1, 4, 1, 5

(3 · 1 · 4 · 1 · 5)

Moran's I-0.84
Expected value under randomness-0.25
Sum of squared deviations12.80
Ordered neighbour pairs W8

Spatial autocorrelation in one statistic

Spatial autocorrelation is the degree to which a value at one location predicts the values around it. It matters because so much of the data analysts map — incomes, disease rates, house prices, rainfall, crop yields — is generated by processes that spill across boundaries. A factory raises employment in neighbouring zones, a dry spell covers a whole region, and a fashionable neighbourhood lifts prices on the streets around it. When those spillovers are present, treating each zone as an independent observation overstates how much information the data really contain.

Moran's I compresses that idea into one number by comparing neighbouring deviations from the mean. The formula is I = (N/W) x (sum of neighbour products) / (sum of squared deviations), where N is the number of zones and W is the total of the weights. For each pair of neighbours, the product of their deviations is taken: positive when both sit on the same side of the mean, negative when they sit on opposite sides. Adding those products over every join gives the numerator's story — clustering makes it positive, alternation makes it negative.

The denominator, the sum of squared deviations, simply scales that story by how much variation the values have in total. Without it, a dataset with large values would produce a large statistic for purely arithmetic reasons. Dividing by the total variation, and by the weight structure through the N/W factor, turns the result into a pure statement about arrangement: given this much variation, how is it laid out in space?

This calculator uses rook weights on a path: zones count as neighbours only when they share an edge along the row, and every join counts in both directions. That is the standard teaching layout, and it keeps every part of the calculation visible. The same statistic on a real map uses a weights matrix built from shared borders, distances, or travel links, but the logic — neighbour products over total variation, judged against a random benchmark — is identical.

  • Positive I above the expectation: similar values cluster together.
  • I close to the expectation: the arrangement looks random.
  • Negative I below the expectation: neighbours tend to differ, as in a checkerboard.
  • Always report I alongside its expected value under randomness, never on its own.
The benchmark for Moran's I is its expected value under randomness, -0.25 for five zones — not zero.

Worked examples: gradient, checkerboard, mixed

The three examples use the same five-zone row and the same weights, so every difference in the results comes from the arrangement of the values alone. That is the point of the statistic, and reading the three side by side is the fastest way to build intuition for what Moran's I can and cannot see.

First, the smooth gradient 1, 2, 3, 4, 5. The values average 3.00, with deviations -2.0, -1.0, 0.0, 1.0, 2.0. Adjacent products sum to 4.00 over the four joins, doubled for both directions gives 8.00 against squared deviations 10.00, and I = (N / W) x (neighbour sum / deviation sum) = (5 / 8) x (8.00 / 10.00) = 0.50. The expected value under randomness is -0.25 and the ordered neighbour pairs W are 8, so the result of 0.50 is a clear clustering signal: along the row, each zone resembles its neighbours because the values change gradually.

Second, the checkerboard 5, 1, 5, 1, 5. The values average 3.40, with deviations 1.6, -2.4, 1.6, -2.4, 1.6. Adjacent products sum to -15.36 over the four joins, doubled for both directions gives -30.72 against squared deviations 19.20, and I = (5 / 8) x (-30.72 / 19.20) = -1.00. The expected value under randomness is again -0.25 and W is again 8. A value of -1.00 is the strongest possible dispersion for this layout: highs and lows alternate perfectly, and no neighbour resembles the zone beside it.

Third, the mixed series 3, 1, 4, 1, 5. The values average 2.80, with deviations 0.2, -1.8, 1.2, -1.8, 2.2. Adjacent products sum to -8.64 over the four joins, doubled for both directions gives -17.28 against squared deviations 12.80, and I = (5 / 8) x (-17.28 / 12.80) = -0.84. The expected value under randomness is -0.25 and W is 8. The pattern is not a perfect checkerboard, but the repeated low zones between higher ones push the statistic most of the way toward the dispersed end.

Zone valuesMoran's IExpected value under randomnessSum of squared deviationsOrdered neighbour pairs W
1, 2, 3, 4, 50.50-0.2510.008
5, 1, 5, 1, 5-1.00-0.2519.208
3, 1, 4, 1, 5-0.84-0.2512.808

Weights: what counts as a neighbour

Every Moran's I calculation hides a decision that matters as much as the data: the weights. The weights declare which pairs of zones are allowed to influence the statistic and how strongly. In this calculator the decision is fixed and transparent — rook weights on a row, meaning zones are neighbours only when they sit directly beside each other, each join counted in both directions, giving W of 8 for five zones. The ends of the row have one neighbour each and the inner zones have two, exactly as the geometry dictates.

On real maps the choices multiply. Rook weights count zones sharing a border segment; queen weights also count zones touching at a corner; distance weights let influence fade with separation; and flow weights can follow commuting or trade links instead of geometry at all. Each choice asks a slightly different question, and the same dataset can give noticeably different values of I under different weights. That is not a defect of the statistic. It is a reminder that spatial structure is defined relative to a notion of closeness, and the notion has to be chosen and defended.

The practical rules are simple. Choose weights that match the process you believe generated the pattern: contagion follows borders, pollution follows distance and wind, prices follow travel time. Keep the weights fixed before looking at the result, rather than shopping for the weights that give the most dramatic value. And report the weights alongside the statistic, because a Moran's I quoted without its weights cannot be reproduced or fairly compared with anyone else's.

The five-zone row is a good place to feel the weight decision in your hands. If the end zones were also treated as neighbours, wrapping the row into a ring, the gradient example would change its value because the highest and lowest zones would suddenly count as adjacent. Nothing about the data changed — only the declared geography did. That sensitivity is exactly why the weights deserve a section of their own in any write-up.

Reading I against its expectation

The most common beginner's error with Moran's I is to compare it with zero. The statistic's resting point under a purely random arrangement is not zero but the expected value under randomness, -1/(N-1), which for five zones is -0.25. A reading of exactly zero would already be mildly positive evidence of clustering on this layout. Every interpretation should therefore start from the gap between the observed value and -0.25: the gradient's 0.50 sits well above it, while the checkerboard's -1.00 and the mixed series' -0.84 sit well below it.

A second caution concerns strength. Moran's I behaves like a correlation in spirit, but its attainable range depends on the weights and the layout, so it should not be read as a percentage of anything. On this row, -1.00 is attainable and represents perfect alternation, while the positive end is shaped by the same geometry. Compare values computed on the same layout and weights with confidence; compare values across different maps or weight schemes only loosely, and prefer comparing each against its own expectation.

A third caution is that a single global statistic can hide local structure. A map can contain one strong cluster of high values and one strong cluster of low values, arranged so that the global statistic looks unremarkable, or a generally random map can contain one striking hotspot. Moran's I answers the global question — is there spatial structure overall — and a significant answer is usually the starting point for local analysis rather than the end of the investigation.

Used with those cautions, Moran's I is the standard first test of any mapped dataset. Enter your five values, read the statistic against -0.25, check the squared-deviation sum to see how much variation the arrangement is organising, and you have a defensible answer to the question every map raises: is this pattern real, or could randomness have drawn it?

FAQs

What Moran's I does the gradient 1, 2, 3, 4, 5 give?

The gradient 1, 2, 3, 4, 5 gives Moran's I of 0.50. Its values average 3.00, the sum of squared deviations is 10.00, and the result sits well above the random expectation of -0.25, because each zone resembles the zones beside it.

And the checkerboard 5, 1, 5, 1, 5?

The checkerboard 5, 1, 5, 1, 5 gives -1.00, the strongest possible dispersion for this layout. Every high zone is flanked by low zones and every low zone by high ones, so neighbour products are all negative, against a random expectation of -0.25.

The mixed series 3, 1, 4, 1, 5?

The mixed series 3, 1, 4, 1, 5 gives -0.84. The sum of squared deviations is 12.80, and the strongly negative value reflects the repeated low zones sitting between higher ones along the row.

What is I under pure randomness for five zones?

Under pure randomness the expectation is -0.25, not zero, for five zones. The expectation is -1/(N-1), so a reading modestly below zero can still be perfectly consistent with a random arrangement; compare I with -0.25, not with zero.

How many ordered neighbour pairs are there?

There are 8 ordered neighbour pairs — four joins counted in both directions. Each join between adjacent zones contributes once from each side, which is why the weight total W in the formula is 8 for this five-zone row.

What is the squared-deviation sum for the gradient?

For the gradient 1, 2, 3, 4, 5, the sum of squared deviations is 10.00. The deviations from the mean of 3.00 are -2.0, -1.0, 0.0, 1.0, 2.0, and squaring and adding them gives the denominator of the Moran's I calculation.

Sources

Related calculators

Covariance Calculator
Sample and population covariance for up to eight paired observations, with the correlation coefficient alongside — the measure of whether two series move together.
Correlation Coefficient Calculator
Pearson's r for up to six paired observations, with r² and the deviation sums shown — the full workings, not just the headline number.
Standard Deviation Calculator
Mean, sample and population standard deviation and variance for up to eight numbers — with the n versus n−1 difference explained.