# quadrat.test

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

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, nx = 5, ny = nx, xbreaks = NULL, ybreaks = NULL, fit)`

##### 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. - nx,ny
- Numbers of quadrats in the $x$ and $y$ directions.
Incompatible with
`xbreaks`

and`ybreaks`

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

. - fit
- Optional. A fitted point process model (object of class
`"ppm"`

). The point pattern`X`

will be subjected to a test of goodness-of-fit to the model`fit`

.

##### Details

This function performs a $\chi^2$ test of goodness-of-fit
to the Poisson point process (including

If `X`

is a point pattern, it is taken as the data point pattern
for the test. If `X`

is a fitted point process model, then 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.
The window of observation is divided into rectangular tiles
and the number of data points in each tile is counted,
as described in `quadratcount`

.

If `fit`

is absent, then we test the null hypothesis
that the data pattern is a realisation of Complete Spatial
Randomness (the uniform Poisson point process) by applying the
$\chi^2$ test of goodness-of-fit to the quadrat counts.

If `fit`

is present, then it should be a point process model
(object of class `"ppm"`

) and it should be a Poisson point
process. Then we test the null hypothesis
that the data pattern is a realisation of the (inhomogeneous) Poisson point
process specified by `fit`

. Again this is a
$\chi^2$ test of goodness-of-fit to the quadrat counts.

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

.

##### Value

- An object of class
`"htest"`

. See`chisq.test`

for explanation.

##### See Also

##### Examples

```
data(simdat)
quadrat.test(simdat)
quadrat.test(simdat, 4)
# fitted model: inhomogeneous Poisson
fitx <- ppm(simdat, ~x, Poisson())
# equivalent:
quadrat.test(simdat, fit=fitx)
quadrat.test(fitx)
```

*Documentation reproduced from package spatstat, version 1.9-1, License: GPL version 2 or newer*