[R-sig-Geo] Strange results in DCluster package

Corey Sparks corey.sparks at UTSA.EDU
Tue Feb 28 21:09:03 CET 2012


Dear list,
I am using the DCluster package and running the Kulldorrff scan statistic
for clustering of crime rates.
Here is my code:
library(spdep)
library(DCluster)
library(classInt)
library(RColorBrewer)

#read in shapefile
sabg<-readShapePoly("satract.shp", proj4string=CRS("+proj=utm +zone=14"))

#get observed and expected counts for each census tract
sabg$crimes<-sabg$Count_1
sabg$expcrime.rt<-sabg$POPSIZE*sum(sabg$crimes)/sum(sabg$POPSIZE)

#assign coordinates to the polygon centroids
sabg$x<-coordinates(sabg)[,1]
sabg$y<-coordinates(sabg)[,2]

#Create the data frame demanded by DCluster
sa<-data.frame(Observed=sabg$crimes)
sa<-cbind(sa, Expected=sabg$POPSIZE*sum(sabg$crimes)/sum(sabg$POPSIZE))
sa<-cbind(sa, x=sabg$x, y=sabg$y)
sa$Observed<-as.numeric(sa$Observed)


#Kuldorff-Nagarwalla analysis
mle<-calculate.mle(sa, model="poisson")
knres<-opgam(data=sa, thegrid=sa[,c("x","y")], alpha=.05, R=999,
iscluster=kn.iscluster, fractpop=.25, model="poisson", mle=mle)

#here is the result

knres
          x       y     statistic cluster pvalue size
