densityfun.lpp: Kernel Estimate of Intensity on a Linear Network as a Spatial...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/densityfunlpp.R

Description

Computes a kernel estimate of the intensity of a point process on a linear network, and returns the intensity estimate as a function of spatial location.

Usage

1
2
## S3 method for class 'lpp'
densityfun(X, sigma, ..., weights=NULL, nsigma=1, verbose=FALSE)

Arguments

X

Point pattern on a linear network (object of class "lpp").

sigma

Bandwidth of kernel (standard deviation of Gaussian kernel), in the same units of length as X.

...

Arguments passed to density.lpp to control the discretisation.

weights

Optional numeric vector of weights associated with the points of X.

nsigma

Integer. The number of different bandwidths for which a result should be returned. If nsigma=1 (the default), the result is a function giving kernel estimate with bandwidth sigma. If nsigma > 1, the result is a function with an additional argument k containing the kernel estimates for the nsigma+1 equally-spaced time steps from 0 to sigma^2.

verbose

Logical value indicating whether to print progress reports.

Details

Kernel smoothing is applied to the points of X using the diffusion algorithm of McSwiggan et al (2016). The result is a function on the linear network (object of class "linfun") that can be printed, plotted and evaluated at any location.

This is a method for the generic function densityfun for the class "lpp" of point patterns on a linear network.

Value

Function on a linear network (object of class "linfun").

If nsigma=1 (the default), the result is a function giving kernel estimate with bandwidth sigma.

If nsigma > 1, the result is a function with an additional argument k. If k is specified, the function returns the kernel estimate for bandwidth tau = sigma * sqrt(k/nsigma). If k is not specified, results are returned for all k = 1, 2, ..., nsigma.

The result also has attributes

Author(s)

Greg McSwiggan, with tweaks by \adrian.

References

McSwiggan, G., Baddeley, A. and Nair, G. (2016) Kernel Density Estimation on a Linear Network. Scandinavian Journal of Statistics 44, 324–345.

See Also

density.lpp which returns a pixel image on the linear network.

methods.linfun for methods applicable to "linfun" objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  X <- unmark(chicago)
  # single bandwidth
  g <- densityfun(X, 30)
  plot(g)
  Y <- X[1:5]
  g(Y)
  # weighted
  gw <- densityfun(X, 30, weights=runif(npoints(X)))
  # sequence of bandwidths 
  g10 <- densityfun(X, 30, nsigma=10)
  g10(Y, k=10)
  g10(Y)
  plot(as.linim(g10, k=5))

spatstat.linnet documentation built on July 17, 2021, 9:07 a.m.