Expand description
Spatial statistics module for analyzing spatial patterns and relationships
This module provides statistical measures commonly used in spatial analysis, including measures of spatial autocorrelation, clustering, and pattern analysis.
§Features
- Spatial Autocorrelation: Moran’s I, Geary’s C
- Local Indicators: Local Moran’s I (LISA)
- Distance-based Statistics: Getis-Ord statistics
- Pattern Analysis: Nearest neighbor analysis
§Examples
use scirs2_core::ndarray::array;
use scirs2_spatial::spatial_stats::{morans_i, gearys_c};
// Create spatial data (values at different locations)
let values = array![1.0, 2.0, 1.5, 3.0, 2.5];
// Define spatial weights matrix (adjacency-based)
let weights = array![
[0.0, 1.0, 0.0, 0.0, 1.0],
[1.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 1.0, 0.0, 1.0],
[1.0, 0.0, 0.0, 1.0, 0.0],
];
// Calculate spatial autocorrelation
let moran = morans_i(&values.view(), &weights.view()).unwrap();
let geary = gearys_c(&values.view(), &weights.view()).unwrap();
println!("Moran's I: {:.3}", moran);
println!("Geary's C: {:.3}", geary);Functions§
- clark_
evans_ index - Calculate Clark-Evans nearest neighbor index
- distance_
weights_ matrix - Calculate spatial weights matrix based on distance decay
- gearys_
c - Calculate Geary’s C statistic for spatial autocorrelation
- getis_
ord_ gi - Calculate Getis-Ord Gi statistic for hotspot analysis
- local_
morans_ i - Calculate Local Indicators of Spatial Association (LISA) using Local Moran’s I
- morans_
i - Calculate Moran’s I statistic for spatial autocorrelation