esda.G¶
-
class esda.G(y, w, permutations=
999)[source]¶ Global G Autocorrelation Statistic
- Parameters:¶
- p_sim[source]¶
p-value based on permutations (one-sided) null: spatial randomness alternative: the observed G is extreme it is either extremely high or extremely low
Notes
Moments are based on normality assumption.
For technical details see [Getis and Ord, 2010] and [Ord and Getis, 2010].
Examples
>>> import libpysal >>> import numpy >>> numpy.random.seed(10)Preparing a point data set
>>> points = [(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]Creating a weights object from points
>>> w = libpysal.weights.DistanceBand(points, threshold=15) >>> w.transform = "B"Preparing a variable
>>> y = numpy.array([2, 3, 3.2, 5, 8, 7])Applying Getis and Ord G test
>>> from esda import G >>> g = G(y, w)Examining the results
>>> round(g.G, 3) np.float64(0.557)>>> round(g.p_norm, 3) np.float64(0.173)