Kinhom(X, lambda, ..., r = NULL, breaks = NULL,
correction=c("border", "bord.modif", "isotropic", "translate"),
nlarge = 1000, lambda2, sigma=NULL, varcov=NULL)
"ppp"
or in a format recognised by as.ppp()
X
,
or a pixel image (object of class "im"
) giving the
intensity values at all localambda
is present.
Passed to density.ppp
if lambda
is omitted.r
.
Not normally invoked by the user.
See Details."border"
, "bord.modif"
,
"isotropic"
, "Ripley"
or "translate"
.
It specifies the edge correction(s) to be applied.nlarge
, then only the
border correction will be computed, using a fast algorithm.density.ppp
to control the smoothing bandwidth, when lambda
is
estimated by kernel smoothing."fv"
(see fv.object
).
Essentially a data frame containing at least the following columns,correction
argument. The additional columns are named
border
, trans
and iso
and give the estimated values of
$K_{\rm inhom}(r)$
using the border correction, translation correction,
and Ripley isotropic correction, respectively.Kest
. It is defined only
for stationary point processes.
The inhomogeneous $K$ function
$K_{\rm inhom}(r)$
is a direct generalisation to nonstationary point processes.
Suppose $x$ is a point process with non-constant intensity
$\lambda(u)$ at each location $u$.
Define $K_{\rm inhom}(r)$ to be the expected
value, given that $u$ is a point of $x$,
of the sum of all terms
$1/\lambda(u)\lambda(x_j)$
over all points $x_j$
in the process separated from $u$ by a distance less than $r$.
This reduces to the ordinary $K$ function if
$\lambda()$ is constant.
If $x$ is an inhomogeneous Poisson process with intensity
function $\lambda(u)$, then
$K_{\rm inhom}(r) = \pi r^2$.This allows us to inspect a point pattern for evidence of interpoint interactions after allowing for spatial inhomogeneity of the pattern. Values $K_{\rm inhom}(r) > \pi r^2$ are suggestive of clustering.
The argument lambda
should supply the
(estimated) values of the intensity function $\lambda$.
It may be either
[object Object],[object Object],[object Object]
If lambda
is a numeric vector, then its length should
be equal to the number of points in the pattern X
.
The value lambda[i]
is assumed to be the
the (estimated) value of the intensity
$\lambda(x_i)$ for
the point $x_i$ of the pattern $X$.
Each value must be a positive number; NA
's are not allowed.
If lambda
is a pixel image, the domain of the image should
cover the entire window of the point pattern. If it does not (which
may occur near the boundary because of discretisation error),
then the missing pixel values
will be obtained by applying a Gaussian blur to lambda
using
blur
, then looking up the values of this blurred image
for the missing locations.
(A warning will be issued in this case.)
If lambda
is omitted, then it will be estimated using
a `leave-one-out' kernel smoother, as described in Baddeley, Moller
and Waagepetersen (2000). The estimate lambda[i]
for the
point X[i]
is computed by removing X[i]
from the
point pattern, applying kernel smoothing to the remaining points using
density.ppp
, and evaluating the smoothed intensity
at the point X[i]
. The smoothing kernel bandwidth is controlled
by the arguments sigma
and varcov
, which are passed to
density.ppp
along with any extra arguments.
Edge corrections are used to correct bias in the estimation
of $K_{\rm inhom}$.
Each edge-corrected estimate of $K_{\rm inhom}(r)$ is
of the form
If the point pattern X
contains more than about 1000 points,
the isotropic and translation edge corrections can be computationally
prohibitive. The computations for the border method are much faster,
and are statistically efficient when there are large numbers of
points. Accordingly, if the number of points in X
exceeds
the threshold nlarge
, then only the border correction will be
computed. Setting nlarge=Inf
will prevent this from happening.
Setting nlarge=0
is equivalent to selecting only the border
correction with correction="border"
.
The pair correlation function can also be applied to the
result of Kinhom
; see pcf
.
Kest
,
pcf
data(lansing)
# inhomogeneous pattern of maples
X <- unmark(split(lansing)$maple)
<testonly>sub <- sample(c(TRUE,FALSE), X$n, replace=TRUE, prob=c(0.1,0.9))
X <- X[sub]</testonly>
# (1) intensity function estimated by model-fitting
# Fit spatial trend: polynomial in x and y coordinates
fit <- ppm(X, ~ polynom(x,y,2), Poisson())
# (a) predict intensity values at points themselves,
# obtaining a vector of lambda values
lambda <- predict(fit, locations=X, type="trend")
# inhomogeneous K function
Ki <- Kinhom(X, lambda)
plot(Ki)
# (b) predict intensity at all locations,
# obtaining a pixel image
lambda <- predict(fit, type="trend")
Ki <- Kinhom(X, lambda)
plot(Ki)
# (2) intensity function estimated by heavy smoothing
Ki <- Kinhom(X, sigma=0.1)
plot(Ki)
# (3) simulated data: known intensity function
lamfun <- function(x,y) { 50 + 100 * x }
# inhomogeneous Poisson process
Y <- rpoispp(lamfun, 150, owin())
# evaluate intensity at points of pattern
lambda <- lamfun(Y$x, Y$y)
# inhomogeneous K function
Ki <- Kinhom(Y, lambda)
plot(Ki)
# How to make simulation envelopes:
# Example shows method (2)
smo <- density.ppp(X, sigma=0.1)
Ken <- envelope(X, Kinhom, nsim=99,
simulate=expression(rpoispp(smo)),
sigma=0.1, correction="trans")
plot(Ken)
Run the code above in your browser using DataLab