quadrat.test(X, ...)
## S3 method for class 'ppp':
quadrat.test(X, nx=5, ny=nx, xbreaks=NULL, ybreaks=NULL, ...)
## S3 method for class 'ppm':
quadrat.test(X, nx=5, ny=nx, xbreaks=NULL, ybreaks=NULL, ...)
"ppp"
)
to be subjected to the goodness-of-fit test.
Alternatively a fitted point process model (object of class
"ppm"
) to be tested.xbreaks
and ybreaks
.nx
.ny
."htest"
. See chisq.test
for explanation. The return value is also an object of the special class
"quadrat.test"
, and there is a plot method for this class.
See the examples.
The function quadrat.test
is generic, with methods for
point patterns (class "ppp"
) and point process models
(class "ppm"
).
X
is a point pattern, we test the null hypothesis
that the data pattern is a realisation of Complete Spatial
Randomness (the uniform Poisson point process).X
is a fitted point process model, then it should be
a Poisson point process model. The
data to which this model was fitted are extracted from the model
object, and are treated as the data point pattern for the test.
We test the null hypothesis
that the data pattern is a realisation of the (inhomogeneous) Poisson point
process specified byX
. In both cases, the window of observation is divided
into rectangular tiles, and the number of data points in each tile is
counted, as described in quadratcount
.
The expected number of points in each quadrat is also calculated,
as determined by CSR (in the first case) or by the fitted model
(in the second case). Then we perform the
$\chi^2$ test of goodness-of-fit to the quadrat counts.
The return value is an object of class "htest"
.
Printing the object gives comprehensible output
about the outcome of the test.
The return value also belongs to
the special class "quadrat.test"
. Plotting the object
will display the quadrats, annotated by their observed and expected
counts and the Pearson residuals. See the examples.
quadratcount
,
chisq.test
,
kstest
. To test a Poisson point process model against a specific alternative,
use anova.ppm
.
data(simdat)
quadrat.test(simdat)
quadrat.test(simdat, 4)
# fitted model: inhomogeneous Poisson
fitx <- ppm(simdat, ~x, Poisson())
quadrat.test(fitx)
te <- quadrat.test(simdat, 4)
residuals(te) # Pearson residuals
plot(te)
plot(simdat, pch="+", cols="green", cex=1.2, lwd=2)
plot(te, add=TRUE, col="red", cex=1.5, lty=2, lwd=3)
sublab <- eval(substitute(expression(p[chi^2]==z),
list(z=signif(te$p.value,3))))
title(sub=sublab, cex.sub=3)
Run the code above in your browser using DataLab