quadrat.test {spatstat}R Documentation

Chi-Squared Dispersion Test for Spatial Point Pattern Based on Quadrat Counts

Description

Performs a chi-squared test of Complete Spatial Randomness for a given point pattern, based on quadrat counts. Alternatively performs a chi-squared goodness-of-fit test of a fitted inhomogeneous Poisson model.

Usage

quadrat.test(X, ...)
## S3 method for class 'ppp'
quadrat.test(X, nx=5, ny=nx, ..., xbreaks=NULL, ybreaks=NULL, tess=NULL)
## S3 method for class 'ppm'
quadrat.test(X, nx=5, ny=nx, ..., xbreaks=NULL, ybreaks=NULL, tess=NULL)
## S3 method for class 'quadratcount'
quadrat.test(X, ...)

Arguments

X

A point pattern (object of class "ppp") to be subjected to the goodness-of-fit test. Alternatively a fitted point process model (object of class "ppm") to be tested. Alternatively X can be the result of applying quadratcount to a point pattern.

nx,ny

Numbers of quadrats in the x and y directions. Incompatible with xbreaks and ybreaks.

...

Ignored.

xbreaks

Optional. Numeric vector giving the x coordinates of the boundaries of the quadrats. Incompatible with nx.

ybreaks

Optional. Numeric vector giving the y coordinates of the boundaries of the quadrats. Incompatible with ny.

tess

Tessellation (object of class "tess") determining the quadrats. Incompatible with nx, ny, xbreaks, ybreaks.

Details

These functions perform chi^2 tests of goodness-of-fit for a point process model, based on quadrat counts.

The function quadrat.test is generic, with methods for point patterns (class "ppp"), split point patterns (class "splitppp"), point process models (class "ppm") and quadrat count tables (class "quadratcount").

In all cases, the window of observation is divided into tiles, and the number of data points in each tile is counted, as described in quadratcount. The quadrats are rectangular by default, or may be regions of arbitrary shape specified by the argument tess. 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.

Value

An object of class "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.

Author(s)

Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz

See Also

quadrat.test.splitppp, quadratcount, quadrats, quadratresample, chisq.test, kstest.

To test a Poisson point process model against a specific alternative, use anova.ppm.

Examples

  data(simdat)
  quadrat.test(simdat)
  quadrat.test(simdat, 4, 3)

  # quadrat counts
  qS <- quadratcount(simdat, 4, 3)
  quadrat.test(qS)

  # 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", lwd=2)
  plot(te, add=TRUE, col="red", cex=1.4, 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)

  # quadrats of irregular shape
  B <- dirichlet(runifpoint(6, simdat$window))
  qB <- quadrat.test(simdat, tess=B)
  plot(simdat, main="quadrat.test(simdat, tess=B)", pch="+")
  plot(qB, add=TRUE, col="red", lwd=2, cex=1.2)


[Package spatstat version 1.25-3 Index]