`localpcf`

computes the contribution, from each individual
data point in a point pattern `X`

, to the
empirical pair correlation function of `X`

.
These contributions are sometimes known as LISA (local indicator
of spatial association) functions based on pair correlation.

`localpcfinhom`

computes the corresponding contribution
to the *inhomogeneous* empirical pair correlation function of `X`

.

Given a spatial point pattern `X`

, the local pcf
\(g_i(r)\) associated with the \(i\)th point
in `X`

is computed by
$$
g_i(r) = \frac a {2 \pi n} \sum_j k(d_{i,j} - r)
$$
where the sum is over all points \(j \neq i\),
\(a\) is the area of the observation window, \(n\) is the number
of points in `X`

, and \(d_{ij}\) is the distance
between points `i`

and `j`

. Here `k`

is the
Epanechnikov kernel,
$$
k(t) = \frac 3 { 4\delta} \max(0, 1 - \frac{t^2}{\delta^2}).
$$
Edge correction is performed using the border method
(for the sake of computational efficiency):
the estimate \(g_i(r)\) is set to `NA`

if
\(r > b_i\), where \(b_i\)
is the distance from point \(i\) to the boundary of the
observation window.

The smoothing bandwidth \(\delta\) may be specified.
If not, it is chosen by Stoyan's rule of thumb
\(\delta = c/\hat\lambda\)
where \(\hat\lambda = n/a\) is the estimated intensity
and \(c\) is a constant, usually taken to be 0.15.
The value of \(c\) is controlled by the argument `stoyan`

.

For `localpcfinhom`

, the optional argument `lambda`

specifies the values of the estimated intensity function.
If `lambda`

is given, it should be either a
numeric vector giving the intensity values
at the points of the pattern `X`

,
a pixel image (object of class `"im"`

) giving the
intensity values at all locations, a fitted point process model
(object of class `"ppm"`

, `"kppm"`

or `"dppm"`

)
or a `function(x,y)`

which
can be evaluated to give the intensity value at any location.
If `lambda`

is not given, then it will be estimated
using a leave-one-out kernel density smoother as described
in `pcfinhom`

.

Alternatively, if the argument `rvalue`

is given, and it is a
single number, then the function will only be computed for this value
of \(r\), and the results will be returned as a numeric vector,
with one entry of the vector for each point of the pattern `X`

.