lisa

lisa(
    data,
    variable,
    year=None,
    *,
    w=None,
    permutations=999,
    seed=12345,
    alpha=0.05,
    panels='both',
    tiles='carto-positron',
    title=None,
    gdf=None,
    ref=None,
)

Local Moran (LISA) clusters of a variable: where are the hot spots, cold spots and outliers?

The figure shows the Moran scatterplot (each unit’s standardized value against its neighbours’ mean, coloured by cluster, grey where not significant) next to the map of the clusters. Both are interactive, and a click on a cluster type in the legend shows or hides it in both.

Parameters

Name Type Description Default
data A dataset id, or a panel with geo_id (and year), e.g. from load required
variable str The numeric column to analyse required
year The year to analyse (default: the last with data) None
w Spatial weights from weights (default: queen contiguity among the units with data) None
permutations int Random permutations behind each unit’s pseudo p-value 999
seed int | None Makes the permutations reproducible 12345
alpha float Significance level below which a unit is assigned to a cluster 0.05
panels str What .fig shows: "both" (the scatterplot and the map side by side), "map" (the cluster map) or "scatter" (the Moran scatterplot) 'both'
tiles str | None The basemap style (None: no basemap) 'carto-positron'
title str | None The figure title None
gdf Boundaries to use instead of the project’s (a GeoDataFrame with geo_id) None

Returns

Name Type Description
result object A result with .fig (by default the Moran scatterplot and the cluster map side by side; see panels), .fig_map (the cluster map alone), .fig_scatter (the Moran scatterplot alone), .df (one row per unit: local statistic, p-value and cluster: High-High, Low-Low, High-Low, Low-High or not significant), the number of units of each type (.n_hh, .n_ll, .n_hl, .n_lh, .n_ns), the global .moran_i and .interpret().

Example

!pip install -q geo4bolivia
import geo4bolivia as geo

res = geo.lisa("sdg", "index_sdg", year=2024)
print(res.interpret())
res.fig

Local Moran statistics (LISA) locate where Sustainable Development Index, IDS (0-100) in 2024 clusters or stands out, under queen contiguity (1 island(s) attached to nearest neighbor), row-standardized, n=343. The accompanying global Moran’s I is 0.468 (pseudo p = 0.001), consistent with overall clustering of similar values.

At the 0.05 significance level, 116 of 343 units show significant local association: 60 High-High hot spots (high values surrounded by high neighbors) and 45 Low-Low cold spots (low surrounded by low) mark clustering, while 6 High-Low and 5 Low-High units are spatial outliers that break with their surroundings. The remaining 227 units are not significant — their local pattern is compatible with randomness.

LISA pseudo p-values are computed unit by unit without a multiple-testing adjustment, so treat borderline clusters cautiously and read the map as descriptive of where dependence concentrates.

These are associations, not causal effects. A causal reading needs a research design.