Learn R Programming

spatstat.explore (version 3.3-1)

pcfinhom: Inhomogeneous Pair Correlation Function

Description

Estimates the inhomogeneous pair correlation function of a point pattern using kernel methods.

Usage

pcfinhom(X, lambda = NULL, ..., r = NULL,
         kernel = "epanechnikov",
         bw = NULL, adjust.bw=1, stoyan = 0.15,
         correction = c("translate", "Ripley"),
         divisor = c("r", "d"),
         renormalise = TRUE, normpower=1,
         update = TRUE, leaveoneout = TRUE,
         reciplambda = NULL,
         sigma = NULL, adjust.sigma = 1,
         varcov = NULL, close=NULL)

Value

A function value table (object of class "fv"). Essentially a data frame containing the variables

r

the vector of values of the argument \(r\) at which the inhomogeneous pair correlation function \(g_{\rm inhom}(r)\) has been estimated

theo

vector of values equal to 1, the theoretical value of \(g_{\rm inhom}(r)\) for the Poisson process

trans

vector of values of \(g_{\rm inhom}(r)\) estimated by translation correction

iso

vector of values of \(g_{\rm inhom}(r)\) estimated by Ripley isotropic correction

as required.

Arguments

X

A point pattern (object of class "ppp").

lambda

Optional. Values of the estimated intensity function. Either a 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.

r

Vector of values for the argument \(r\) at which \(g(r)\) should be evaluated. There is a sensible default.

kernel

Choice of smoothing kernel, passed to density.default.

bw

Bandwidth for one-dimensional smoothing kernel, passed to density.default. Either a single numeric value, or a character string specifying a bandwidth selection rule recognised by density.default. If bw is missing or NULL, the default value is computed using Stoyan's rule of thumb: see bw.stoyan.

adjust.bw

Numeric value. bw will be multiplied by this value.

...

Other arguments passed to the kernel density estimation function density.default.

stoyan

Coefficient for Stoyan's bandwidth selection rule; see bw.stoyan.

correction

Character string or character vector specifying the choice of edge correction. See Kest for explanation and options.

divisor

Choice of divisor in the estimation formula: either "r" (the default) or "d". See pcf.ppp.

renormalise

Logical. Whether to renormalise the estimate. See Details.

normpower

Integer (usually either 1 or 2). Normalisation power. See Details.

update

Logical. If lambda is a fitted model (class "ppm", "kppm" or "dppm") and update=TRUE (the default), the model will first be refitted to the data X (using update.ppm or update.kppm) before the fitted intensity is computed. If update=FALSE, the fitted intensity of the model will be computed without re-fitting it to X.

leaveoneout

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

reciplambda

Alternative to lambda. Values of the estimated reciprocal \(1/\lambda\) of the intensity function. Either a vector giving the reciprocal intensity values at the points of the pattern X, a pixel image (object of class "im") giving the reciprocal intensity values at all locations, or a function(x,y) which can be evaluated to give the reciprocal intensity value at any location.

sigma,varcov

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

adjust.sigma

Numeric value. sigma will be multiplied by this value.

close

Advanced use only. Precomputed data. See section on Advanced Use.

Advanced Use

To perform the same computation using several different bandwidths bw, it is efficient to use the argument close. This should be the result of closepairs(X, rmax) for a suitably large value of rmax, namely rmax >= max(r) + 3 * bw.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

The inhomogeneous pair correlation function \(g_{\rm inhom}(r)\) is a summary of the dependence between points in a spatial point process that does not have a uniform density of points.

The best intuitive interpretation is the following: the probability \(p(r)\) of finding two points at locations \(x\) and \(y\) separated by a distance \(r\) is equal to $$ p(r) = \lambda(x) lambda(y) g(r) \,{\rm d}x \, {\rm d}y $$ where \(\lambda\) is the intensity function of the point process. For a Poisson point process with intensity function \(\lambda\), this probability is \(p(r) = \lambda(x) \lambda(y)\) so \(g_{\rm inhom}(r) = 1\).

The inhomogeneous pair correlation function is related to the inhomogeneous \(K\) function through $$ g_{\rm inhom}(r) = \frac{K'_{\rm inhom}(r)}{2\pi r} $$ where \(K'_{\rm inhom}(r)\) is the derivative of \(K_{\rm inhom}(r)\), the inhomogeneous \(K\) function. See Kinhom for information about \(K_{\rm inhom}(r)\).

The command pcfinhom estimates the inhomogeneous pair correlation using a modified version of the algorithm in pcf.ppp.

If renormalise=TRUE (the default), then the estimates are multiplied by \(c^{\mbox{normpower}}\) where \( c = \mbox{area}(W)/\sum (1/\lambda(x_i)). \) This rescaling reduces the variability and bias of the estimate in small samples and in cases of very strong inhomogeneity. The default value of normpower is 1 but the most sensible value is 2, which would correspond to rescaling the lambda values so that \( \sum (1/\lambda(x_i)) = \mbox{area}(W). \)

See Also

pcf, pcf.ppp, bw.stoyan, bw.pcf, Kinhom

Examples

Run this code
  X <- residualspaper$Fig4b
  online <- interactive()
  if(!online) {
    ## reduce size of dataset
    X <- X[c(FALSE, TRUE)]
  }
  plot(pcfinhom(X, stoyan=0.2, sigma=0.1))
  if(require("spatstat.model")) {
    if(online) {
      fit <- ppm(X ~ polynom(x,y,2))
    } else {
      ## simpler model, faster computation
      fit <- ppm(X ~ x)
    }
    plot(pcfinhom(X, lambda=fit, normpower=2))
  }

Run the code above in your browser using DataLab