# scan.test

##### Spatial Scan Test

Performs the Spatial Scan Test for clustering in a spatial point pattern, or for clustering of one type of point in a bivariate spatial point pattern.

##### Usage

```
scan.test(X, r, ...,
method = c("poisson", "binomial"),
nsim = 19,
baseline = NULL,
case = 2,
alternative = c("greater", "less", "two.sided"),
verbose = TRUE)
```

##### Arguments

- X
A point pattern (object of class

`"ppp"`

).- r
Radius of circle to use. A single number or a numeric vector.

- …
Optional. Arguments passed to

`as.mask`

to determine the spatial resolution of the computations.- method
Either

`"poisson"`

or`"binomial"`

specifying the type of likelihood.- nsim
Number of simulations for computing Monte Carlo p-value.

- baseline
Baseline for the Poisson intensity, if

`method="poisson"`

. A pixel image or a function.- case
Which type of point should be interpreted as a case, if

`method="binomial"`

. Integer or character string.- alternative
Alternative hypothesis:

`"greater"`

if the alternative postulates that the mean number of points inside the circle will be greater than expected under the null.- verbose
Logical. Whether to print progress reports.

##### Details

The spatial scan test (Kulldorf, 1997) is applied
to the point pattern `X`

.

In a nutshell,

If

`method="poisson"`

then a significant result would mean that there is a circle of radius`r`

, located somewhere in the spatial domain of the data, which contains a significantly higher than expected number of points of`X`

. That is, the pattern`X`

exhibits spatial clustering.If

`method="binomial"`

then`X`

must be a bivariate (two-type) point pattern. By default, the first type of point is interpreted as a control (non-event) and the second type of point as a case (event). A significant result would mean that there is a circle of radius`r`

which contains a significantly higher than expected number of cases. That is, the cases are clustered together, conditional on the locations of all points.

Following is a more detailed explanation.

If

`method="poisson"`

then the scan test based on Poisson likelihood is performed (Kulldorf, 1997). The dataset`X`

is treated as an unmarked point pattern. By default (if`baseline`

is not specified) the null hypothesis is complete spatial randomness CSR (i.e. a uniform Poisson process). The alternative hypothesis is a Poisson process with one intensity \(\beta_1\) inside some circle of radius`r`

and another intensity \(\beta_0\) outside the circle. If`baseline`

is given, then it should be a pixel image or a`function(x,y)`

. The null hypothesis is an inhomogeneous Poisson process with intensity proportional to`baseline`

. The alternative hypothesis is an inhomogeneous Poisson process with intensity`beta1 * baseline`

inside some circle of radius`r`

, and`beta0 * baseline`

outside the circle.If

`method="binomial"`

then the scan test based on binomial likelihood is performed (Kulldorf, 1997). The dataset`X`

must be a bivariate point pattern, i.e. a multitype point pattern with two types. The null hypothesis is that all permutations of the type labels are equally likely. The alternative hypothesis is that some circle of radius`r`

has a higher proportion of points of the second type, than expected under the null hypothesis.

The result of `scan.test`

is a hypothesis test
(object of class `"htest"`

) which can be plotted to
report the results. The component `p.value`

contains the
\(p\)-value.

The result of `scan.test`

can also be plotted (using the plot
method for the class `"scan.test"`

). The plot is
a pixel image of the Likelihood Ratio Test Statistic
(2 times the log likelihood ratio) as a function
of the location of the centre of the circle.
This pixel image can be extracted from the object
using `as.im.scan.test`

.
The Likelihood Ratio Test Statistic is computed by
`scanLRTS`

.

##### Value

An object of class `"htest"`

(hypothesis test)
which also belongs to the class `"scan.test"`

.
Printing this object gives the result of the test.
Plotting this object displays the Likelihood Ratio Test Statistic
as a function of the location of the centre of the circle.

##### References

Kulldorff, M. (1997)
A spatial scan statistic.
*Communications in Statistics --- Theory and Methods*
**26**, 1481--1496.

##### See Also

##### Examples

```
# NOT RUN {
nsim <- if(interactive()) 19 else 2
rr <- if(interactive()) seq(0.5, 1, by=0.1) else c(0.5, 1)
scan.test(redwood, 0.1 * rr, method="poisson", nsim=nsim)
scan.test(chorley, rr, method="binomial", case="larynx", nsim=nsim)
# }
```

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