[R] Spatstat help - quadratcount query

Thu Oct 23 06:33:45 CEST 2008

```Gough, Lauren wrote:
>
>> I am using quadratcount in spatstat to divide a window containing a
>> point pattern into a grid of quadrats containing the intensity of
>> points in each quadrat.

>> However, when I look at the data for quadrat counts it seems the
>> function is not keeping the size of the quadrats constant, but is
>> instead varying the width of the quadrats (in both the x and y
>> direction) between 10m and 20m, meaning that some quadrats are 10m x
>> 10m and some are four times the size (20m x 20m) (I have pasted some
>> of the output below to demonstrate).

This isn't exactly the pasted output from spatstat, is it?

The output from spatstat for this window would look something like this:

x
y                           [3.4171e+05,3.4172e+05] (3.4172e+05,3.4174e+05]
(3.12676e+06,3.12678e+06]                       1                       0
(3.12675e+06,3.12676e+06]                       0                       2
(3.12674e+06,3.12675e+06]                       0                       0

and so on. The row and column labels indicate the boundaries of the
quadrats; however, because the coordinates are large numbers, they have
been formatted in scientific notation, and ROUNDED to the fourth or
fifth decimal place.

A number printed as 3.12675e+06 is not always exactly equal to 3126750.
It could be anywhere from 3126745 to 3126755. The peculiar impression
that the successive differences alternate between 10 and 20, when they
should be 15, is an artefact of the rules used for rounding numbers in R.

To extract the precise values of the quadrat boundaries, use
xbreaks <- attr(q15, "xbreaks")
ybreaks <-  attr(q15, "ybreaks")
Then you can check directly that the breaks are evenly spaced at
intervals of 15 units in each direction.

Incidentally, please be warned that there is a bug in the plot method
plot.quadratcount  in spatstat 1.14-4 which causes the counts to be
plotted in the wrong quadrats. This will be fixed in the next release
spatstat 1.14-5, due shortly.