"pcf"(X, ..., r = NULL, kernel="epanechnikov", bw=NULL, stoyan=0.15, correction=c("translate", "Ripley"), divisor = c("r", "d"), var.approx = FALSE, domain=NULL, ratio=FALSE)
"ppp"
).
density
.
density
.
density
.
"r"
(the default) or "d"
. See Details.
TRUE
, the numerator and denominator of
each edge-corrected estimate will also be saved,
for use in analysing replicated point patterns.
"fv"
).
Essentially a data frame containing the variablesas required.If ratio=TRUE
then the return value also has two
attributes called "numerator"
and "denominator"
which are "fv"
objects
containing the numerators and denominators of each
estimate of $g(r)$.The return value also has an attribute "bw"
giving the
smoothing bandwidth that was used.
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.
This routine computes an estimate of $g(r)$ by kernel smoothing.
divisor="r"
(the default), then the standard
kernel estimator (Stoyan and Stoyan, 1994, pages 284--285)
is used. By default, the recommendations of Stoyan and Stoyan (1994)
are followed exactly.
divisor="d"
then a modified estimator is used:
the contribution from
an interpoint distance $d[ij]$ to the
estimate of $g(r)$ is divided by $d[ij]$
instead of dividing by $r$. This usually improves the
bias of the estimator when $r$ is close to zero.
There is also a choice of spatial edge corrections (which are needed to avoid bias due to edge effects associated with the boundary of the spatial window):
correction="translate"
or correction="translation"
then the translation correction
is used. For divisor="r"
the translation-corrected estimate
is given in equation (15.15), page 284 of Stoyan and Stoyan (1994).
correction="Ripley"
then Ripley's isotropic edge correction
is used. For divisor="r"
the isotropic-corrected estimate
is given in equation (15.18), page 285 of Stoyan and Stoyan (1994).
correction=c("translate", "Ripley")
then both estimates
will be computed.
Alternatively correction="all"
selects all options.
The choice of smoothing kernel is controlled by the
argument kernel
which is passed to density
.
The default is the Epanechnikov kernel, recommended by
Stoyan and Stoyan (1994, page 285).
The bandwidth of the smoothing kernel can be controlled by the
argument bw
. Its precise interpretation
is explained in the documentation for density.default
.
For the Epanechnikov kernel, the argument bw
is
equivalent to $h/sqrt(5)$.
Stoyan and Stoyan (1994, page 285) recommend using the Epanechnikov
kernel with support $[-h,h]$ chosen by the rule of thumn
$h = c/sqrt(lambda)$,
where $lambda$ is the (estimated) intensity of the
point process, and $c$ is a constant in the range from 0.1 to 0.2.
See equation (15.16).
If bw
is missing, then this rule of thumb will be applied.
The argument stoyan
determines the value of $c$.
The smoothing bandwidth that was used in the calculation is returned
as an attribute of the final result.
The argument r
is the vector of values for the
distance $r$ at which $g(r)$ should be evaluated.
There is a sensible default.
If it is specified, r
must be a vector of increasing numbers
starting from r[1] = 0
,
and max(r)
must not exceed half the diameter of
the window.
If the argument domain
is given, estimation will be restricted
to this region. That is, the estimate of
$g(r)$ will be based on pairs of points in which the first point lies
inside domain
and the second point is unrestricted.
The argument domain
should be a window (object of class "owin"
) or something acceptable to
as.owin
. It must be a subset of the
window of the point pattern X
.
To compute a confidence band for the true value of the
pair correlation function, use lohboot
.
If var.approx = TRUE
, the variance of the
estimate of the pair correlation will also be calculated using
an analytic approximation (Illian et al, 2008, page 234)
which is valid for stationary point processes which are not
too clustered. This calculation is not yet implemented when
the argument domain
is given.
Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.
Kest
,
pcf
,
density
,
lohboot
.
X <- simdat
p <- pcf(X)
plot(p, main="pair correlation function for X")
# indicates inhibition at distances r < 0.3
pd <- pcf(X, divisor="d")
# compare estimates
plot(p, cbind(iso, theo) ~ r, col=c("blue", "red"),
ylim.covers=0, main="", lwd=c(2,1), lty=c(1,3), legend=FALSE)
plot(pd, iso ~ r, col="green", lwd=2, add=TRUE)
legend("center", col=c("blue", "green"), lty=1, lwd=2,
legend=c("divisor=r","divisor=d"))
# calculate approximate variance and show POINTWISE confidence bands
pv <- pcf(X, var.approx=TRUE)
plot(pv, cbind(iso, iso+2*sqrt(v), iso-2*sqrt(v)) ~ r)
Run the code above in your browser using DataLab