Kmulti.inhom: Inhomogeneous Marked K-Function

Kmulti.inhomR Documentation

Inhomogeneous Marked K-Function

Description

For a marked point pattern, estimate the inhomogeneous version of the multitype K function which counts the expected number of points of subset J within a given distance from a typical point in subset I, adjusted for spatially varying intensity.

Usage

  Kmulti.inhom(X, I, J, lambdaI=NULL, lambdaJ=NULL,
          ...,
          r=NULL, breaks=NULL, rmax=NULL,
          correction=c("border", "isotropic", "Ripley", "translate"),
          lambdaIJ=NULL,
          sigma=NULL, varcov=NULL,
          lambdaX=NULL, update=TRUE, leaveoneout=TRUE,
          Ilevels=NULL, Jlevels=NULL)

Arguments

X

The observed point pattern, from which an estimate of the inhomogeneous multitype K function K_{IJ}(r) will be computed. It must be a marked point pattern. See under Details.

I

Subset index specifying the points of X from which distances are measured. See Details.

J

Subset index specifying the points in X to which distances are measured. See Details.

lambdaI

Optional. Values of the estimated intensity function of the points belonging to subset I. (Ignored if lambdaX is given.) Either a numeric vector giving the intensity values at the data points of subset I, a pixel image (object of class "im") giving the intensity values of points of subset I at all locations, a function(x,y) which can be evaluated to give the intensity value of points of subset I at any location, or a fitted point process model (class "ppm", "kppm", "dppm" or "slrm") which could be used to predict the intensity values of points of subset J at all locations. If lambdaI is an unmarked point process model, it is assumed to have been fitted to X[I]; if it is a multitype point process model, it is assumed to have been fitted to X, and the argument Ilevels is required.

lambdaJ

Optional. Values of the estimated intensity function of the points belonging to subset J. A numeric vector, pixel image, function(x,y), or fitted point process model. Ignored if lambdaX is given.

...

Ignored.

r

Optional. Numeric vector. The values of the argument r at which the multitype K function K_{IJ}(r) should be evaluated. There is a sensible default. First-time users are strongly advised not to specify this argument. See below for important conditions on r.

breaks

This argument is for internal use only.

rmax

Optional. Maximum desired value of the argument r. A single numeric value. There is a sensible default.

correction

A character vector containing any selection of the options "border", "bord.modif", "isotropic", "Ripley", "translate", "none" or "best". It specifies the edge correction(s) to be applied. Alternatively correction="all" selects all options.

lambdaIJ

Optional. A matrix containing estimates of the product of the intensities lambdaI and lambdaJ for each pair of points, the first point belonging to subset I and the second point to subset J.

sigma, varcov

Optional arguments passed to density.ppp to control the smoothing bandwidth, when lambda is estimated by kernel smoothing.

lambdaX

Optional. Alternative to lambdaI and lambdaJ. Data which can be used to calculate the intensity functions of both the subsets I and J. A list of pixel images (one image for each possible type of point), a function(x,y,mark) giving the intensity at each location for each possible type of point, a numeric matrix with one row for each point in X and one column for each possible type of point, or a fitted multitype point process model (class "ppm"). The arguments Ilevels and Jlevels are required in this case.

update

Logical value indicating what to do when lambdaI, lambdaJ or lambdaX is a fitted point process model (class "ppm", "kppm" or "dppm"). If update=TRUE (the default), the model will first be updated (refitted to the data) before the fitted intensity lambdaI or lambdaJ at the data points is computed. If update=FALSE, the fitted intensity of the model will be computed without re-fitting the model.

leaveoneout

Logical value (passed to density.ppp or fitted.ppm) specifying whether to use a leave-one-out rule when calculating the intensity.

Ilevels

Character vector containing the types of points (levels of marks(X)) which comprise the subset I. Required when lambdaX is given or when lambdaI is a multitype point process model.

Jlevels

Character vector containing the types of points which comprise the subset J. Required when lambdaX is given or when lambdaJ is a multitype point process model.

Details

The function Kmulti.inhom is the counterpart, for spatially-inhomogeneous marked point patterns, of the multitype K function Kmulti.

Suppose X is a marked point process, with marks of any kind. Suppose X_I, X_J are two sub-processes, possibly overlapping. Typically X_I would consist of those points of X whose marks lie in a specified range of mark values, and similarly for X_J. Suppose that \lambda_I(u), \lambda_J(u) are the spatially-varying intensity functions of X_I and X_J respectively. Consider all the pairs of points (u,v) in the point process X such that the first point u belongs to X_I, the second point v belongs to X_J, and the distance between u and v is less than a specified distance r. Give this pair (u,v) the numerical weight 1/(\lambda_I(u)\lambda_J(u)). Calculate the sum of these weights over all pairs of points as described. This sum (after appropriate edge-correction and normalisation) is the estimated inhomogeneous multitype K function.

