spdensity: Kernel smoothed spatial density of point pattern

View source: R/spdensity.R

spdensityR Documentation

Kernel smoothed spatial density of point pattern

Description

spdensity computes a kernel smoothed spatial density function from a point pattern. This function is basically a wrapper for density.ppp. The density.ppp function computes the spatial intensity of a point pattern; the spdensity function scales the intensity to produce a true spatial density.

Usage

spdensity(
  x,
  sigma = NULL,
  ...,
  weights = NULL,
  edge = TRUE,
  varcov = NULL,
  at = "pixels",
  leaveoneout = TRUE,
  adjust = 1,
  diggle = FALSE,
  kernel = "gaussian",
  scalekernel = is.character(kernel),
  positive = FALSE,
  verbose = TRUE
)

Arguments

x

Point pattern (object of class "ppp").

sigma

The smoothing bandwidth (the amount of smoothing). The standard deviation of the isotropic 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, an expression, or a pixel image.

edge

Logical value indicating whether to apply edge correction.

varcov

Variance-covariance matrix of anisotropic smoothing 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 the Jones-Diggle improved edge correction, which is more accurate but slower to compute than the default correction.

kernel

The smoothing kernel. A character string specifying the smoothing kernel (current options are "gaussian", "epanechnikov", "quartic" or "disc"), or a pixel image (object of class "im") containing values of the kernel, or a function(x,y) which yields values of the kernel.

scalekernel

Logical value. If scalekernel=TRUE, then the kernel will be rescaled to the bandwidth determined by sigma and varcov: this is the default behaviour when kernel is a character string. If scalekernel=FALSE, then sigma and varcov will be ignored: this is the default behaviour when kernel is a function or a pixel image.

positive

Logical value indicating whether to force all density values to be positive numbers. Default is FALSE.

verbose

Logical value indicating whether to issue warnings about numerical problems and conditions.

Value

This function produces the spatial density of x as an object of class im.

Author(s)

Joshua French

References

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

See Also

density.ppp

Examples

data(grave)
contour(spdensity(grave))

jpfrench81/smacpod documentation built on Oct. 2, 2023, 2:57 p.m.