pysal.explore.esda.Gamma

class pysal.explore.esda.Gamma(y, w, operation='c', standardize='no', permutations=999)[源代码]

空间自相关的伽马指数

参数:
y : 数组

跨n个空间单元测量的变量

w : W

空间权重实例可以是二进制或行标准化的

operation : { c’,s’,‘a’}

属性相似度函数,其中“c”叉积“s”平方差“a”绝对差

standardize : {“不”,“是”}

首先标准化变量“否”保持原样“是”或“Y”标准化为零和方差1。

permutations : 利息

计算伪p_值的随机排列数

笔记

有关更多技术详细信息,请参阅 [HGC81] .

实例

使用与连接计数相同的示例来显示相似性

>>> import pysal.lib, numpy as np
>>> from pysal.explore.esda.gamma import Gamma
>>> w = pysal.lib.weights.lat2W(4,4)
>>> y=np.ones(16)
>>> y[0:8]=0
>>> np.random.seed(12345)
>>> g = Gamma(y,w)
>>> g.g
20.0
>>> round(g.g_z, 3)
3.188
>>> round(g.p_sim_g, 3)
0.003
>>> g.min_g
0.0
>>> g.max_g
20.0
>>> g.mean_g
11.093093093093094
>>> np.random.seed(12345)
>>> g1 = Gamma(y,w,operation='s')
>>> g1.g
8.0
>>> round(g1.g_z, 3)
-3.706
>>> g1.p_sim_g
0.001
>>> g1.min_g
14.0
>>> g1.max_g
48.0
>>> g1.mean_g
25.623623623623622
>>> np.random.seed(12345)
>>> g2 = Gamma(y,w,operation='a')
>>> g2.g
8.0
>>> round(g2.g_z, 3)
-3.706
>>> g2.p_sim_g
0.001
>>> g2.min_g
14.0
>>> g2.max_g
48.0
>>> g2.mean_g
25.623623623623622
>>> np.random.seed(12345)
>>> g3 = Gamma(y,w,standardize='y')
>>> g3.g
32.0
>>> round(g3.g_z, 3)
3.706
>>> g3.p_sim_g
0.001
>>> g3.min_g
-48.0
>>> g3.max_g
20.0
>>> g3.mean_g
-3.2472472472472473
>>> np.random.seed(12345)
>>> def func(z,i,j):
...     q = z[i]*z[j]
...     return q
...
>>> g4 = Gamma(y,w,operation=func)
>>> g4.g
20.0
>>> round(g4.g_z, 3)
3.188
>>> round(g4.p_sim_g, 3)
0.003
属性:
y : 数组

原始变量

w : W

原始W对象

op : { c’,s’,‘a’}

属性相似度函数,根据参数属性相似度函数

stand : {“不”,“是”}

标准化

permutations : 利息

排列数

gamma : 浮动

伽玛指数值

sim_g : 数组

(如果排列>0)排列样本的伽马指数值向量

p_sim_g : 数组

(如果排列>0)基于排列(单侧)的p值空:空间随机性替代:观察到的gamma比作为双面测试实现的随机性下更极端

mean_g : 浮动

排列伽玛值的平均值

min_g : 浮动

排列伽玛值的最小值

max_g : 浮动

排列伽玛值的最大值

方法

by_col  
__init__(y, w, operation='c', standardize='no', permutations=999)[源代码]

初始化自身。请参阅帮助(键入(self))以获得准确的签名。

方法

__init__ \(Y,W[,操作,标准化,…]) 初始化自身。
by_col \(df,cols[,w,inplace,pvalue,outvals])

属性

p_sim  与Moran模块匹配的新名称