Learn R Programming

ecespa (version 1.1-17)

getis: Neighbourhood density function

Description

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

Usage

getis(mippp, nx = 30, ny = 30, R = 10)

# S3 method for ecespa.getis plot(x, type="k", dimyx=NULL, xy=NULL, eps=NULL, color=NULL, contour=TRUE, points=TRUE,...)

Value

getis gives an object of class ecespa.getis, bassically a list with the following elements:

x

x coordinates of pattern points (ahead) and grid points.

y

y coordinates of pattern points (ahead) and grid points.

klocal

Estimate of local \(K[i](r)\) at the point pattern points.

klocalgrid

Estimate of local \(K[i](r)\) at the grid points.

R

Distance \(r\) at which the estimation is made.

nx

Density of the estimating grid in the x-side.

ny

Density of the estimating grid in the x-side.

dataname

Name of the ppp object analysed.

ppp

Original point pattern.

plot.ecespa.getis plots an interpolated map of the selected local statistics

Arguments

mippp

A point pattern. An object with the ppp format of spatstat.

nx

Grid dimensions (for estimation) in the x-side.

ny

Grid dimensions (for estimation) in the y-side.

R

Radius. The distance argument r at which the function \(K\) should be computed.

x

Result of applying getis to a point pattern.

type

Type of local statistics to be ploted. One of k (local-\(K\)), l (local-\(L\)), n (local-\(n\)) or d (deviations from CSR).

color

A list of colors such as that generated by rainbow, heat.colors, topo.colors, terrain.colors or similar functions.

dimyx

pixel array dimensions, will be passed to (i.e. see details in) as.mask.

xy

pixel coordinates, will be passed to (i.e. see details in) as.mask.

eps

width and height of pixels, will be passed to (i.e. see details in) as.mask.

contour

Logical; if TRUE, add a contour to current plot.

points

Logical; if TRUE, add the point pattern to current plot.

...

Additional graphical parameters passed to link{plot}.

Author

Marcelino de la Cruz Rot

Details

Getis and Franklin (1987) proposed the neigbourhood density function, a local version of Ripley's \(L\)- function. Given a spatial point pattern \(X\), the neigbourhood density function 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 the isotropic 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.

The command getis actually computes the local \(K\)-function using Kcross. As the main objective of getis is to map the local density function, as sugested by Gestis and Franklin (1987: 476) a grid of points (whose density is controled by nx and ny), is used to accurately estimate the functions in empty or sparse areas. The S3 method plot.ecespa.getis plots the spatial distribution of the local \(K\) or \(L\) function or other related local statistics, such as \(n[i](r)\), the number of neighbor points [=\( lambda*K[i](r)\)] or the deviations from the expected value of local \(L\) under CSR [= \(L[i](r) -r\)]. It some of the arguments dimyx, xy or eps is provided it will use the function interp.im in spatstat package to interpolate the results;otherwise it will plot the estimated values at the origial grid points.

References

Getis, A. and Franklin, J. 1987. Second-order neighbourhood analysis of mapped point patterns. Ecology 68: 473-477. tools:::Rd_expr_doi("10.2307/1938452").

See Also

localK, a different approach in spatstat.

Examples

Run this code

  ## Compare with fig. 5b of Getis & Franklin (1987: 476):
  
  data(ponderosa)
  
  #ponderosa12 <- getis(ponderosa, nx = 30, ny = 30, R = 12)
  ponderosa12 <- getis(ponderosa, nx = 20, ny = 20, R = 12)
  
  plot(ponderosa12, type = "l", dimyx=256)
  
if (FALSE) {
  ## Plot the same, using Smooth.ppp in spatstat
  
  ponderosa.12 <- setmarks(ponderosa, ponderosa12$klocal)
  
  Z <- Smooth(ponderosa.12, sigma=5, dimyx=256)
  
  plot(Z, col=topo.colors(128), main="smoothed neighbourhood density")
  
  contour(Z, add=TRUE)
  
  points(ponderosa, pch=16, cex=0.5) 
  

  ## Example with irregular window:
  
  data(letterR)
  
  X <- rpoispp(50, win=letterR)
  
  X.g <- getis(X, R=0.2)
  
  plot(X.g,dimyx=c(200,100))
  
   ## Plot the same, using Smooth.ppp in spatstat
    X2 <- setmarks(X, X.g$klocal)
  
    Z <- Smooth(X2, sigma=0.05, dimxy=256)
  
    plot(Z, col=topo.colors(128), main="smoothed neighbourhood density")
  
    contour(Z, add=TRUE)
  
    points(X, pch=16, cex=0.5)
  
    
    }

Run the code above in your browser using DataLab