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()).expect("Operation failed");
let geary = gearys_c(&values.view(), &weights.view()).expect("Operation failed");
println!("Moran's I: {:.3}", moran);
println!("Geary's C: {:.3}", geary);Structs§
- AnnResult
- Result of the average nearest neighbor analysis
Functions§
- average_
nearest_ neighbor - Calculate the average nearest neighbor distance statistic
- clark_
evans_ index - Calculate Clark-Evans nearest neighbor index
- contiguity_
weights_ matrix - Build a contiguity-based spatial weights matrix from polygon adjacency
- 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
- knn_
weights_ matrix - Build a k-nearest neighbors spatial weights matrix
- 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
- ripleys_
k - Compute Ripley’s K-function for point pattern analysis
- ripleys_
l - Compute Ripley’s L-function (variance-stabilized K-function)