← All articles

By ·

Hot Spot Analysis in GIS: Moran's I, Local Moran's I and Getis-Ord Gi* Explained on Punjab's 36 Districts

Hot spot analysis in GIS, explained on real data. Punjab's female literacy gave a Moran's I of 0.58, 8 Gi* hot spots and 7 cold spots. Python code included.

Hot spot analysis tests whether high or low values cluster in space more than chance would allow. On female literacy across Punjab's 36 districts, global Moran's I was 0.58, and none of 9,999 random reshuffles of the same values came close (the highest was 0.42). Getis-Ord Gi then found 8 hot-spot districts in the north-east and 7 cold-spot districts in the south-west, and 12 of those 15 survived a false discovery rate correction.*

This article explains the three statistics most people mean by "hot spot analysis" (global Moran's I, local Moran's I and Getis-Ord Gi*), runs all three on one real dataset, and shows where they agree, where they disagree and why. It ends with Python code and the matching tools in ArcGIS Pro and GeoDa.

What is hot spot analysis?

Hot spot analysis is a family of spatial statistics that ask one question: do the high values (or the low values) of a variable sit next to each other more than random placement would produce? A choropleth shows a pattern. A hot spot statistic tells you whether it is stronger than what random shuffling of the same values would draw.

Three statistics do most of the work:

Global Moran's ILocal Moran's I (LISA)Getis-Ord Gi*
QuestionIs there clustering anywhere on the map?Where are the clusters, and are there outliers?Where are the concentrations of high and low values?
OutputOne number and one p-valueOne value per area, plus a cluster typeOne z-score per area
Finds spatial outliers?NoYes (High-Low, Low-High)No
ArcGIS Pro toolSpatial Autocorrelation (Global Moran's I)Cluster and Outlier Analysis (Anselin Local Moran's I)Hot Spot Analysis (Getis-Ord Gi*)
PySAL classesda.Moranesda.Moran_Localesda.G_Local(star=True)
SourceMoran, 1950Anselin, 1995Ord and Getis, 1995

The usual workflow is global first, then local. If global Moran's I shows no clustering, local hot spots are more likely to be noise.

What data did I use?

The indicator is the literacy rate of women aged 15 to 49, by district, from the Multiple Indicator Cluster Survey (MICS) Punjab 2017-18, run by the Bureau of Statistics Punjab with UNICEF. It is one of the layers on this site's Punjab education map.

Values run from 26.1% in Rajanpur to 78.3% in Gujrat, with a mean of 54.0%. In the choropleth classification comparison I noted that this indicator is spread fairly evenly, with no long tail, which makes it a clean test case: any clustering found here comes from where the values sit.

Three maps of Punjab's 36 districts. Left: female literacy shaded from pale pink (25-35%) to dark red (65-80%). Centre: Getis-Ord Gi* results with 8 red hot-spot districts in the north-east and 7 blue cold-spot districts in the south-west. Right: local Moran's I with 7 High-High districts in the north-east, 7 Low-Low districts in the south-west and Multan marked as a High-Low outlier

Same 36 districts, same queen contiguity. Black dots mark districts that remain significant after the false discovery rate correction. Legend counts are numbers of districts.

How do you choose spatial weights?

Every statistic here depends on a spatial weights matrix, which defines who counts as a neighbour. It is the most important choice in the analysis, and it should be made before looking at results.

The common options:

I used queen contiguity. On these boundaries it gives exactly the same neighbours as rook (no districts touch only at a corner), with a mean of 4.8 neighbours per district and a range from 2 (Narowal) to 9 (Jhang). Border districts such as Narowal and Lahore lose neighbours on the Indian side and across provincial lines. That edge effect is real and worth stating in any report.

Two more decisions:

  1. Row-standardise for Moran's I. Each district's weights are divided by its number of neighbours, so the "spatial lag" becomes the neighbours' average and well-connected districts do not dominate.
  2. Use binary weights for Gi.* Gi* sums the values in a neighbourhood that includes the district itself. I used plain 1/0 weights, the standard form of the statistic.

