Learn R Programming

smacpod (version 1.3.0)

spdensity: Kernel smoothed spatial density of point pattern

Description

spdensity computes a kernel smoothed spatial density function from a point pattern. This is essentially a slight modification of the density.ppp function from the spatstat package, which computes the spatial intensity of a point pattern.

Usage

spdensity(x, sigma = NULL, ..., weights = NULL, edge = TRUE,
  varcov = NULL, at = "pixels", leaveoneout = TRUE, adjust = 1,
  diggle = FALSE)

Arguments

x
Point pattern (object of class "ppp").
sigma
Standard deviation of isotropic Gaussian smoothing kernel. Either a numerical value, or a function that computes an appropriate value of sigma.
...
Additional arguments passed to pixellate.ppp and as.mask to determine the pixel resolution, or passed to sigma if it is a function.
weights
Optional weights to be attached to the points. A numeric vector, numeric matrix, or an expression.
edge
Logical flag: if TRUE, apply edge correction.
varcov
Variance-covariance matrix of anisotropic Gaussian kernel. Incompatible with sigma.
at
String specifying whether to compute the intensity values at a grid of pixel locations (at="pixels") or only at the points of x (at="points").
leaveoneout
Logical value indicating whether to compute a leave-one-out estimator. Applicable only when at="points".
adjust
Optional. Adjustment factor for the smoothing parameter.
diggle
Logical. If TRUE, use Diggle's edge correction, which is more accurate but slower to compute than the correction described under Details.

Value

  • This function produces an object of class im from the spatstat package, in nearly the exact same way as spatstat::density.ppp. The difference is that the values are scaled so that a true spatial density function is produced (i.e., the function integrates to 1).

References

Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.

See Also

density.ppp

Examples

Run this code
data(grave)
contour(spdensity(grave))

Run the code above in your browser using DataLab