pysal.explore.esda.
G_Local
(y, w, transform='R', permutations=999, star=False)[源代码]¶广义局部G自相关
参数: |
|
---|
笔记
为了在正态性假设下计算Gs的矩,Pysal认为W要么是二进制的,要么是行标准化的。对于二进制权重对象,对于行标准化权重对象,self的权重值为1,self的权重值为1/(其邻居数+1)。
有关技术详细信息,请参阅 [GO10] 和 [OG10] .
实例
>>> import pysal.lib
>>> import numpy
>>> numpy.random.seed(10)
准备点数据集
>>> points = [(10, 10), (20, 10), (40, 10), (15, 20), (30, 20), (30, 30)]
从点创建权重对象
>>> w = pysal.lib.weights.DistanceBand(points,threshold=15)
准备变量
>>> y = numpy.array([2, 3, 3.2, 5, 8, 7])
使用二进制权重对象应用getis和ord本地g测试
>>> from pysal.explore.esda.getisord import G_Local
>>> lg = G_Local(y,w,transform='B')
检查结果
>>> lg.Zs
array([-1.0136729 , -0.04361589, 1.31558703, -0.31412676, 1.15373986,
1.77833941])
>>> round(lg.p_sim[0], 3)
0.101
>>> numpy.random.seed(10)
使用二进制权重对象应用getis和ord local g*测试>>>lg_star=g_local(y,w,transform='b',star=true)
检查结果>>>lg_star.zs array([-1.39727626,-0.28917762,0.65064964,-0.28917762,1.23452088,
2.02424331)
>>> round(lg_star.p_sim[0], 3)
0.101
>>> numpy.random.seed(12345)
使用行标准化权重对象应用getis和ord本地g测试>>>lg=g_本地(y,w,transform='r')
检查结果>>>lg.zs数组([-0.62074534,-0.01780611,1.31558703,-0.12824171,0.28843496,
1.77833941)
>>> round(lg.p_sim[0], 3)
0.103
>>> numpy.random.seed(10)
使用行标准化权重对象应用GETIS和ORD本地G*测试
>>> lg_star = G_Local(y,w,transform='R',star=True)
检查结果>>>lg_star.zs array([-0.62488094,-0.09144599,0.41150696,-0.09144599,0.24690418,
1.28024388)
>>> round(lg_star.p_sim[0], 3)
0.101
属性: |
|
---|
方法
by_col \(df,cols[,w,inplace,pvalue,outvals]) |
在数据帧上计算G_局部统计的函数 |
calc |
方法
__init__ \(Y,W[,转换,排列,星形]) |
初始化自身。 |
by_col \(df,cols[,w,inplace,pvalue,outvals]) |
在数据帧上计算G_局部统计的函数 |
calc () |