A sensitivity check takes a minute: global Moran's I was 0.58 with queen weights, 0.59 with 4 nearest neighbours and 0.49 with 6.

If your data are points (crimes, crashes, customer addresses), aggregate them to equal-sized cells first. Hexagons make neighbour definitions uniform, and the H3 resolution guide covers how to pick a cell size.

What is global Moran's I and how do you read it?

Global Moran's I measures how similar each area's value is to the average of its neighbours, across the whole map. It runs roughly from -1 (neighbours systematically unlike each other, as on a chessboard) through about 0 (no pattern) to +1 (neighbours very alike). Under no spatial pattern its expected value is -1/(n-1), which for 36 districts is -0.029.

With row-standardised weights:

I = Σ zi · lagi / Σ zi²

where zi is each district's deviation from the mean and lagi is the average deviation of its neighbours.

For Punjab female literacy, I = 0.581.

To test it, I used a permutation test. The 36 values were shuffled randomly across the 36 districts 9,999 times and Moran's I recomputed each time. The highest shuffled value was 0.424, and none reached 0.581, so the pseudo p-value is 1/(9,999+1) = 0.0001, the smallest this number of permutations can give. The analytical z-score was 5.93, which agrees.

For comparison, the primary out-of-school rate scored 0.64 and the primary gender parity index 0.42. Global Moran's I says clustering exists. Locating it is the job of the local statistics.

How does Getis-Ord Gi* find hot spots?

Getis-Ord Gi* takes each district, adds up its own value and its neighbours' values, and compares that local sum with what the sum would be if the neighbourhood were average. The result is a z-score. A large positive z-score means a neighbourhood of high values (a hot spot). A large negative one means a neighbourhood of low values (a cold spot).

The standard reporting, used by ArcGIS Pro's Hot Spot Analysis (Getis-Ord Gi*) tool in its Gi_Bin field, sorts the z-scores into confidence bins:

Gi_BinMeaningAbsolute z-score at leastPunjab districts
3Hot spot, 99% confidence2.584
2Hot spot, 95% confidence1.964
1Hot spot, 90% confidence1.650
0Not significant21
-1Cold spot, 90% confidence1.651
-2Cold spot, 95% confidence1.962
-3Cold spot, 99% confidence2.584

The 99% hot spots are Sialkot (z = 3.27), Gujrat (3.20), Sheikhupura (2.78) and Gujranwala (2.63). The 99% cold spots are Rajanpur (-3.01), Muzaffargarh (-2.94), Dera Ghazi Khan (-2.84) and Rahim Yar Khan (-2.59).

Two results show what Gi* measures:

How is local Moran's I (LISA) different?

Local Moran's I gives each district a score for how similar it is to its neighbours, and then a cluster type based on whether the district and its neighbourhood are above or below the mean:

Significance comes from conditional permutation: each district's value is held fixed while its neighbours are drawn at random from the other districts, 9,999 times.

At p < 0.05, LISA found 7 High-High districts (Sialkot, Gujrat, Gujranwala, Sheikhupura, Jhelum, Mandi Bahauddin and Narowal), 7 Low-Low districts (Rajanpur, Muzaffargarh, Dera Ghazi Khan, Rahim Yar Khan, Layyah, Bahawalpur and Bhakkar) and 1 High-Low outlier: Multan.

Multan's female literacy is 57.1%, above the provincial mean, while its four neighbours (Bahawalpur, Muzaffargarh, Khanewal and Lodhran) average 42.4%. It is an urban centre inside the southern cold spot. Gi* gives Multan a z-score of -1.48, not significant, because its low neighbours outweigh its own value in the local sum. Only LISA can see it.

Gi* hot spot or LISA High-High: which should you report?

Use Gi* when the question is "where are values concentrated?" and LISA when you also need to know which areas break the local pattern. On this dataset they agree on the core and differ at the edges:

