Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

localpcf

Local pair correlation function


Description

Computes individual contributions to the pair correlation function from each data point.

Usage

localpcf(X, ..., delta=NULL, rmax=NULL, nr=512, stoyan=0.15, rvalue=NULL)

  localpcfinhom(X, ..., delta=NULL, rmax=NULL, nr=512, stoyan=0.15,
         lambda=NULL, sigma=NULL, varcov=NULL,
         update=TRUE, leaveoneout=TRUE, rvalue=NULL)

Arguments

X

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

delta

Smoothing bandwidth for pair correlation. The halfwidth of the Epanechnikov kernel.

rmax

Optional. Maximum value of distance r for which pair correlation values g(r) should be computed.

nr

Optional. Number of values of distance r for which pair correlation g(r) should be computed.

stoyan

Optional. The value of the constant c in Stoyan's rule of thumb for selecting the smoothing bandwidth delta.

lambda

Optional. Values of the estimated intensity function, for the inhomogeneous pair correlation. 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.

sigma,varcov,...

These arguments are ignored by localpcf but are passed by localpcfinhom (when lambda=NULL) to the function density.ppp to control the kernel smoothing estimation of lambda.

leaveoneout

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

update

Logical value indicating what to do when lambda is a fitted model (class "ppm", "kppm" or "dppm"). If 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.

rvalue

Optional. A single value of the distance argument r at which the local pair correlation should be computed.

Details

localpcf computes the contribution, from each individual data point in a point pattern X, to the empirical pair correlation function of X. These contributions are sometimes known as LISA (local indicator of spatial association) functions based on pair correlation.

localpcfinhom computes the corresponding contribution to the inhomogeneous empirical pair correlation function of X.

Given a spatial point pattern X, the local pcf g[i](r) associated with the ith point in X is computed by

g[i](r) = (a/(2 * pi * n) * sum[j] k(d[i,j] - r)

where the sum is over all points j != i, a is the area of the observation window, n is the number of points in X, and d[i,j] is the distance between points i and j. Here k is the Epanechnikov kernel,

k(t) = (3/(4*delta)) * max(0, 1 - t^2/delta^2).

Edge correction is performed using the border method (for the sake of computational efficiency): the estimate g[i](r) is set to NA if r > b[i], where b[i] is the distance from point i to the boundary of the observation window.

The smoothing bandwidth delta may be specified. If not, it is chosen by Stoyan's rule of thumb delta = c/lambda where lambda = n/a is the estimated intensity and c is a constant, usually taken to be 0.15. The value of c is controlled by the argument stoyan.

For localpcfinhom, the optional argument lambda specifies the values of the estimated intensity function. If lambda is given, it should be either a numeric 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. If lambda is not given, then it will be estimated using a leave-one-out kernel density smoother as described in pcfinhom.

Alternatively, if the argument rvalue is given, and it is a single number, then the function will only be computed for this value of r, and the results will be returned as a numeric vector, with one entry of the vector for each point of the pattern X.

Value

An object of class "fv", see fv.object, which can be plotted directly using plot.fv. Essentially a data frame containing columns

r

the vector of values of the argument r at which the function K has been estimated

theo

the theoretical value K(r) = pi * r^2 or L(r)=r for a stationary Poisson process

together with columns containing the values of the local pair correlation function for each point in the pattern. Column i corresponds to the ith point. The last two columns contain the r and theo values.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

X <- ponderosa

  g <- localpcf(X, stoyan=0.5)
  colo <- c(rep("grey", npoints(X)), "blue")
  a <- plot(g, main=c("local pair correlation functions", "Ponderosa pines"),
          legend=FALSE, col=colo, lty=1)

  # plot only the local pair correlation function for point number 7
  plot(g, est007 ~ r)

  # Extract the local pair correlation at distance 15 metres, for each point
  g15 <- localpcf(X, rvalue=15, stoyan=0.5)
  g15[1:10]
  # Check that the value for point 7 agrees with the curve for point 7:
  points(15, g15[7], col="red") 

  # Inhomogeneous 
  gi <- localpcfinhom(X, stoyan=0.5)
  a <- plot(gi, main=c("inhomogeneous local pair correlation functions",
                       "Ponderosa pines"),
                legend=FALSE, col=colo, lty=1)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.