2

I have a point data set of crimes for a city. Using quadratcount() through the spatstat package, I plotted the quadrat counts of this data set. Figure 1 shows an image of the counts of data points per quadrat and was created through this code:

#Quadrat Count Map 
q <- quadratcount(xhomicide, 4, 8) 
plot(q) 

where xhomicide is a previously defined dataframe.

Figure 1. Map of number of points per quadrat.:

Figure 1. Map of number of points per quadrat.

Figure 2 shows the corresponding intensity map of the quadrat counts shown in Figure 1. Figure 2 was created using this code: #Add intensity of each quadrat plot(intensity(q, image=TRUE), main=NULL, las=1)

Figure 2. Intensity map of the number of points per quadrat.:

Figure 2. Intensity map of the number of points per quadrat.

Hand computation indicates that both Figures 1 and 2 show the correct results of the quadrat count method.

Note that Figures 1 and 2 were created under R v4.1.2.

I updated R to v4.3.0 and installed the current version of the spatstat package. When running the above code under the new version of R, I achieve the same result for Figure 1 (the count values for each quadrat are the same between R versions). However, when I run the intensity() function, Figure 3 results.

Figure 3. Intensity map of the number of points per quadrat using R v4.3.0:

Figure 3. Intensity map of the number of points per quadrat using R v4.3.0

Since the code is the same between the two versions of R, is the problem with the new version of R or has something changed with spatstat? I was curious to know if the problem rests with the new version of R, the current version of spatstat, or my code no longer meets the requirements of either R or spatstat. I was unable to find any other commentary about what my be causing this problem.

SternK
  • 11,649
  • 22
  • 32
  • 46
Fritz
  • 21
  • 2

1 Answers1

2

This is a bug. Thank you for drawing it to our attention.

It has been fixed in the development version of spatstat.geom (version 3.2-1.001) available at the github repository

Adrian Baddeley
  • 2,534
  • 1
  • 5
  • 8