DistrictLiteracyGi* z-scoreGi* resultLISA resultWhy they differ
Sialkot78.1%3.27Hot, 99%High-HighAgree
Sheikhupura63.1%2.78Hot, 99%High-HighAgree
Rawalpindi77.2%2.09Hot, 95%Not significant (p = 0.07)Gi* counts its own high value. Neighbour Attock (51.8%) weakens the LISA test
Narowal73.8%2.26Hot, 95%High-High (p = 0.0497)Borderline: significant in 13 of 20 random seeds
Lahore75.3%1.01Not significantNot significantAgree: high value, ordinary neighbours
Multan57.1%-1.48Not significantHigh-Low outlierGi* cannot express an outlier
Bhakkar41.0%-1.89Cold, 90%Low-Low (p = 0.048)Borderline: significant in 17 of 20 LISA seeds
Rajanpur26.1%-3.01Cold, 99%Low-LowAgree

The general differences:

  1. Gi includes the area itself; LISA compares the area with its neighbours.* A very high district with mixed neighbours can be a Gi* hot spot and not a LISA cluster (Rawalpindi), and a middling district inside a high neighbourhood can be a strong Gi* hot spot (Sheikhupura).
  2. Gi has no outlier category.* If outliers matter (a well-served town inside an underserved region), use LISA.
  3. Gi is easier to explain.* "A cluster of high values, 99% confidence" reads well in a report.

My default for a client report is Gi* as the headline map, with LISA run alongside to catch outliers.

Why does the small number of districts matter?

With 36 areas, every statistic here has little information to work with. Esri recommends at least 30 features for Hot Spot Analysis, and Punjab only just clears that line. Three practical consequences:

What is the false discovery rate correction and should you use it?

Each district is a separate significance test. At 95% confidence, about 1 test in 20 comes out significant by chance even with no pattern, and neighbouring tests share data. A false discovery rate (FDR) correction lowers the p-value threshold to control the expected share of false positives among the significant results. ArcGIS Pro offers it as the "Apply False Discovery Rate (FDR) Correction" option, and GeoDa offers it alongside Bonferroni bounds in the significance filter.

On Punjab female literacy, using the Benjamini-Hochberg procedure in PySAL's esda.fdr:

UncorrectedWith FDR
Gi* significant districts (90% or higher)1512
Gi* districts at 99%80
LISA High-High74
LISA Low-Low75
LISA High-Low (Multan)10

The FDR threshold at 95% was p ≤ 0.0125, and at 99% no district qualified at all. What survives is the same core on both methods: Sialkot, Gujrat, Gujranwala and Sheikhupura in the north-east, and Rajanpur, Muzaffargarh, Dera Ghazi Khan, Rahim Yar Khan and Layyah in the south-west. Those are the districts I would name with confidence. The others stay on the map as weaker evidence.

How do you do hot spot analysis in Python?

PySAL covers all three statistics, through the libpysal package for weights and esda for the statistics. This is the code behind every number above (libpysal 4.15, esda 2.10):

import numpy as np
import geopandas as gpd
from libpysal.weights import Queen
from esda import Moran, Moran_Local, G_Local, fdr

gdf = gpd.read_file("punjab_districts.gpkg")
y = gdf["female_lit"].to_numpy()

# Queen contiguity: districts sharing an edge or a corner are neighbours
w = Queen.from_dataframe(gdf, use_index=False)
w.transform = "r"                       # row-standardise for Moran's I

np.random.seed(12345)                   # permutation results vary slightly by seed
mi = Moran(y, w, permutations=9999)
print(f"Moran's I = {mi.I:.3f}, pseudo p = {mi.p_sim:.4f}")

# Local Moran's I (LISA): quadrant 1=HH, 2=LH, 3=LL, 4=HL
np.random.seed(12345)
lisa = Moran_Local(y, w, permutations=9999)
labels = np.array(["", "HH", "LH", "LL", "HL"])[lisa.q]
gdf["lisa"] = np.where(lisa.p_sim < 0.05, labels, "ns")
gdf["lisa_fdr"] = np.where(lisa.p_sim <= fdr(lisa.p_sim, 0.05), labels, "ns")

