densityAdaptiveKernel: Adaptive Kernel Estimate of Intensity of Point Pattern

View source: R/densityAdaptiveKernel.R

densityAdaptiveKernelR Documentation

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 class 'ppp'
densityAdaptiveKernel(X, bw, ...,
       weights=NULL,       
       at=c("pixels", "points"),
       edge=TRUE, ngroups) 

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.

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], ..., x[n] and the corresponding bandwidths are σ[1], ..., σ[n] then the adaptive kernel estimate of intensity at a location u is

λ(u) = sum[i] e(x[i], k(u, x[i], σ[i])

where k(u, v, σ) is the value at u of the (possibly edge-corrected) smoothing kernel with bandwidth σ 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).

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.

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(s)

\adrian

and Tilman Davies.

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

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

spatstat.core documentation built on May 18, 2022, 9:05 a.m.