The argument X must be a point pattern (object of class "ppp") or any data that are acceptable to as.ppp.

The arguments I and J specify two subsets of the point pattern. They may be any type of subset indices, for example, logical vectors of length equal to npoints(X), or integer vectors with entries in the range 1 to npoints(X), or negative integer vectors.

Alternatively, I and J may be functions that will be applied to the point pattern X to obtain index vectors. If I is a function, then evaluating I(X) should yield a valid subset index. This option is useful when generating simulation envelopes using envelope.

The argument lambdaI supplies the values of the intensity of the sub-process identified by index I. It may be either

a pixel image

(object of class "im") which gives the values of the intensity of X[I] at all locations in the window containing X;

a numeric vector

containing the values of the intensity of X[I] evaluated only at the data points of X[I]. The length of this vector must equal the number of points in X[I].

a function

of the form function(x,y) which can be evaluated to give values of the intensity at any locations.

A fitted multitype point process model

(class "lppm" or "ppm") that was fitted to a multitype point pattern. If update=TRUE, this model will be re-fitted to the data pattern X. Then the intensity of this model for the subset I will be computed (using the information Ilevels).

A fitted unmarked point process model

(class "lppm", "ppm", "kppm", "dppm" or "slrm") that was fitted to an unmarked point pattern. If update=TRUE, this model will be re-fitted to the subset of the data, unmark(X[I]). Then the intensity of this fitted model will be 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 supplies the values of the intensity of the sub-process identified by index J.

Alternatively if the argument lambdaX is given, then it should provide data giving the intensities of both subsets I and J. It may be

  • A list of pixel images, one for each possible type of point

  • A function(x,y,mark) which can be evaluated to give the intensity of each type of point at any location

  • A matrix with one row for each data point in X and one column for each possible type of point, giving the estimated intensity of each type of point at each data location

  • A fitted point process model (class "lppm" or "ppm") that was fitted to a multitype point pattern. If update=TRUE, this model will be re-fitted to the data pattern X. Then the fitted intensities for subsets I and J will be computed (using the information Ilevels and Jlevels).

The arguments lambdaI, lambdaJ will be ignored if lambdaX is given.

The argument r is the vector of values for the distance r at which K_{IJ}(r) should be evaluated. It is also used to determine the breakpoints (in the sense of hist) for the computation of histograms of distances.

First-time users would be strongly advised not to specify r. However, if it is specified, r must satisfy r[1] = 0, and max(r) must be larger than the radius of the largest disc contained in the window.

Biases due to edge effects are treated in the same manner as in Kinhom. The edge corrections implemented here are

border

the border method or “reduced sample” estimator (see Ripley, 1988). This is the least efficient (statistically) and the fastest to compute. It can be computed for a window of arbitrary shape.

isotropic/Ripley

Ripley's isotropic correction (see Ripley, 1988; Ohser, 1983). This is currently implemented only for rectangular windows.

translate

Translation correction (Ohser, 1983). Implemented for all window geometries.

The pair correlation function pcf can also be applied to the result of Kmulti.inhom.

Value

An object of class "fv" (see fv.object).

Essentially a data frame containing numeric columns

r

the values of the argument r at which the function K_{IJ}(r) has been estimated

theo

the theoretical value of K_{IJ}(r) for a marked Poisson process, namely \pi r^2

together with a column or columns named "border", "bord.modif", "iso" and/or "trans", according to the selected edge corrections. These columns contain estimates of the function K_{IJ}(r) obtained by the edge corrections named.

Author(s)

\adrian

and \rolf

References

Baddeley, A., \Moller, J. and Waagepetersen, R. (2000) Non- and semiparametric estimation of interaction in inhomogeneous point patterns. Statistica Neerlandica 54, 329–350.

See Also

Kmulti, Kdot.inhom, Kcross.inhom, pcf

Examples

    # Finnish Pines data: marked by diameter and height
    plot(finpines, which.marks="height")
    II <- (marks(finpines)$height <= 2)
    JJ <- (marks(finpines)$height > 3)
    K <- Kmulti.inhom(finpines, II, JJ)
    plot(K)
    # functions determining subsets
    f1 <- function(X) { marks(X)$height <= 2 }
    f2 <- function(X) { marks(X)$height > 3 }
    K <- Kmulti.inhom(finpines, f1, f2)

spatstat.explore documentation built on March 22, 2026, 5:06 p.m.