# Getis-Ord Gi*: binary weights, focal district included (star=True)
w.transform = "b"
gi = G_Local(y, w, transform="B", star=True, permutations=9999)
gdf["gi_z"] = gi.Zs                     # analytical z-score, as in ArcGIS Pro
gdf["gi_bin"] = np.sign(gi.Zs) * np.digitize(np.abs(gi.Zs), [1.645, 1.96, 2.576])

I checked the Gi* z-scores against a direct NumPy implementation of the Ord and Getis formula and they matched to 15 decimal places.

In ArcGIS Pro, use Spatial Autocorrelation (Global Moran's I), Hot Spot Analysis (Getis-Ord Gi*) and Cluster and Outlier Analysis (Anselin Local Moran's I) in the Spatial Statistics toolbox. For polygons, set Conceptualization of Spatial Relationships to contiguity edges and corners, tick the FDR option and raise the permutations. Optimized Hot Spot Analysis chooses a distance band and applies FDR for you, which also hides the weights decision.

In GeoDa, create queen contiguity weights in the Weights Manager, then run Space, Univariate Local Moran's I for the LISA cluster map and Local G* for hot spots. The GeoDa local autocorrelation workbook walks through the significance filter, including the FDR and Bonferroni options.

What should you take from this?

Run global Moran's I first to confirm there is clustering at all. Then map Gi* for hot and cold spots and LISA for outliers, using weights you chose before seeing the results. Apply the FDR correction, name only the areas that survive it with confidence, and treat anything near p = 0.05 as provisional, especially with fewer than about 50 areas. On Punjab's female literacy that leaves a clear, defensible story: a strong north-eastern cluster around Sialkot, Gujrat and Gujranwala, a strong south-western one around Rajanpur and Dera Ghazi Khan, and Multan standing apart from its region.

If you need hot spot analysis run on your own district, incident or customer data, with the weights and significance choices documented for review, email me at mahad.imran29@gmail.com.

Frequently asked questions

What is hot spot analysis in GIS?

Hot spot analysis tests whether high or low values of a variable cluster together in space more than chance would produce. The usual statistic is Getis-Ord Gi*, which compares the sum of values in each area and its neighbours with the overall mean and returns a z-score. Large positive z-scores mark hot spots, large negative ones cold spots, usually reported at 90%, 95% and 99% confidence.

What is the difference between global and local Moran's I?

Global Moran's I is one number for the whole map: it says whether similar values tend to sit next to each other anywhere. Local Moran's I, also called LISA, gives one value per area and says where that clustering happens. For Punjab's female literacy, global Moran's I was 0.58 (p = 0.0001), and the local version located 7 High-High and 7 Low-Low districts.

What is the difference between hot spot analysis and cluster and outlier analysis?

Hot Spot Analysis (Getis-Ord Gi*) only finds concentrations of high or low values. Cluster and Outlier Analysis (Anselin Local Moran's I) finds those clusters too, and also flags spatial outliers: a high value surrounded by low ones, or the reverse. In Punjab, Multan's 57% female literacy among neighbours averaging 42% was a High-Low outlier under LISA and invisible to Gi*.

How many features do you need for hot spot analysis?

Esri advises at least 30 features for Hot Spot Analysis results to be reliable, and more is better. With 36 Punjab districts the analysis is just above that line, so results near the significance threshold flip easily. Two districts in this example moved in and out of significance between random seeds, which is a sign to report them cautiously.

Should I apply a false discovery rate correction to hot spot results?

Usually yes. Each area is a separate test, so at 95% confidence about 1 in 20 areas can come out significant by chance alone. A false discovery rate (FDR) correction tightens the threshold. On the Punjab data it cut the significant Gi* districts from 15 to 12 and removed every 99% bin, while the core north-east and south-west clusters stayed.

Let's talk.

Best way to reach me is email. I respond to most things.