Learn R Programming

spatstat.explore (version 3.0-6)

densityAdaptiveKernel: Adaptive Kernel Estimate of Intensity of Point Pattern

Description

Computes an adaptive estimate of the intensity function of a point pattern using a variable-bandwidth smoothing kernel.

Usage

densityAdaptiveKernel(X, ...)

# S3 method for ppp densityAdaptiveKernel(X, bw, ..., weights=NULL, at=c("pixels", "points"), edge=TRUE, ngroups)

Value

If at="pixels" (the default), the result is a pixel image. If at="points", the result is a numeric vector with one entry for each data point in X.

Arguments

X

Point pattern (object of class "ppp").

bw

Numeric vector of smoothing bandwidths for each point in X, or a pixel image giving the smoothing bandwidth at each spatial location, or a spatial function of class "funxy" giving the smoothing bandwidth at each location. The default is to compute bandwidths using bw.abram.

...

Arguments passed to bw.abram to compute the smoothing bandwidths if bw is missing, or passed to as.mask to control the spatial resolution of the result.

weights

Optional vector of numeric weights for the points of X.

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").

edge

Logical value indicating whether to perform edge correction.

ngroups

Number of groups into which the bandwidth values should be partitioned and discretised.

Bandwidths and Bandwidth Selection

The function densityAdaptiveKernel computes one adaptive estimate of the intensity, determined by the smoothing bandwidth values bw.

Typically the bandwidth values are computed by first computing a pilot estimate of the intensity, then using bw.abram to compute the vector of bandwidths according to Abramson's rule. This involves specifying a global bandwidth h0.

The default bandwidths may work well in many contexts, but for optimal bandwidth selection, this calculation should be performed repeatedly with different values of h0 to optimise the value of h0. This can be computationally demanding; we recommend the function multiscale.density in the sparr package which supports much faster bandwidth selection, using the FFT method of Davies and Baddeley (2018).

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Tilman Davies.

Details

This function computes a spatially-adaptive kernel estimate of the spatially-varying intensity from the point pattern X using the partitioning technique of Davies and Baddeley (2018).

The argument bw specifies the smoothing bandwidths to be applied to each of the points in X. It may be a numeric vector of bandwidth values, or a pixel image or function yielding the bandwidth values.

If the points of X are \(x_1,\ldots,x_n\) and the corresponding bandwidths are \(\sigma_1,\ldots,\sigma_n\) then the adaptive kernel estimate of intensity at a location \(u\) is $$ \hat\lambda(u) = \sum_{i=1}^n k(u, x_i, \sigma_i) $$ where \(k(u, v, \sigma)\) is the value at \(u\) of the (possibly edge-corrected) smoothing kernel with bandwidth \(\sigma\) induced by a data point at \(v\).

Exact computation of the estimate above can be time-consuming: it takes \(n\) times longer than fixed-bandwidth smoothing.

The partitioning method of Davies and Baddeley (2018) accelerates this computation by partitioning the range of bandwidths into ngroups intervals, correspondingly subdividing the points of the pattern X into ngroups sub-patterns according to bandwidth, and applying fixed-bandwidth smoothing to each sub-pattern.

The default value of ngroups is the integer part of the square root of the number of points in X, so that the computation time is only about \(\sqrt{n}\) times slower than fixed-bandwidth smoothing. Any positive value of ngroups can be specified by the user. Specifying ngroups=Inf enforces exact computation of the estimate without partitioning. Specifying ngroups=1 is the same as fixed-bandwidth smoothing with bandwidth sigma=median(bw).

References

Davies, T.M. and Baddeley, A. (2018) Fast computation of spatially adaptive kernel estimates. Statistics and Computing, 28(4), 937-956.

Hall, P. and Marron, J.S. (1988) Variable window width kernel density estimates of probability densities. Probability Theory and Related Fields, 80, 37-49.

Silverman, B.W. (1986) Density Estimation for Statistics and Data Analysis. Chapman and Hall, New York.

See Also

density.ppp, adaptive.density, densityVoronoi, im.object.

See the function bivariate.density in the sparr package for a more flexible implementation, and multiscale.density for an implementation that is more efficient for bandwidth selection.

Examples

Run this code
  Z <- densityAdaptiveKernel(redwood, h0=0.1)
  plot(Z, main="Adaptive kernel estimate")
  points(redwood, col="white")

Run the code above in your browser using DataLab