[R-sig-Geo] about global getis g

kun17 kzhang at geo.ecnu.edu.cn
Sun Dec 21 15:19:44 CET 2014


cold.zip <http://r-sig-geo.2731867.n2.nabble.com/file/n7587571/cold.zip>  

hello everyone,

I have designed a random grid file and put a 'cold spots' in the center, I
used globalG.test in spdep package to test the 'cold spots',but the results
made me confused, below is my code:

library(spdep)
library(maptools)
simu=readShapeSpatial("C:/GridCold.shp")
dists=1:12 
n=length(dists)
GG=EG=VG=ZG=pvalue=numeric(length=n)

coord=coordinates(simu)
for(i in 1:n){
	dnb=dnearneigh(coord,0,dists[i]) 
	simu.w=nb2listw(dnb,style="B",zero.policy=TRUE)	
	G=globalG.test(simu$value,simu.w,zero.policy=TRUE,alternative="two.sided")
	GG[i]=G$estimate[1]
	EG[i]=G$estimate[2]
	VG[i]=G$estimate[3]
	ZG[i]=G$statistic
	pvalue[i]=G$p.value
}
cbind(dists,GG,EG,VG,ZG,pvalue)

the results is:

    dists         GG         EG           VG         ZG       pvalue
 [1,]     1 0.01326694 0.01307190 1.127119e-09  5.8097284 6.257426e-09
 [2,]     2 0.03791890 0.03762976 1.456950e-08  2.3954667 1.659922e-02
 [3,]     3 0.08282060 0.08294887 1.127367e-07 -0.3820144 7.024507e-01
 [4,]     4 0.13412895 0.13528451 3.728269e-07 -1.8925080 5.842333e-02
 [5,]     5 0.20749034 0.21073626 1.131177e-06 -3.0519145 2.273869e-03
 [6,]     6 0.27401114 0.27974817 2.170007e-06 -3.8945442 9.838356e-05
 [7,]     7 0.34154256 0.35049020 3.542196e-06 -4.7541397 1.992932e-06
 [8,]     8 0.42087567 0.43444829 5.557734e-06 -5.7572477 8.549642e-09
 [9,]     9 0.50377144 0.52100154 7.538721e-06 -6.2753643 3.488166e-10
[10,]    10 0.58757397 0.60659362 8.890566e-06 -6.3787831 1.785007e-10
[11,]    11 0.65976673 0.67685506 8.894732e-06 -5.7297151 1.005995e-08
[12,]    12 0.72722625 0.74144560 8.057964e-06 -5.0091840 5.466130e-07

the first two rows with distance 1 and 2 indicate significant 'hot spots'!
when I use CrimeStat to calculate global G, when distance is 1 and 2,the
results are both not significant.

Could someone explain the difference?

thank you!

Kun



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/about-global-getis-g-tp7587571.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list