# quadratcount: Quadrat counting for a point pattern In spatstat.geom: Geometrical Functionality of the 'spatstat' Family

## Description

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

## Usage

 ```1 2 3 4 5 6 7 8``` ``` quadratcount(X, ...) ## S3 method for class 'ppp' quadratcount(X, nx=5, ny=nx, ..., xbreaks=NULL, ybreaks=NULL, tess=NULL) ## S3 method for class 'splitppp' quadratcount(X, ...) ```

## Arguments

 `X` A point pattern (object of class `"ppp"`) or a split point pattern (object of class `"splitppp"`). `nx,ny` Numbers of rectangular quadrats in the x and y directions. Incompatible with `xbreaks` and `ybreaks`. `...` Additional arguments passed to `quadratcount.ppp`. `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"` or something acceptable to `as.tess`) determining the quadrats. Incompatible with `nx,ny,xbreaks,ybreaks`.

## Details

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

If `X` is a point pattern, then 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 `Window(X)`.

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`.

To calculate an estimate of intensity based on the quadrat counts, use `intensity.quadratcount`.

To extract the quadrats used in a `quadratcount` object, use `as.tess`.

If `X` is a split point pattern (object of class `"splitppp"` then quadrat counting will be performed on each of the components point patterns, and the resulting contingency tables will be returned in a list. This list can be printed or plotted.

Marks attached to the points are ignored by `quadratcount.ppp`. To obtain a separate contingency table for each type of point in a multitype point pattern, first separate the different points using `split.ppp`, then apply `quadratcount.splitppp`. See the Examples.

## Value

The value of `quadratcount.ppp` is 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.

The value of `quadratcount.splitppp` is a list of such contingency tables, each containing the quadrat counts for one of the component point patterns in `X`. This list also has the class `"solist"` which has print and plot methods.

## Warning

If `Q` is the result of `quadratcount` using rectangular tiles, then `as.numeric(Q)` extracts the counts in the wrong order. To obtain the quadrat counts in the same order as the tiles of the corresponding tessellation would be listed, use `as.vector(t(Q))`, which works in all cases.

## Note

To perform a chi-squared test based on the quadrat counts, use `quadrat.test`.

\adrian

and \rolf

## 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

`plot.quadratcount`, `intensity.quadratcount`, `quadrats`, `quadrat.test`, `tess`, `hextess`, `quadratresample`, `miplot`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ``` X <- runifrect(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) # irregular window data(humberside) plot(humberside) qH <- quadratcount(humberside, 2, 3) plot(qH, add=TRUE, col="blue", cex=1.5, lwd=2) # multitype - split plot(quadratcount(split(humberside), 2, 3)) # quadrats determined by tessellation: B <- dirichlet(runifrect(6)) qX <- quadratcount(X, tess=B) plot(X, pch="+") plot(qX, add=TRUE, col="red", cex=1.5, lty=2) ```

spatstat.geom documentation built on March 22, 2021, 9:09 a.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.68626314,"math_prob":0.9770571,"size":4901,"snap":"2021-04-2021-17","text_gpt3_token_len":1393,"char_repetition_ratio":0.15274657,"word_repetition_ratio":0.122961104,"special_character_ratio":0.24566415,"punctuation_ratio":0.15682282,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9974085,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-10T12:00:58Z\",\"WARC-Record-ID\":\"<urn:uuid:7ae3adcf-d822-4c98-9ea8-8ef9c25f1991>\",\"Content-Length\":\"65332\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:94bf6795-fbd5-437e-88a4-763de7d86e4f>\",\"WARC-Concurrent-To\":\"<urn:uuid:262e9f89-34e9-4e69-9e4c-7e13fa5160bc>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/cran/spatstat.geom/man/quadratcount.html\",\"WARC-Payload-Digest\":\"sha1:QZK6ZWFE3DA6QW7TZ2DMNKR4EK7MKKCJ\",\"WARC-Block-Digest\":\"sha1:UT3BIVWR2237ZKH6MDBND2HUTBL7G7BC\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038056869.3_warc_CC-MAIN-20210410105831-20210410135831-00532.warc.gz\"}"}