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

localK

Neighbourhood density function


Description

Computes the neighbourhood density function, a local version of the K-function or L-function, defined by Getis and Franklin (1987).

Usage

localK(X, ..., rmax = NULL, correction = "Ripley", verbose = TRUE, rvalue=NULL)
  localL(X, ..., rmax = NULL, correction = "Ripley", verbose = TRUE, rvalue=NULL)

Arguments

X

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

...

Ignored.

rmax

Optional. Maximum desired value of the argument r.

correction

String specifying the edge correction to be applied. Options are "none", "translate", "translation", "Ripley", "isotropic" or "best". Only one correction may be specified.

verbose

Logical flag indicating whether to print progress reports during the calculation.

rvalue

Optional. A single value of the distance argument r at which the function L or K should be computed.

Details

The command localL computes the neighbourhood density function, a local version of the L-function (Besag's transformation of Ripley's K-function) that was proposed by Getis and Franklin (1987). The command localK computes the corresponding local analogue of the K-function.

Given a spatial point pattern X, the neighbourhood density function L[i](r) associated with the ith point in X is computed by

L[i](r) = sqrt( (a/((n-1)* pi)) * sum[j] e[i,j])

where the sum is over all points j != i that lie within a distance r of the ith point, a is the area of the observation window, n is the number of points in X, and e[i,j] is an edge correction term (as described in Kest). The value of L[i](r) can also be interpreted as one of the summands that contributes to the global estimate of the L function.

By default, the function L[i](r) or K[i](r) is computed for a range of r values for each point i. The results are stored as a function value table (object of class "fv") with a column of the table containing the function estimates for each point of the pattern X.

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.

Inhomogeneous counterparts of localK and localL are computed by localKinhom and localLinhom.

Value

If rvalue is given, the result is a numeric vector of length equal to the number of points in the point pattern.

If rvalue is absent, the result is 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 neighbourhood density 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)

and Rolf Turner r.turner@auckland.ac.nz

References

Getis, A. and Franklin, J. (1987) Second-order neighbourhood analysis of mapped point patterns. Ecology 68, 473–477.

See Also

Examples

data(ponderosa)
  X <- ponderosa

  # compute all the local L functions
  L <- localL(X)

  # plot all the local L functions against r
  plot(L, main="local L functions for ponderosa", legend=FALSE)

  # plot only the local L function for point number 7
  plot(L, iso007 ~ r)
  
  # compute the values of L(r) for r = 12 metres
  L12 <- localL(X, rvalue=12)

  # Spatially interpolate the values of L12
  # Compare Figure 5(b) of Getis and Franklin (1987)
  X12 <- X %mark% L12
  Z <- Smooth(X12, sigma=5, dimyx=128)

  plot(Z, col=topo.colors(128), main="smoothed neighbourhood density")
  contour(Z, add=TRUE)
  points(X, pch=16, cex=0.5)

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.