This is a generalisation of the function Kcross
to include an adjustment for spatially inhomogeneous intensity,
in a manner similar to the function Kinhom
.
The inhomogeneous cross-type \(K\) function is described by
Moller and Waagepetersen (2003, pages 48-49 and 51-53).
Briefly, given a multitype point process, suppose the sub-process
of points of type \(j\) has intensity function
\(\lambda_j(u)\) at spatial locations \(u\).
Suppose we place a mass of \(1/\lambda_j(\zeta)\)
at each point \(\zeta\) of type \(j\). Then the expected total
mass per unit area is 1. The
inhomogeneous ``cross-type'' \(K\) function
\(K_{ij}^{\mbox{inhom}}(r)\) equals the expected
total mass within a radius \(r\) of a point of the process
of type \(i\).
If the process of type \(i\) points
were independent of the process of type \(j\) points,
then \(K_{ij}^{\mbox{inhom}}(r)\)
would equal \(\pi r^2\).
Deviations between the empirical \(K_{ij}\) curve
and the theoretical curve \(\pi r^2\)
suggest dependence between the points of types \(i\) and \(j\).
The argument X
must be a point pattern (object of class
"ppp"
) or any data that are acceptable to as.ppp
.
It must be a marked point pattern, and the mark vector
X$marks
must be a factor.
The arguments i
and j
will be interpreted as
levels of the factor X$marks
. (Warning: this means that
an integer value i=3
will be interpreted as the number 3,
not the 3rd smallest level).
If i
and j
are missing, they default to the first
and second level of the marks factor, respectively.
The argument lambdaI
supplies the values
of the intensity of the sub-process of points of type i
.
It may be either
- a pixel image
(object of class "im"
) which
gives the values of the type i
intensity
at all locations in the window containing X
;
- a numeric vector
containing the values of the
type i
intensity evaluated only
at the data points of type i
. The length of this vector
must equal the number of type i
points in X
.
- a function
which can be evaluated to give values of the intensity at
any locations.
- a fitted point process model
(object of class "ppm"
, "kppm"
or "dppm"
)
whose fitted trend can be used as the fitted intensity.
(If update=TRUE
the model will first be refitted to the
data X
before the trend is computed.)
- omitted:
if lambdaI
is omitted then it will be estimated
using a leave-one-out kernel smoother.
If lambdaI
is omitted, then it will be estimated using
a `leave-one-out' kernel smoother,
as described in Baddeley, Moller
and Waagepetersen (2000). The estimate of lambdaI
for a given
point is computed by removing the point from the
point pattern, applying kernel smoothing to the remaining points using
density.ppp
, and evaluating the smoothed intensity
at the point in question. The smoothing kernel bandwidth is controlled
by the arguments sigma
and varcov
, which are passed to
density.ppp
along with any extra arguments.
Similarly lambdaJ
should contain
estimated values of the intensity of the sub-process of points of
type j
. It may be either a pixel image, a function,
a numeric vector, or omitted.
Alternatively if the argument lambdaX
is given, then it specifies
the intensity values for all points of X
, and the
arguments lambdaI
, lambdaJ
will be ignored.
The optional argument lambdaIJ
is for advanced use only.
It is a matrix containing estimated
values of the products of these two intensities for each pair of
data points of types i
and j
respectively.
The argument r
is the vector of values for the
distance \(r\) at which \(K_{ij}(r)\) should be evaluated.
The values of \(r\) must be increasing nonnegative numbers
and the maximum \(r\) value must not exceed the radius of the
largest disc contained in the window.
The argument correction
chooses the edge correction
as explained e.g. in Kest
.
The pair correlation function can also be applied to the
result of Kcross.inhom
; see pcf
.