# hopskel

##### Hopkins-Skellam Test

Perform the Hopkins-Skellam test of Complete Spatial Randomness, or simply calculate the test statistic.

- Keywords
- htest, spatial, nonparametric

##### Usage

`hopskel(X)`hopskel.test(X, …,
alternative=c("two.sided", "less", "greater",
"clustered", "regular"),
method=c("asymptotic", "MonteCarlo"),
nsim=999)

##### Arguments

- X
Point pattern (object of class

`"ppp"`

).- alternative
String indicating the type of alternative for the hypothesis test. Partially matched.

- method
Method of performing the test. Partially matched.

- nsim
Number of Monte Carlo simulations to perform, if a Monte Carlo p-value is required.

- …
Ignored.

##### Details

Hopkins and Skellam (1954) proposed a test of Complete Spatial Randomness based on comparing nearest-neighbour distances with point-event distances.

If the point pattern `X`

contains `n`

points, we first compute the nearest-neighbour distances
\(P_1, \ldots, P_n\)
so that \(P_i\) is the distance from the \(i\)th data
point to the nearest other data point. Then we
generate another completely random pattern `U`

with
the same number `n`

of points, and compute for each point of `U`

the distance to the nearest point of `X`

, giving
distances \(I_1, \ldots, I_n\).
The test statistic is
$$
A = \frac{\sum_i P_i^2}{\sum_i I_i^2}
$$
The null distribution of \(A\) is roughly
an \(F\) distribution with shape parameters \((2n,2n)\).
(This is equivalent to using the test statistic \(H=A/(1+A)\)
and referring \(H\) to the Beta distribution with parameters
\((n,n)\)).

The function `hopskel`

calculates the Hopkins-Skellam test statistic
\(A\), and returns its numeric value. This can be used as a simple
summary of spatial pattern: the value \(H=1\) is consistent
with Complete Spatial Randomness, while values \(H < 1\) are
consistent with spatial clustering, and values \(H > 1\) are consistent
with spatial regularity.

The function `hopskel.test`

performs the test.
If `method="asymptotic"`

(the default), the test statistic \(H\)
is referred to the \(F\) distribution. If `method="MonteCarlo"`

,
a Monte Carlo test is performed using `nsim`

simulated point
patterns.

##### Value

The value of `hopskel`

is a single number.

The value of `hopskel.test`

is an object of class `"htest"`

representing the outcome of the test. It can be printed.

##### References

Hopkins, B. and Skellam, J.G. (1954)
A new method of determining the type of distribution
of plant individuals. *Annals of Botany* **18**,
213--227.

##### See Also

##### Examples

```
# NOT RUN {
hopskel(redwood)
hopskel(redwood)
hopskel.test(redwood, alternative="clustered")
# }
```

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