Performing Moran's I to conduct correlation analysis on topological/geometrical relationship.
Moran's I, developed by Patrick Alfred Pierce Moran [1], measures spatial autocorrelation globally based on the feature locations and values. It quantifies the relationship how clustered the values of data points geometrically are, i.e. the spatial lagged.
Apologies for my laziness. :( I've been finding a decent job, studying for my master's, buiding algo for trading, and haven't updated since the date I created it. I see constantly there are people cloning it and I think the repo deserves more attention. Let me know if you would be interested in joining as a maintainer to make this better.
This module is expected to compile for 'python 3.7-3.9'
You have to customly define the spatial weighted matrix for describing the topogical/geometrical relationship. You may want to refer to example/Spatial Autocorrelation.ipynb.
Moran's I is within-1 and 1.
- -1 represents perfectly dispersed
- 0 represents randomness
- 1 represents perfectly clustered
For calculating the global Moran's I, you can execute
from spatial_autocorrelation import global_moransI
You are also able to visualize the global relationship on a plot
from spatial_autocorrelation import moransI_scatterplot
Since it is a inferential statistics, the Moran's I value can be converted into Z score for conducting statistical hypothesis testing
from spatial_autocorrelation import hypothesis_testing
You can retrieve a dataframe containing local Moran's I, Z score of each individual data point by using
from spatial_autocorrelation import get_localMoransI
You can also visualize the high-high, high-low, low-high, low-low clusters on a plot
from spatial_autocorrelation import LISA_scatterplot