esda.Geary

class esda.Geary(y, w, transformation='r', permutations=999)[source]

Global Geary C Autocorrelation statistic

Parameters:
y : array

(n, 1) attribute vector

w : W | Graph

spatial weights instance as W or Graph aligned with y

transformation : {'R', 'B', 'D', 'U', 'V'}

weights transformation, default is row-standardized. Other options include “B”: binary, “D”: doubly-standardized, “U”: untransformed (general weights), “V”: variance-stabilizing.

permutations : int

number of random permutations for calculation of pseudo-p_values

y[source]

original variable

Type:

array

w[source]

spatial weights

Type:

W | Graph

permutations[source]

number of permutations

Type:

int

C[source]

value of statistic

Type:

float

EC[source]

expected value

Type:

float

VC[source]

variance of G under normality assumption

Type:

float

z_norm[source]

z-statistic for C under normality assumption

Type:

float

z_rand[source]

z-statistic for C under randomization assumption

Type:

float

p_norm[source]

p-value under normality assumption (one-tailed)

Type:

float

p_rand[source]

p-value under randomization assumption (one-tailed)

Type:

float

sim[source]

(if permutations!=0) vector of I values for permutated samples

Type:

array

p_sim[source]

(if permutations!=0) p-value based on permutations (one-tailed) null: sptial randomness alternative: the observed C is extreme it is either extremely high or extremely low

Type:

float

EC_sim[source]

(if permutations!=0) average value of C from permutations

Type:

float

VC_sim[source]

(if permutations!=0) variance of C from permutations

Type:

float

seC_sim[source]

(if permutations!=0) standard deviation of C under permutations.

Type:

float

z_sim[source]

(if permutations!=0) standardized C based on permutations

Type:

float

p_z_sim[source]

(if permutations!=0) p-value based on standard normal approximation from permutations (one-tailed)

Type:

float

Examples

>>> import libpysal
>>> import numpy
>>> from esda import Geary
>>> w = libpysal.io.open(libpysal.examples.get_path("book.gal")).read()
>>> f = libpysal.io.open(libpysal.examples.get_path("book.txt"))
>>> y = numpy.array(f.by_col['y'])
>>> c = Geary(y, w, permutations=0)
>>> round(c.C, 7)
np.float64(0.3330108)
>>> round(c.p_norm, 7)
np.float64(9.2e-05)

Notes

Technical details and derivations can be found in [Cliff and Ord, 1981].