pysal.explore.esda.Geary

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

Global Geary C Autocorrelation statistic

Parameters:
y : array

(n, 1) attribute vector

w : W

spatial weights

transformation : {‘B’, ‘R’, ‘D’, ‘U’, ‘V’}

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

permutations : int

number of random permutations for calculation of pseudo-p_values

Notes

Technical details and derivations can be found in [CO81].

Examples

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

original variable

w : W

spatial weights

permutations : int

number of permutations

C : float

value of statistic

EC : float

expected value

VC : float

variance of G under normality assumption

z_norm : float

z-statistic for C under normality assumption

z_rand : float

z-statistic for C under randomization assumption

p_norm : float

p-value under normality assumption (one-tailed)

p_rand : float

p-value under randomization assumption (one-tailed)

sim : array

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

p_sim : float

(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

EC_sim : float

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

VC_sim : float

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

seC_sim : float

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

z_sim : float

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

p_z_sim : float

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

Methods

by_col(df, cols[, w, inplace, pvalue, outvals]) Function to compute a Geary statistic on a dataframe
__init__(y, w, transformation='r', permutations=999)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(y, w[, transformation, permutations]) Initialize self.
by_col(df, cols[, w, inplace, pvalue, outvals]) Function to compute a Geary statistic on a dataframe