LISA クラスター地図(局所的自己相関)
クラスターと空間的外れ値がどこにあるか。各地域の局所モラン I を、並べ替えによる有意性とともに地図に示します。

大域的な統計量は地図がクラスター化しているかどうかを示し、局所的な空間的関連指標(LISA;Anselin, 1995)はどこでかを示します。局所モラン I は、各地域について、その地域の値と近隣の値から計算します。局所統計量が有意な地域(擬似 p < 0.05、999 回の条件付き並べ替え)は、モラン散布図の象限に従って色分けします。高–高・低–低のクラスター、高–低・低–高の空間的外れ値です。それ以外は灰色です。
LISA 地図には 2 つの注意が伴います。検定は独立ではなく、多重比較の補正もしていないため、偶然だけでもいくつかの地域が有意になると予想されます。また、有意な地域はクラスターの中心を示すもので、クラスターはふつう近隣にまで広がります。
データはシミュレーションで、CIRANO による五大湖–セントローレンス川の貿易・輸送回廊のデジタルツイン GVCdtLab を背景に設定しています。ダルースとシカゴからセントローレンス湾に至る模式的な水路に沿った 276 の六角形ゾーンで、それぞれに、その海運が低水位にどれだけさらされているかを示す 0〜100 の指数を与えています。ゾーンも値もこのラボのデータや結果ではありません。統計量は esda.Moran_Local、地図は GeoPandas によります。
コードおよび図中のテキストは英語です。
import geopandas as gpd
import matplotlib.pyplot as plt
import numpy as np
from esda.moran import Moran_Local
from libpysal import weights
from matplotlib.patches import Patch
from shapely.geometry import MultiLineString, Point, Polygon
# Simulated data, set in the context of the CIRANO GVCdtLab [gvcdtlab]
# Schematic corridor: hexagonal zones within reach of the waterway, Duluth and Chicago to the Gulf
main = [(-92.1, 46.8), (-89.2, 48.4), (-84.4, 46.5), (-82.4, 44.0), (-83.0, 42.3), (-81.2, 42.2),
(-79.0, 42.9), (-79.4, 43.6), (-76.5, 44.2), (-73.6, 45.5), (-71.2, 46.8), (-68.5, 48.5),
(-64.5, 49.2)]
michigan = [(-84.0, 45.6), (-86.6, 45.4), (-87.0, 43.5), (-87.6, 41.9)]
k = np.cos(np.radians(45)) # shrink longitudes so the hexagons are regular
water = MultiLineString([[(x * k, y) for x, y in line] for line in (main, michigan)])
r, hexes = 0.3, []
for col in range(90):
for row in range(36):
cx, cy = -66.5 + 1.5 * r * col, 40.5 + np.sqrt(3) * r * (row + (col % 2) / 2)
if water.distance(Point(cx, cy)) < 0.95:
hexes.append(Polygon([(round(cx + r * np.cos(a), 6), round(cy + r * np.sin(a), 6))
for a in np.radians(range(0, 360, 60))]))
g = gpd.GeoDataFrame(geometry=hexes)
xy = np.column_stack([g.centroid.x / k, g.centroid.y]) # back to longitude, latitude
# Exposure to low water: high at shallow passages (Seaway, connecting channels, upper lakes),
# low in the deep tidal estuary, plus spatially smooth noise and one draft-limited harbour
def bump(lon, lat, s):
return np.exp(-((xy[:, 0] - lon) ** 2 + (xy[:, 1] - lat) ** 2) / (2 * s ** 2))
w = weights.Queen.from_dataframe(g, use_index=False)
w.transform = "r"
rng = np.random.default_rng(12)
noise = rng.normal(0, 1, len(g))
for _ in range(2):
noise = weights.lag_spatial(w, noise) # smooth the noise over neighbours
exposure = (35 + 30 * bump(-74.8, 45.0, 1.6) + 22 * bump(-82.7, 42.7, 1.2) + 20 * bump(-90.3, 47.6, 1.8)
- 25 * bump(-67.0, 48.8, 2.2) + 12 * noise + rng.normal(0, 4, len(g)))
exposure[np.argmin(np.hypot(xy[:, 0] + 66.0, xy[:, 1] - 49.0))] = 75 # outlier harbour
g["exposure"] = exposure.clip(0, 100).round(1)
lisa = Moran_Local(g["exposure"].to_numpy(), w, permutations=999, seed=1, alternative="two-sided")
# Quadrants: 1 high–high, 2 low–high, 3 low–low, 4 high–low; grey if not significant
labels = {1: "High–high cluster", 3: "Low–low cluster", 2: "Low–high outlier", 4: "High–low outlier"}
colors = {1: "#FF3B30", 3: "#007AFF", 2: "#9FCBFF", 4: "#FFA8A2"}
sig = lisa.p_sim < 0.05
g["cluster"] = np.where(sig, lisa.q, 0)
counts = {q: int((g["cluster"] == q).sum()) for q in labels}
fig, ax = plt.subplots(figsize=(11, 5.2))
g.plot(color=[colors.get(c, "#E5E5EA") for c in g["cluster"]], edgecolor="white", linewidth=0.6, ax=ax)
handles = [Patch(color=colors[q], label=f"{labels[q]} ({counts[q]})") for q in labels if counts[q]]
handles.append(Patch(color="#E5E5EA", label=f"Not significant ({int((~sig).sum())})"))
ax.legend(handles=handles, loc="lower right", fontsize=9.5)
for name, lon, lat, dx, dy in [("Duluth", -92.1, 46.8, -0.6, -0.9), ("Detroit", -83.0, 42.3, 0, -1.2),
("Montréal", -73.6, 45.5, 0.9, -1.1), ("Québec", -71.2, 46.8, 1.3, -0.9)]:
ax.annotate(name, (lon * k, lat), (lon * k + dx, lat + dy), ha="center", va="center", fontsize=9.5,
bbox=dict(boxstyle="round,pad=0.2", fc="white", ec="#C7C7CC", lw=0.6),
arrowprops=dict(arrowstyle="-", color="#3A3A3C", lw=0.8))
ax.set_axis_off()
ax.set_title(f"Local Moran's I finds {counts[1]} high–high and {counts[3]} low–low zones on the simulated map", pad=26)
ax.text(0, 1.02, f"Local Moran's I, 999 permutations, two-sided pseudo p < 0.05, no multiple-testing correction · "
f"queen weights · n = {w.n} zones (simulated)", transform=ax.transAxes, fontsize=9.5, color="#6E6E73")
plt.show()
図にはオプションの PyStatlas スタイル を使用しています。同じ見た目にするには plt.style.use("pystatlas.mplstyle") を追加してください。
データの出典
- Simulated data. Simulated data with a fixed random seed, created for this example.
No real respondents, documents or measurements: the numbers only illustrate how the chart and its statistics work. - CIRANO GVCdtLab, digital twin of the Great Lakes–St. Lawrence corridor. CIRANO. GVCdtLab: Digital twin of the Great Lakes–St. Lawrence trade and transport corridor (researcher in charge: T. Warin). Supported by Transport Canada's National Trade Corridors Fund; research on hydrological change, maritime traffic and trade funded by the Fonds de recherche du Québec. https://cirano.qc.ca/en/research/pole/Transport
The examples are set in the context of the lab's work; the hexagonal zones form a schematic map of the corridor and the values are simulated — they are not the lab's data, geography or results.
これらの例は統計手法を説明するためのものです。項目に別の記載がない限り数値はシミュレーションであり、図のタイトルはこのシミュレーションデータで図が示す内容を述べたものです。引用した論文の知見でも、実質的な問いに対する著者の立場でもありません。結果、背景、データについては、ここに挙げた論文を参照してください。
引用方法
PyStatlas は Thierry Warin が作成・運営しています。研究や業務に役立った場合は、ぜひ引用してください。
Warin, T. (2026). LISA cluster map (local autocorrelation). In PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences (Version 1.1.0) [Computer software]. https://warin.ca/pystatlas/spatial-data/lisa-cluster-map/
@misc{warin2026statlas,
author = {Warin, Thierry},
title = {PyStatlas: A Python Gallery of Statistical Graphics for the Social Sciences},
year = {2026},
version = {1.1.0},
howpublished = {\url{https://warin.ca/pystatlas/}},
note = {Source code: https://github.com/warint/pystatlas}
}空間データのその他のグラフ
空間重み付きコロプレス図
1 つの変数の地図に近隣ネットワークを重ねた図。あらゆる空間統計の土台となる構造です。
spdep::poly2nb() + plot(nb, coords)モラン散布図(大域的自己相関)
各地域をその近隣の平均と比べ、モランの I、並べ替え検定、参照分布を添えます。
spdep::moran.plot() + spdep::moran.mc()空間コレログラム
近隣の次数を広げながらモランの I を求め、並べ替えによる包絡線を添えます。空間的なクラスターがどこまで及ぶかを示します。
spdep::sp.correlogram(method = "I")