[R] Spatstat help - quadratcount query
Gough Lauren
lgxlg1 at nottingham.ac.uk
Thu Oct 23 11:18:21 CEST 2008
Hi,
No the output isn't the same as the original spatstat output, I changed
it from scientific to numerical notation in excel. I realised last
night that it was probably a rounding issue and have just performed the
same analysis (in a much more long-winded way) in arcmap and got the
same results, so quadratcount is producing 15m x 15m quadrats! Sorry to
cause confusion!
Is the quadratcount only when the results are plotted? I assume the
numerical output (show(q15)) is correct?
Best
Lauren
-----Original Message-----
From: Adrian Baddeley [mailto:adrian at maths.uwa.edu.au]
Sent: 23 October 2008 05:34
To: R-help Forum
Cc: Gough Lauren; Rolf Turner
Subject: Re: [R] Spatstat help - quadratcount query
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.
Adrian Baddeley
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
More information about the R-help
mailing list