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

densityfun.lpp {spatstat.linnet} | R Documentation

## Kernel Estimate of Intensity on a Linear Network as a Spatial Function

### 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

    ## 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

- `attr(result, "dt")` giving the time step Delta t;

- `attr(result, "dx")` giving the spacing Delta x between sample points in the numerical algorithm;

- `attr(result, "sigma")` giving the smoothing bandwidth sigma used (or the successive bandwidths used at each sampled time step, if `nsigma > 1`).

### Author(s)

Greg McSwiggan, with tweaks by Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

### 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

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

[Package spatstat.linnet version 2.0-0 Index]