spatstat (version 1.14-8)

quadratcount: Quadrat counting for a point pattern

Description

Divides window into quadrats and counts the numbers of points in each quadrat.

Usage

quadratcount(X, nx=5, ny=nx, ...,
               xbreaks=NULL, ybreaks=NULL, tess=NULL)

Arguments

X
A point pattern (object of class "ppp").
nx,ny
Numbers of rectangular quadrats in the $x$ and $y$ directions. Incompatible with xbreaks and ybreaks.
...
Ignored.
xbreaks
Numeric vector giving the $x$ coordinates of the boundaries of the rectangular quadrats. Incompatible with nx.
ybreaks
Numeric vector giving the $y$ coordinates of the boundaries of the rectangular quadrats. Incompatible with ny.
tess
Tessellation (object of class "tess") determining the quadrats. Incompatible with nx,ny,xbreaks,ybreaks.

Value

  • A contingency table containing the number of points in each quadrat.

    The table is also an object of the special class "quadratcount" and there is a plot method for this class.

Details

Quadrat counting is an elementary technique for analysing spatial point patterns. See Diggle (2003).

By default, the window containing the point pattern X is divided into an nx * ny grid of rectangular tiles or `quadrats'. (If the window is not a rectangle, then these tiles are intersected with the window.) The number of points of X falling in each quadrat is counted. These numbers are returned as a contingency table.

If xbreaks is given, it should be a numeric vector giving the $x$ coordinates of the quadrat boundaries. If it is not given, it defaults to a sequence of nx+1 values equally spaced over the range of $x$ coordinates in the window X$window.

Similarly if ybreaks is given, it should be a numeric vector giving the $y$ coordinates of the quadrat boundaries. It defaults to a vector of ny+1 values equally spaced over the range of $y$ coordinates in the window. The lengths of xbreaks and ybreaks may be different.

Alternatively, quadrats of any shape may be used. The argument tess can be a tessellation (object of class "tess") whose tiles will serve as the quadrats. The algorithm counts the number of points of X falling in each quadrat, and returns these counts as a contingency table.

The return value is a table which can be printed neatly. The return value is also a member of the special class "quadratcount". Plotting the object will display the quadrats, annotated by their counts. See the examples. To perform a chi-squared test based on the quadrat counts, use quadrat.test.

References

Diggle, P.J. Statistical analysis of spatial point patterns. Academic Press, 2003.

Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.

See Also

quadrat.test, quadrats, quadratresample, miplot

Examples

Run this code
X <- runifpoint(50)
 quadratcount(X)
 quadratcount(X, 4, 5)
 quadratcount(X, xbreaks=c(0, 0.3, 1), ybreaks=c(0, 0.4, 0.8, 1))
 qX <-  quadratcount(X, 4, 5)

 # plotting:
 plot(X, pch="+")
 plot(qX, add=TRUE, col="red", cex=1.5, lty=2)

 # quadrats determined by tessellation:
 B <- dirichlet(runifpoint(6))
 qX <- quadratcount(X, tess=B)
 plot(X, pch="+")
 plot(qX, add=TRUE, col="red", cex=1.5, lty=2)

Run the code above in your browser using DataCamp Workspace