# Spatial statistics areal

> Spatial statistics areal is an open-source agent skill for analytics and data. Test and model spatial association and spillovers across polygon zones with R or Python. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ccarbajal16/soil-dsm-skills/tree/main/plugins/dsm-soil/skills/spatial-statistics-areal
- **Repository:** https://github.com/ccarbajal16/soil-dsm-skills
- **GitHub stars:** 13
- **License:** MIT
- **Skill name:** spatial-statistics-areal
- **Collection:** https://github.com/ccarbajal16/soil-dsm-skills
- **Categories:** [analytics and data](https://ai-powered.com/categories/analytics-and-data)
- **Listing updated:** 2026-12-03

## About

This skill guides an agent through spatial association analysis on areal data, where each polygon such as a district or municipality carries a single value. It covers global and local Moran's I, bivariate Moran and BiLISA hot and cold spot mapping, Lee's L, and spatial weights matrices built from queen, rook and k-nearest-neighbour definitions. The workflow stresses running results across several weight specifications and reporting which ones hold up, rather than quoting a single statistic.

For explanation rather than prediction, the skill walks through Rao's score diagnostics and a family of spatial regression models (SLX, SAR, SEM, SDM and SDEM), then reports direct, indirect and total impacts using the LeSage-Pace decomposition. It also flags common pitfalls, such as misreading Moran's I as a strength measure, using normal approximations for local tests, and quoting shortcut spillover estimates. Pipelines are given in both R (spdep and spatialreg) and Python (libpysal, esda and spreg), and the skill includes a checklist for reporting results.

The agent is expected to work with polygon data in a metric projected coordinate system and to have R or Python with the listed spatial packages installed. The skill notes that it is not intended for surface prediction or map accuracy work, which belong to other soil mapping workflows.

## When your agent uses it

> Analyse spatial association and spatial dependence on areal (lattice/polygon) data for ANY variable — global and local Moran's I, LISA hot/cold spots and spatial outliers, bivariate Moran and BiLISA, Lee's L, spatial weights matrices and their robustness, Rao's-score (ex-Lagrange multiplier) diagnostics, and spatial regression (SLX, SAR, SEM, SDM, SDEM) with LeSage-Pace direct/indirect/total impact decomposition. Use when the question is about association, explanation or spillover across zones rather than prediction of a surface — for example relating cumulative forest loss to SOC stocks across the zones of a forest region. Triggers: "spatial autocorrelation", "Moran's I", "LISA", "hot spot analysis", "bivariate Moran", "BiLISA", "spatial weights matrix", "queen contiguity", "Lagrange multiplier test", "LM test spatial", "SAR model", "SEM model", "spatial lag", "spatial error", "SDM", "SDEM", "spatial econometrics", "spillover", "direct indirect effects", "impacts", "spdep", "spatialreg", "GeoDa", "areal data

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ccarbajal16/soil-dsm-skills/tree/HEAD/plugins/dsm-soil/skills/spatial-statistics-areal)
- [License: MIT](https://github.com/ccarbajal16/soil-dsm-skills/tree/HEAD/plugins/dsm-soil/skills/spatial-statistics-areal)

## Features

- **Global spatial autocorrelation tests:** Univariate and bivariate Moran's I plus Lee's L, computed across several neighbour definitions.
- **Local cluster and outlier mapping:** LISA and BiLISA quadrant classification with permutation-based significance and multiple-comparison adjustment.
- **Spatial weights construction:** Queen, rook and k-nearest-neighbour weights with row standardisation and connectivity checks.
- **Regression diagnostics and model family:** Rao's score tests and fitting of SLX, SAR, SEM, SDM and SDEM models with AIC comparison.
- **Direct and indirect impact decomposition:** LeSage-Pace impacts with simulated p-values, distinguishing exact decomposition from shortcut estimates.
- **R and Python pipelines:** Parallel code using spdep, spatialreg, libpysal, esda and spreg, with a cross-language API mapping.

## Good for

- Test whether high forest loss in one district is associated with soil carbon in neighbouring districts
- Identify hot spots and cold spots of a socioeconomic indicator across municipalities
- Compare queen and k-nearest-neighbour weights to check whether a spatial result is robust
- Fit SAR, SEM and SDM models and compare them by AIC for zone-level data
- Estimate direct and indirect spillover effects from a spatial lag model

## Install

### Claude Code

This skill ships in the `dsm-soil` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ccarbajal16/soil-dsm-skills
/plugin install dsm-soil@soil-dsm-skills
```

Or copy only this skill to `~/.claude/skills/spatial-statistics-areal`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/spatial-statistics-areal &&
cp -R "$tmp/plugins/dsm-soil/skills/spatial-statistics-areal" ~/.claude/skills/spatial-statistics-areal &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/spatial-statistics-areal` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/spatial-statistics-areal` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/spatial-statistics-areal &&
cp -R "$tmp/plugins/dsm-soil/skills/spatial-statistics-areal" ~/.agents/skills/spatial-statistics-areal &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/spatial-statistics-areal` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/spatial-statistics-areal` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/spatial-statistics-areal &&
cp -R "$tmp/plugins/dsm-soil/skills/spatial-statistics-areal" ~/.cursor/skills/spatial-statistics-areal &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/spatial-statistics-areal` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ccarbajal16/soil-dsm-skills.git --path plugins/dsm-soil/skills/spatial-statistics-areal
```

Or copy the folder to `~/.gemini/skills/spatial-statistics-areal` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/spatial-statistics-areal`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/spatial-statistics-areal &&
cp -R "$tmp/plugins/dsm-soil/skills/spatial-statistics-areal" ~/.copilot/skills/spatial-statistics-areal &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/spatial-statistics-areal` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ccarbajal16/soil-dsm-skills.git
```

Then copy `soil-dsm-skills/plugins/dsm-soil/skills/spatial-statistics-areal` into your agent's skills folder as `spatial-statistics-areal`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What kind of data does Spatial statistics areal work with?

It is for polygon or areal data with one value per zone, such as districts or fields, and it is not meant for continuous raster surface prediction.

### Which tools does the analysis require?

The pipelines use R with sf, spdep and spatialreg, or Python with libpysal, esda, spreg and geopandas. The skill itself ships no scripts.

### Does Spatial statistics areal work with a specific AI client?

The skill follows the shared SKILL.md format, so it is not tied to a single client in its content.

### Does the skill establish causation?

No. The content states that cross-sectional spatial results are associations and do not support causal claims.

### How do I install Spatial statistics areal in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/spatial-statistics-areal to use it in all your projects, or to .claude/skills/spatial-statistics-areal in one project. Or install the dsm-soil plugin, which includes it: /plugin marketplace add ccarbajal16/soil-dsm-skills, then /plugin install dsm-soil@soil-dsm-skills.

### Does Spatial statistics areal run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Spatial statistics areal?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Spatial statistics areal?

The closest alternatives to Spatial statistics areal are Spatial prediction uncertainty, Quantitative analysis, Data scientist, Data analysis and Data analysis.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Spatial prediction uncertainty](https://ai-powered.com/skills/spatial-prediction-uncertainty): Spatial prediction uncertainty is an open-source agent skill for analytics and data.
- [Quantitative analysis](https://ai-powered.com/skills/quantitative-analysis): Quantitative analysis is an open-source agent skill for analytics and data.
- [Data scientist](https://ai-powered.com/skills/data-scientist): Data scientist is an open-source agent skill for analytics and data.
- [Data analysis](https://ai-powered.com/skills/data-analysis-melandlabs): Data analysis is an open-source agent skill for analytics and data.
- [Data analysis](https://ai-powered.com/skills/data-analysis-superhero-tech): Data analysis is an open-source agent skill for analytics and data.
- [Data analysis](https://ai-powered.com/skills/data-analysis): Data analysis is an open-source agent skill for analytics and data.
- [Datanalysis credit risk](https://ai-powered.com/skills/datanalysis-credit-risk): Datanalysis credit risk is an open-source agent skill for analytics and data.
- [Anomaly investigation](https://ai-powered.com/skills/anomaly-investigation): Anomaly investigation is an open-source agent skill for analytics and data.

---
Source: https://ai-powered.com/skills/spatial-statistics-areal
