We start this section with loading the required data sets and packages.

```
library(spatstat)
library(rasterVis)
load(url("https://userpage.fu-berlin.de/soga/300/30100_data_sets/ppp_data_berlin.RData"))
```

The interaction between two arbitrary points is measured by *second order properties*, which reflect any tendency of the events to appear clustered (points tend to be close together), independently (the Poisson process), or regularly spaced (points tend to avoid each other).

```
par(mar=c(1,1,2,2), mfrow=c(1,3))
plot(ppp.random, main='independant')
plot(ppp.regular, main='regular')
plot(ppp.locations, main='clustered')
```

A simple diagnostic option or dependence between points is the *Fry plot*. This is a scatterplot of the vector differences \(x_j - x_i\) between all pairs of distinct points in the pattern. In `spatstat`

the Fry plot is computed by the command `fryplot()`

.

```
par(mar=c(1,1,2,2), mfrow=c(1,3))
fryplot(ppp.random, main='independant', pch=16, cex=0.2)
fryplot(ppp.regular, main='regular', pch=16, cex=0.2)
fryplot(ppp.locations, main='clustered', pch=16, cex=0.2)
```

Classical techniques for investigating inter-point interaction are *distance methods*, based on measuring the distances between points (Baddeley 2010).

**pairwise distances**\(s_{ij} = \Vert xi - xj \Vert\) between all distinct pairs of points \(x_i\) and \(x_j\) \((i \ne j)\) in the pattern**nearest neighbor distances**\(t_i = \min_{j \ne i}s_{ij}\), the distance from each point \(x_i\) to its nearest neighbor**empty space distances**\(d(u) = \min \Vert u-x_i \Vert\), the distance from a fixed reference location \(u\) in the window to the nearest data point

These methods are available in the `spatstat`

package using the functions `pairdist()`

, `nndist()`

and `distmap()`

respectively.

```
par(mar=c(2,2,2,2), mfrow=c(1,3), oma=c(0,0,2,0))
hist(pairdist(ppp.locations),
freq =F,
breaks=nrow(pairdist(ppp.locations)),
main='independant',
xlim=c(0,40000))
hist(pairdist(ppp.regular),
freq =F,
breaks=nrow(pairdist(ppp.regular)),
main='regular')
hist(pairdist(ppp.random),
freq =F, breaks=nrow(pairdist(ppp.random)), main='clustered')
mtext("Pairwise Distances Histogram", outer = TRUE, cex = 1.5)
```