# pcf.fasp

##### Pair Correlation Function obtained from array of K functions

Estimates the (bivariate) pair correlation functions of a point pattern, given an array of (bivariate) K functions.

- Keywords
- spatial, nonparametric

##### Usage

```
## S3 method for class 'fasp':
pcf(X, \dots, method="c")
```

##### Arguments

- X
- An array of multitype $K$ functions
(object of class
`"fasp"`

). - ...
- Arguments controlling the smoothing spline
function
`smooth.spline`

. - method
- Letter
`"a"`

,`"b"`

,`"c"`

or`"d"`

indicating the method for deriving the pair correlation function from the`K`

function.

##### Details

The pair correlation function of a stationary point process is
$$g(r) = \frac{K'(r)}{2\pi r}$$
where $K'(r)$ is the derivative of $K(r)$, the
reduced second moment function (aka ``Ripley's $K$ function'')
of the point process. See `Kest`

for information
about $K(r)$. For a stationary Poisson process, the
pair correlation function is identically equal to 1. Values
$g(r) < 1$ suggest inhibition between points;
values greater than 1 suggest clustering.

We also apply the same definition to
other variants of the classical $K$ function,
such as the multitype $K$ functions
(see `Kcross`

, `Kdot`

) and the
inhomogeneous $K$ function (see `Kinhom`

).
For all these variants, the benchmark value of
$K(r) = \pi r^2$ corresponds to
$g(r) = 1$.

This routine computes an estimate of $g(r)$
from an array of estimates of $K(r)$ or its variants,
using smoothing splines to approximate the derivatives.
It is a method for the generic function `pcf`

.

The argument `X`

should be
a function array (object of class `"fasp"`

,
see `fasp.object`

)
containing several estimates of $K$ functions.
This should have been obtained from `alltypes`

with the argument `fun="K"`

.
The smoothing spline operations are performed by
`smooth.spline`

and `predict.smooth.spline`

from the `modreg`

library.
Four numerical methods are available:

**"a"**apply smoothing to$K(r)$, estimate its derivative, and plug in to the formula above;**"b"**apply smoothing to$Y(r) = \frac{K(r)}{2 \pi r}$constraining$Y(0) = 0$, estimate the derivative of$Y$, and solve;**"c"**apply smoothing to$Z(r) = \frac{K(r)}{\pi r^2}$constraining$Z(0)=1$, estimate its derivative, and solve.**"d"**apply smoothing to$V(r) = \sqrt{K(r)}$, estimate its derivative, and solve.

`"c"`

seems to be the best at
suppressing variability for small values of $r$.
However it effectively constrains $g(0) = 1$.
If the point pattern seems to have inhibition at small distances,
you may wish to experiment with method `"b"`

which effectively
constrains $g(0)=0$. Method `"a"`

seems
comparatively unreliable. Useful arguments to control the splines
include the smoothing tradeoff parameter `spar`

and the degrees of freedom `df`

. See `smooth.spline`

for details.

##### Value

- A function array (object of class
`"fasp"`

, see`fasp.object`

) representing an array of pair correlation functions. This can be thought of as a matrix`Y`

each of whose entries`Y[i,j]`

is a function value table (class`"fv"`

) representing the pair correlation function between points of type`i`

and points of type`j`

.

##### References

Stoyan, D, Kendall, W.S. and Mecke, J. (1995)
*Stochastic geometry and its applications*.
2nd edition. Springer Verlag.

Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.

##### See Also

`Kest`

,
`Kinhom`

,
`Kcross`

,
`Kdot`

,
`Kmulti`

,
`alltypes`

,
`smooth.spline`

,
`predict.smooth.spline`

##### Examples

```
# multitype point pattern
data(betacells)
<testonly>betacells <- betacells[seq(1,betacells$n, by=10)]</testonly>
KK <- alltypes(betacells, "K")
p <- pcf.fasp(KK, spar=0.5, method="b")
plot(p)
# short range inhibition between all types
# strong inhibition between "on" and "off"
```

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