density.lpp  R Documentation 
Estimates the intensity of a point process on a linear network by applying kernel smoothing to the point pattern data.
## S3 method for class 'lpp'
density(x, sigma=NULL, ...,
weights=NULL,
distance=c("path", "euclidean"),
continuous=TRUE,
kernel="gaussian")
## S3 method for class 'splitppx'
density(x, sigma=NULL, ...)
x 
Point pattern on a linear network (object of class 
sigma 
Smoothing bandwidth (standard deviation of the kernel).
A single numerical value
in the same units as the spatial coordinates of 
... 
Additional arguments controlling the algorithm
and the spatial resolution of the result.
These arguments are passed either to

weights 
Optional. Numeric vector of weights associated with the
points of 
distance 
Character string (partially matched) specifying whether to use
a kernel based on paths in the network ( 
kernel 
Character string specifying the smoothing kernel.
See 
continuous 
Logical value indicating whether to compute the
“equalsplit continuous” smoother ( 
Kernel smoothing is applied to the points of x
using either a kernel based on path distances in the network,
or a twodimensional kernel.
The result is a pixel image on the linear network (class
"linim"
) which can be plotted.
If distance="path"
(the default)
then the smoothing is performed
using a kernel based on path distances in the network, as described in
described in Okabe and Sugihara (2012) and McSwiggan et al (2016).
If continuous=TRUE
(the default), smoothing is performed
using the “equalsplit continuous” rule described in
Section 9.2.3 of Okabe and Sugihara (2012).
The resulting function is continuous on the linear network.
If continuous=FALSE
, smoothing is performed
using the “equalsplit discontinuous” rule described in
Section 9.2.2 of Okabe and Sugihara (2012). The
resulting function is continuous except at the network vertices.
In the default case
(where distance="path"
and
continuous=TRUE
and kernel="gaussian"
,
computation is performed rapidly by solving the classical heat equation
on the network, as described in McSwiggan et al (2016).
The arguments are passed to densityHeat.lpp
which performs
the computation.
Computational time is short, but increases quadratically
with sigma
.
In all other cases, computation is performed by pathtracing
as described in Okabe and Sugihara (2012);
the arguments are passed to densityEqualSplit
which performs the computation.
Computation time can be extremely long, and
increases exponentially with sigma
.
If distance="euclidean"
, the smoothing is performed
using a twodimensional kernel. The arguments are passed to
densityQuick.lpp
to perform the computation.
Computation time is very short.
See the help for densityQuick.lpp
for further details.
There is also a method for split point patterns on a linear network
(class "splitppx"
) which will return a list of pixel images.
The argument sigma
specifies the smoothing bandwidth.
If sigma
is missing or NULL
,
the default is oneeighth 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.
A pixel image on the linear network (object of class "linim"
),
or in some cases, a numeric vector of length equal to npoints(x)
.
If sigma=Inf
, the resulting density estimate is
constant over all locations,
and is equal to the average density of points per unit length.
(If the network is not connected, then this rule
is applied separately to each connected component of the network).
and Greg McSwiggan.
McSwiggan, G., Baddeley, A. and Nair, G. (2016) Kernel density estimation on a linear network. Scandinavian Journal of Statistics 44, 324–345.
Okabe, A. and Sugihara, K. (2012) Spatial analysis along networks. Wiley.
lpp
,
linim
,
densityQuick.lpp
,
densityHeat.lpp
,
densityVoronoi.lpp
X < runiflpp(3, simplenet)
D < density(X, 0.2, verbose=FALSE)
plot(D, style="w", main="", adjust=2)
Dq < density(X, 0.2, distance="euclidean")
plot(Dq, style="w", main="", adjust=2)
Dw < density(X, 0.2, weights=c(1,2,1), verbose=FALSE)
De < density(X, 0.2, kernel="epanechnikov", verbose=FALSE)
Ded < density(X, 0.2, kernel="epanechnikov", continuous=FALSE, verbose=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.