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.
## S3 method for class 'lpp' densityfun(X, sigma, ..., weights=NULL, nsigma=1, verbose=FALSE)
Point pattern on a linear network
(object of class
Bandwidth of kernel (standard deviation of Gaussian kernel),
in the same units of length as
Arguments passed to
Optional numeric vector of weights associated
with the points of
Integer. The number of different bandwidths for which a result
should be returned.
Logical value indicating whether to print progress reports.
Kernel smoothing is applied to the points of
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.
Function on a linear network (object of class
nsigma=1 (the default), the result is a function giving
kernel estimate with bandwidth
nsigma > 1, the result is a function
with an additional argument
k is specified,
the function returns the kernel estimate for
tau = sigma * sqrt(k/nsigma).
k is not specified, results are returned
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;
giving the smoothing bandwidth sigma used
(or the successive bandwidths used at each sampled time step,
nsigma > 1).
Greg McSwiggan, with tweaks by \adrian.
McSwiggan, G., Baddeley, A. and Nair, G. (2016) Kernel Density Estimation on a Linear Network. Scandinavian Journal of Statistics 44, 324–345.
density.lpp which returns a pixel image
on the linear network.
methods.linfun for methods applicable to
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.