1   549400.3 3255340           Inf       1  0.001    1
2   550731.4 3255426           Inf       1  0.001    4
3   550353.6 3253989           Inf       1  0.001    8
4   548815.9 3254113           Inf       1  0.001    3
5   547636.8 3254318           Inf       1  0.001    8
6   547764.7 3255747           Inf       1  0.001    9
7   548392.6 3256607           Inf       1  0.001    5
8   549163.2 3257082           Inf       1  0.001    6
9   550151.3 3256710           Inf       1  0.001    5
10  551313.1 3256875           Inf       1  0.001   14
11  554570.4 3259179           Inf       1  0.001   52
12  552041.0 3258976           Inf       1  0.001   46
13  556862.8 3261649           Inf       1  0.001   56
14  557429.1 3264038           Inf       1  0.001    8
15  553744.5 3262400           Inf       1  0.001   53
16  551412.1 3264906           Inf       1  0.001   16
17  551185.5 3263488           Inf       1  0.001   60
18  553672.4 3264075           Inf       1  0.001   23
19  554408.5 3265909           Inf       1  0.001   24
20  555923.9 3264435           Inf       1  0.001   14
21  553779.5 3266913           Inf       1  0.001   23
22  553849.9 3270009  1.869931e+05       1  0.001   20
23  559012.4 3267263 1.572973e+129       1  0.001    1
24  556118.3 3266436           Inf       1  0.001    7
25  557527.1 3268064 8.142677e+276       1  0.001    2
26  558905.3 3269407  3.048445e+22       1  0.001    5
27  560312.0 3266480  4.241565e+59       1  0.001   10
28  561209.9 3262653 2.240608e+170       1  0.001   62
29  559700.8 3263883           Inf       1  0.001    4
30  558802.2 3261427           Inf       1  0.001   58
31  560880.9 3267525  3.140650e+07       1  0.001   55
32  561308.0 3269593  3.803521e+03       1  0.001    1
33  551645.1 3255564           Inf       1  0.001   14
34  551656.9 3254163           Inf       1  0.001   28
35  551683.5 3253222           Inf       1  0.001   33
36  553754.8 3253146           Inf       1  0.001   32
37  553135.7 3254545           Inf       1  0.001   30
38  553131.0 3255779           Inf       1  0.001   26
39  553195.6 3256784           Inf       1  0.001   19
40  555212.4 3256263           Inf       1  0.001   36
41  557489.4 3256572           Inf       1  0.001   42
42  557554.7 3254371           Inf       1  0.001   68
43  555609.4 3253067           Inf       1  0.001   56
44  556845.1 3252107           Inf       1  0.001   56
45  558457.2 3251616           Inf       1  0.001   53
46  560557.1 3250393           Inf       1  0.001   63
47  560958.4 3257710           Inf       1  0.001   66
48  559050.3 3257869           Inf       1  0.001   60
49  562012.5 3261814 3.537503e+106       1  0.001   62
50  550552.2 3253113           Inf       1  0.001   12
51  550340.2 3251987           Inf       1  0.001   66
52  550133.2 3250927           Inf       1  0.001   69
53  551673.4 3252067           Inf       1  0.001   44
54  552866.0 3252026           Inf       1  0.001   52
55  553986.1 3251639           Inf       1  0.001   43
56  552303.1 3251048           Inf       1  0.001   71
57  551465.5 3249950           Inf       1  0.001   67
58  552894.5 3250203           Inf       1  0.001   63
59  552673.4 3249215           Inf       1  0.001   64
60  553292.5 3247899           Inf       1  0.001   69
61  554387.0 3250249           Inf       1  0.001   51
62  556796.2 3249775           Inf       1  0.001   72
63  555684.6 3248402           Inf       1  0.001   57
64  556841.4 3246428           Inf       1  0.001   55
65  554412.2 3246080           Inf       1  0.001   69
66  554664.9 3244541           Inf       1  0.001   65
67  561611.6 3236164           Inf       1  0.001   69
68  548170.5 3252804           Inf       1  0.001   56
69  549312.5 3252718           Inf       1  0.001   13
70  548337.5 3251112           Inf       1  0.001   67
71  546823.1 3251050           Inf       1  0.001   66
72  546021.0 3250067           Inf       1  0.001   60
73  546044.9 3249272           Inf       1  0.001   49
74  547492.7 3249655           Inf       1  0.001   69
75  548870.2 3249633           Inf       1  0.001   60
76  550740.9 3248679           Inf       1  0.001   69
77  549188.7 3248240           Inf       1  0.001   69
78  547537.2 3248249           Inf       1  0.001   50
79  545550.9 3248195           Inf       1  0.001   56
80  544406.8 3245529           Inf       1  0.001    3
81  546137.2 3245592           Inf       1  0.001    2
82  547576.1 3246828           Inf       1  0.001   65
83  549290.7 3247154           Inf       1  0.001   69
84  549152.9 3245888           Inf       1  0.001   59
85  548508.0 3244576           Inf       1  0.001   11
86  551726.2 3245392           Inf       1  0.001   67
87  551479.0 3240255           Inf       1  0.001   68
88  545252.8 3239420 3.835474e+175       1  0.001    4
89  546442.4 3253327           Inf       1  0.001   53
90  546730.7 3252383           Inf       1  0.001   67
91  545942.5 3251403           Inf       1  0.001   69
92  544507.8 3251329           Inf       1  0.001   50
93  544699.9 3253080           Inf       1  0.001   67
94  543271.5 3253626 2.443373e+213       1  0.001   49
95  542957.2 3251966           Inf       1  0.001   58
96  543483.3 3248918 8.876590e+246       1  0.001   58
97  541482.6 3246184  7.859986e+78       1  0.001   10
98  541163.7 3244295  1.747403e+64       1  0.001   10
99  539377.9 3246673  1.195084e+23       1  0.001   15
100 537559.7 3244936  4.939231e+72       1  0.001   18
101 538097.7 3248497  1.321706e+33       1  0.001   34
102 536714.3 3247450  2.650795e+36       1  0.001   28
103 535468.6 3249629  1.465449e+31       1  0.001   49
104 533038.5 3246679  5.381028e+18       1  0.001   40
105 546652.4 3256818           Inf       1  0.001   24
106 546585.8 3255896           Inf       1  0.001   18
107 546464.2 3254788           Inf       1  0.001   17
108 545171.9 3254795           Inf       1  0.001   35
109 545414.9 3256918           Inf       1  0.001   35
110 545036.0 3256182           Inf       1  0.001   30
111 545845.6 3257885           Inf       1  0.001   46
112 543616.7 3258135           Inf       1  0.001   62
113 543553.3 3257175           Inf       1  0.001   60
114 543848.8 3256173 5.551244e+239       1  0.001   52
115 543806.4 3254990 5.876307e+238       1  0.001   63
116 542701.9 3254942 7.857702e+266       1  0.001   61
117 541821.1 3254852           Inf       1  0.001   60
118 542126.3 3256405           Inf       1  0.001   59
119 541745.3 3257976  7.118135e+79       1  0.001   56
120 539939.8 3257014 1.064672e+138       1  0.001   45
121 540661.9 3254813 2.334818e+122       1  0.001   59
122 538141.2 3254706 4.276987e+203       1  0.001   28
123 535213.1 3255463           Inf       1  0.001    6
124 534922.7 3253841           Inf       1  0.001    5
125 535290.7 3252995 3.547466e+132       1  0.001    4
126 533527.2 3256323           Inf       1  0.001    1
127 533341.4 3253074  4.207235e+78       1  0.001    7
128 529398.6 3258250  2.327642e+04       1  0.001    1
129 532005.4 3253902  2.848964e+40       1  0.001   14
130 530572.8 3254956  6.363584e+25       1  0.001   15
131 531398.4 3255589  9.225320e+46       1  0.001   13
132 532555.9 3259047 2.375187e+133       1  0.001    3
133 544916.5 3259167           Inf       1  0.001   60
134 545271.8 3260987           Inf       1  0.001   61
135 544397.4 3260605 1.570527e+283       1  0.001   63
136 542895.3 3259774 7.668096e+124       1  0.001   58
137 541584.6 3259324 3.594947e+118       1  0.001   21
138 539764.2 3260148           Inf       1  0.001    9
139 539493.9 3259050 3.984253e+189       1  0.001   13
140 539848.0 3258178 5.157525e+232       1  0.001   41
141 541364.6 3261448 3.889054e+196       1  0.001   30
142 543009.4 3261002 3.864242e+254       1  0.001   52
143 542059.5 3263340           Inf       1  0.001    7
144 540282.7 3262744           Inf       1  0.001   15
145 544587.5 3263142           Inf       1  0.001   27
146 545521.5 3263346           Inf       1  0.001   40
147 544386.0 3265005           Inf       1  0.001   25
148 542161.5 3265857 5.110777e+304       1  0.001    9
149 542675.8 3264871           Inf       1  0.001   11
150 543245.8 3263666 2.149632e+297       1  0.001   12
151 543560.7 3266443 9.027490e+284       1  0.001   56
152 544661.7 3267512           Inf       1  0.001   38
153 542660.6 3268768  1.597527e+75       1  0.001   17
154 542060.4 3268056 2.057673e+164       1  0.001   14
155 541446.8 3267064 3.252695e+184       1  0.001    9
156 540130.7 3266535 3.994841e+234       1  0.001    5
157 540674.3 3264813           Inf       1  0.001    1
158 538502.4 3264905  2.308089e+78       1  0.001   18
159 539367.2 3264077           Inf       1  0.001   15
160 538996.3 3263012 8.560120e+302       1  0.001    7
161 537908.1 3260154           Inf       1  0.001    3
162 537377.4 3258785           Inf       1  0.001    3
163 537406.3 3260816           Inf       1  0.001    1
164 535256.3 3260039 3.082618e+280       1  0.001    4
165 540231.4 3271008 1.449425e+187       1  0.001    1
166 537458.4 3271704 7.235530e+120       1  0.001    3
167 538745.9 3269333 6.103567e+201       1  0.001    3
168 538958.2 3267626 2.627967e+158       1  0.001    1
169 536190.5 3277034  2.750035e+02       1  0.006    1
170 547825.5 3257719           Inf       1  0.001   14
171 549490.0 3258199           Inf       1  0.001   12
172 550945.0 3259103           Inf       1  0.001   35
173 549509.7 3259381           Inf       1  0.001   30
174 546561.9 3259060           Inf       1  0.001   54
175 547763.1 3259010           Inf       1  0.001   65
176 546375.1 3260424           Inf       1  0.001   64
177 547604.7 3260608           Inf       1  0.001   57
178 548906.5 3260933           Inf       1  0.001   64
179 548635.4 3264113           Inf       1  0.001    1
180 549886.3 3263063           Inf       1  0.001   56
181 547181.9 3261949           Inf       1  0.001   63
182 546532.6 3263683           Inf       1  0.001   42
183 547829.0 3263037           Inf       1  0.001   59
184 547955.8 3267412           Inf       1  0.001    8
185 549141.0 3269474           Inf       1  0.001    1
186 549426.3 3266670           Inf       1  0.001    5
187 548501.0 3271098  3.274024e+17       1  0.001    3
188 547420.0 3270396  2.869162e+45       1  0.001   38
189 545504.7 3270449  2.640984e+79       1  0.001   38
190 545596.0 3272720  1.977962e+04       1  0.001   38
191 547064.7 3268968  1.622851e+83       1  0.001   43
192 546451.3 3268260 9.766656e+144       1  0.001   26
193 543846.3 3269846  3.782823e+53       1  0.001   27
194 550262.1 3277594  4.348019e+55       1  0.001    1
195 540900.2 3277194  3.780419e+70       1  0.001    3


You can see that many of the clusters have Inf's for their statistic value. 
When trying to find the "Most likely cluster" corresponding to the largest 
value of the statistics, this creates a problem.  

I would appreciate any thoughts you may have on this, or if others have seen
this kind of behavior.  As far as I can tell, this only happens with the
kn.iscluster algorithm, I can use besag-newell and plain opgan() just fine.
I will put the data on my dropbox:

http://dl.dropbox.com/u/16846217/Archive.zip

Corey

Corey Sparks, PhD 
Assistant professor 
Department of Demography 
The University of Texas at San Antonio 
501 West Cesar E Chavez Blvd 
San Antonio TX 78207 
Corey.sparks 'at' utsa.edu 



-----
Corey Sparks
Assistant professor
Department of Demography
The University of Texas at San Antonio
501 West Cesar E Chavez Blvd
San Antonio TX 78207
Corey.sparks 'at' utsa.edu
210 458 3166 <tel:210%20458%203166>
Latitude: 29.423614  /  Longitude: -98.504282
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Strange-results-in-DCluster-package-tp7326832p7326832.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list