Given a point pattern on a linear network, compute a kernel estimate of intensity, by solving the heat equation.
# S3 method for lpp
densityHeat(x, sigma=NULL, ...,
at=c("pixels", "points"), leaveoneout=TRUE,
weights = NULL,
dx = NULL, dt = NULL, iterMax = 1e+06,
finespacing = TRUE, verbose=FALSE)If at="pixels" (the default),
a pixel image on the linear network (object of class "linim").
If at="points", a numeric vector with one entry for each point
of x.
The function densityHeat is generic.
This is the method for the class "lpp" of points on a linear
network.
Kernel smoothing is applied to the points of x
using a kernel based on path distances in the network.
If at="pixels" (the default),
the result is a pixel image on the linear network (class
"linim") which can be plotted.
If at="points" the result is a numeric vector giving the
density estimates at the data points of x.
The smoothing operation is equivalent to the
“equal-split continuous” rule described in
Section 9.2.3 of Okabe and Sugihara (2012).
However, the actual computation is performed rapidly, by solving the classical
time-dependent heat equation on the network,
as described in McSwiggan et al (2016).
Computational time is short, but increases quadratically with
sigma.
If at="points" and leaveoneout=TRUE,
a leave-one-out estimate is computed at each data point
(that is, the estimate at each data point x[i] is based
on all of the points except x[i])
using the truncated series approximation
of McSwiggan et al (2019).
The argument sigma specifies the smoothing bandwidth.
If sigma is missing or NULL,
the default is one-eighth of the length of the shortest side
of the bounding box of x.
If sigma is a function in the R language, it is assumed
to be a bandwidth selection rule, and it will be applied to x
to compute the bandwidth value.
McSwiggan, G., Baddeley, A. and Nair, G. (2016) Kernel density estimation on a linear network. Scandinavian Journal of Statistics 44, 324--345.
McSwiggan, G., Baddeley, A. and Nair, G. (2019) Estimation of relative risk for events on a linear network. Statistics and Computing 30, 469--484.
Okabe, A. and Sugihara, K. (2012) Spatial analysis along networks. Wiley.
density.lpp
X <- runiflpp(3, simplenet)
D <- densityHeat(X, 0.2)
plot(D, style="w", main="", adjust=2)
densityHeat.lpp(X, 0.2, at="points")
Dw <- densityHeat(X, 0.2, weights=c(1,2,-1))
Run the code above in your browser using DataLab