# quadrat.test.mppm

##### Chi-Squared Test for Multiple Point Process Model Based on Quadrat Counts

Performs a chi-squared goodness-of-fit test of a Poisson point process model fitted to multiple point patterns.

##### Usage

```
# S3 method for mppm
quadrat.test(X, ...)
```

##### Arguments

- X
An object of class

`"mppm"`

representing a point process model fitted to multiple point patterns. It should be a Poisson model.- …
Arguments passed to

`quadrat.test.ppm`

which determine the size of the quadrats.

##### Details

This function performs a \(\chi^2\) test of goodness-of-fit for a Poisson point process model, based on quadrat counts. It can also be used to perform a test of Complete Spatial Randomness for a list of point patterns.

The function `quadrat.test`

is generic, with methods for
point patterns (class `"ppp"`

), point process models
(class `"ppm"`

) and
multiple point process models (class
`"mppm"`

).

For this function, the argument `X`

should be a
multiple point process model (object of class `"mppm"`

)
obtained by fitting a point process model to a list of
point patterns using the function `mppm`

.

To perform the test, the data point patterns are extracted from `X`

.
For each point pattern

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 calculated, as determined by the fitted model.

Then we perform a single \(\chi^2\) test of goodness-of-fit based on these observed and expected counts.

##### Value

An object of class `"htest"`

.
Printing the object gives comprehensible output
about the outcome of the test.
The \(p\)-value of the test is stored in the
component `p.value`

.

The return value also belongs to
the special class `"quadrat.test"`

. Plotting the object
will display, for each window, the position of the quadrats,
annotated by their observed and expected
counts and the Pearson residuals. See the examples.

The return value also has an attribute `"components"`

which is a list containing the results of
\(\chi^2\) tests of goodness-of-fit
for each individual point pattern.

##### Testing Complete Spatial Randomness

If the intention is to test Complete Spatial Randomness (CSR) there are two options:

CSR with the same intensity of points in each point pattern;

CSR with a different, unrelated intensity of points in each point pattern.

In the first case,
suppose `P`

is a list of point patterns we want to test.
Then fit the multiple model `fit1 <- mppm(P, ~1)`

which signifies a
Poisson point process model with a constant intensity. Then
apply `quadrat.test(fit1)`

.

In the second case, fit the model codefit2 <- mppm(P, ~id)
which signifies a Poisson point process with a different constant
intensity for each point pattern. Then apply `quadrat.test(fit2)`

.

##### References

Baddeley, A., Rubak, E. and Turner, R. (2015)
*Spatial Point Patterns: Methodology and Applications with R*.
London: Chapman and Hall/CRC Press.

##### See Also

##### Examples

```
# NOT RUN {
H <- hyperframe(X=waterstriders)
# Poisson with constant intensity for all patterns
fit1 <- mppm(X~1, H)
quadrat.test(fit1, nx=2)
# uniform Poisson with different intensity for each pattern
fit2 <- mppm(X ~ id, H)
quadrat.test(fit2, nx=2)
# }
```

*Documentation reproduced from package spatstat, version 1.64-1, License: GPL (>= 2)*