about global getis g
On Sun, 21 Dec 2014, kun17 wrote:
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?
The Crimestat IV values are:
CS
d G EG SEG ZG V2 1 0.013267 0.013072 0.000262 0.745199 V3 2 0.037919 0.037630 0.000457 0.632980 V4 3 0.082821 0.082949 0.000736 -0.174370 V5 4 0.134129 0.135285 0.001036 -1.115844 V6 5 0.207490 0.210736 0.001491 -2.176953 V7 6 0.274011 0.279748 0.001903 -3.014358 V8 7 0.341543 0.350490 0.002316 -3.862926 V9 8 0.420876 0.434448 0.002797 -4.852804 V10 9 0.503771 0.521002 0.003203 -5.378934 which agree on G and E(G), but not beyond that. Ch 5 of the Crimestat manual has an error for B1, equation 5.21, which does not take into account the erratum published by the authors in 1993: "On page 195, the coefficient of W2 in B1, (just below center of the page) should be 6, not 3.". However, this doesn't seem to be the only problem, as the spdep code when modified not to correct B1 doesn't reproduce the CrimeStat Standard error of "G" values. Since CrimeStat is closed-source, and since we can show an error in their documentation, I suggest that you take this up with them, pointing out their not accommodating an erratum (there were more) published over twenty years ago, ask for a clarification, and report back here when they say what they are actually doing. The source to globalG.test() is readable, so they can readily check what it does. Hope this helps, Roger
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.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 91 00 e-mail: Roger.Bivand at nhh.no