Logo di Spatial Statistics

Spatial Statistics

Community
muend
spatial-statistics

Always invoke before testing a geographic pattern for clustering, hotspots, dependence, or explanatory regression, even when aggregation or ordinary OLS is proposed as routine. Covers Moran's I, LISA, Getis-Ord Gi*, weights, MAUP and scale sensitivity for areas/grids, residual dependence, and spatial lag/error/GWR/MGWR models. Use ML standards for predictive evaluation and geostatistics for continuous surfaces from sparse samples.

Panoramica

Autoremuend
Repositorygeoai-skills
Nome della skillspatial-statistics
Stelle
45
Fork
5
File inclusi
2
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • 2 file inclusi

    Script, modelli di documento e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da muend su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Spatial Statistics in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/muend/geoai-skills/tree/main/skills/spatial-statistics
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/muend/geoai-skills.git /tmp/geoai-skills
mkdir -p .claude/skills
cp -r /tmp/geoai-skills/skills/spatial-statistics .claude/skills/spatial-statistics
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Spatial Statistics in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Spatial Statistics non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Spatial Statistics non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Spatial Statistics

Purpose: answer "is it clustered, where, and why" with defensible inference. The core discipline: spatial data violates independence assumptions, so standard statistics silently overstate significance — every analysis here starts with weights design and ends with residual diagnostics.

Spatial weights (W) — the analysis IS the weights

Every result downstream depends on W; choose it for substantive reasons and run a sensitivity check with one alternative:

WeightsUse when
Queen/Rook contiguityIrregular polygons (admin units, parcels)
K-nearest neighborsPoints; islands present (contiguity leaves them unconnected)
Distance bandPhysical process with known range
Kernel (distance-decayed)Smooth influence, GWR-style local models
python
from libpysal.weights import Queen

w = Queen.from_dataframe(gdf, use_index=True)
print(f"islands: {w.islands}")   # unconnected units break stats — fix or document
w.transform = "r"                # row-standardize (default for Moran/lag models)

Always report: weights type, parameters, number of islands, and whether results survive an alternative W.

Global → local workflow

  1. Global Moran's I (esda.Moran, permutation inference ≥999) — answers "any clustering at all?" Report I, p_sim, and the permutation distribution, not the analytical p.
  2. LISA / local Moran (esda.Moran_Local) — maps WHERE: High-High, Low-Low clusters, High-Low/Low-High outliers. Correct for multiple testing (FDR at minimum) before coloring a map — uncorrected LISA maps overstate clusters and this is the field's most common abuse.
  3. Getis-Ord Gi* (esda.G_Local, star=True) — hot/cold spots of intensity (a distinct question from Moran clusters — Gi* finds concentrations of high values, LISA finds similarity structure).
  4. Rates, not counts, for population-based phenomena; use Empirical Bayes smoothing (esda.smoothing) for small-population units before any of the above — raw rates in sparse units are noise.

Point patterns

  • Separate first-order intensity (density varies) from second-order interaction (points attract/repel) — KDE describes the former, Ripley's K/L (pointpats) tests the latter.
  • Always test against an inhomogeneous null when the study area has obvious density gradients (population, roads); CSR against a city is a strawman.
  • KDE bandwidth drives the story: report it, justify it (Silverman/CV), and show one alternative.

Spatial regression decision path

Run OLS first, then diagnose — never start with a spatial model:

python
from spreg import OLS
ols = OLS(y, X, w=w, spat_diag=True, moran=True, name_y="price", name_x=xnames)

Decision (Anselin's rule via LM tests): LM-Lag significant & LM-Error not → spatial lag (SAR); reverse → spatial error (SEM); both → compare robust LM versions; neither → OLS stands (report that as a finding). Interpretation caveats: in SAR, coefficients are NOT marginal effects — report direct/indirect (spillover) effects. In SEM, spatial structure is nuisance correlation, no spillover story allowed.

GWR/MGWR (mgwr): when relationships plausibly vary over space. Bandwidth by AICc search; map local coefficients WITH local t-values masked for insignificance; MGWR when predictors operate at different scales. GWR is exploratory — resist causal language on local coefficients.

Inference honesty

  • Permutation p-values over analytical ones wherever available.
  • Multiple testing: n local tests = n units; FDR-correct.
  • MAUP (modifiable areal unit problem): results can flip with unit aggregation — if the aggregation level is a choice, test one alternative and disclose.
  • Spatial autocorrelation in residuals after modeling = model still wrong; report residual Moran's I for every final model.
  • Correlation ≠ causation applies doubly here: spatially confounded variables (everything correlates with "distance to coast") demand explicit identification strategies before causal claims.

Reporting template

## Spatial analysis: <question>
- Units & n, variable(s), rate smoothing: <...>
- W: <type/params>, islands: <n>, sensitivity W: <type>
- Global: Moran's I = <> (p_perm = <>)
- Local: <k> significant clusters after FDR; map attached
- Model: <OLS/SAR/SEM/GWR> chosen because <LM diagnostics>
- Residual Moran's I: <> — <interpretation>
- Caveats: MAUP, W-sensitivity, causal limits

Execution contract

  • Workflow: define inferential question and unit; inspect distributions and rates; construct and justify spatial weights; run global before local tests; fit models if needed; diagnose residual dependence; report uncertainty.
  • Decision rules: use spatial statistics for dependence and inference, geostatistics for interpolating sampled continuous surfaces, and predictive ML when out-of-sample prediction is the primary goal.
  • Verification protocol: test alternative weights and aggregation, use valid permutation or model inference, correct local multiplicity, inspect residual Moran's I, and distinguish association from causation.
  • Failure modes: withhold inferential claims for arbitrary weights, islands ignored, unstable MAUP results, uncorrected multiple tests, residual autocorrelation, or unsupported causal language.
  • Deliverables: analysis-ready variables, weights specification, global and local results, corrected significance, diagnostic maps, model and residual checks, sensitivity analysis, and caveats.
  • Source freshness: consult the authoritative source registry before applying version-sensitive statistical APIs or defaults.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Spatial Statistics?

Always invoke before testing a geographic pattern for clustering, hotspots, dependence, or explanatory regression, even when aggregation or ordinary OLS is proposed as routine. Covers Moran's I, LISA, Getis-Ord Gi*, weights, MAUP and scale sensitivity for areas/grids, residual dependence, and spatial lag/error/GWR/MGWR models. Use ML standards for predictive evaluation and geostatistics for continuous surfaces from sparse samples.

Perché usare Spatial Statistics su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Spatial Statistics è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Spatial Statistics in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/muend/geoai-skills/tree/main/skills/spatial-statistics. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Spatial Statistics?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Spatial Statistics?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Spatial Statistics: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Spatial Statistics è gratuita?

Sì. È pubblicata su GitHub da muend con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