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.
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
)This function produces the spatial density of x
as an object of class im.
Point pattern (object of class "ppp").
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.
Optional weights to be attached to the points.
A numeric vector, numeric matrix, an expression,
or a pixel image.
Logical value indicating whether to apply edge correction.
Variance-covariance matrix of anisotropic smoothing kernel.
Incompatible with sigma.
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").
Logical value indicating whether to compute a leave-one-out
estimator. Applicable only when at="points".
Optional. Adjustment factor for the smoothing parameter.
Logical. If TRUE, use the Jones-Diggle improved edge correction,
which is more accurate but slower to compute than the default
correction.
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.
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.
Logical value indicating whether to force all density values to
be positive numbers. Default is FALSE.
Logical value indicating whether to issue warnings about numerical problems and conditions.
Joshua French
Waller, L.A. and Gotway, C.A. (2005). Applied Spatial Statistics for Public Health Data. Hoboken, NJ: Wiley.
density.ppp
data(grave)
contour(spdensity(grave))
Run the code above in your browser using DataLab