# density.lpp

##### Kernel Estimate of Intensity on a Linear Network

Estimates the intensity of a point process on a linear network by applying kernel smoothing to the point pattern data, using the equal-split continuous algorithm.

##### Usage

```
# S3 method for lpp
density(x, sigma, …,
weights=NULL,
kernel="gaussian",
continuous=TRUE,
epsilon = 1e-06, verbose = TRUE, debug = FALSE, savehistory = TRUE)
```# S3 method for splitppx
density(x, sigma, …)

##### Arguments

- x
Point pattern on a linear network (object of class

`"lpp"`

) to be smoothed.- sigma
Smoothing bandwidth (standard deviation of the kernel) in the same units as the spatial coordinates of

`x`

.- …
Arguments passed to

`as.mask`

determining the resolution of the result.- weights
Optional. Numeric vector of weights associated with the points of

`x`

. Weights may be positive, negative or zero.- kernel
Character string specifying the smoothing kernel. See

`dkernel`

for possible options.- continuous
Logical value indicating whether to compute the “equal-split continuous” smoother (

`continuous=TRUE`

, the default) or the “equal-split discontinuous” smoother (`continuous=FALSE`

).- epsilon
Tolerance value. A tail of the kernel with total mass less than

`epsilon`

may be deleted.- verbose
Logical value indicating whether to print progress reports.

- debug
Logical value indicating whether to print debugging information.

- savehistory
Logical value indicating whether to save the entire history of the algorithm, for the purposes of evaluating performance.

##### Details

Kernel smoothing is applied to the points of `x`

using one of the algorithms described in Okabe and Sugihara (2012).
The result is a pixel image on the linear network (class
`"linim"`

) which can be plotted.

If `continuous=TRUE`

(the default), smoothing is performed
using the “equal-split 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 “equal-split discontinuous” rule described in
Section 9.2.2 of Okabe and Sugihara (2012). This algorithm is
faster, but the resulting function is not continuous.

There is also a method for split point patterns on a linear network
(class `"splitppx"`

) which will return a list of pixel images.

##### Value

Pixel image on the linear network (class
`"linim"`

).

##### WARNING

**THIS ALGORITHM CAN BE EXTREMELY SLOW** for large values of `sigma`

.

The computational complexity increases exponentially with
`sigma`

.

You Have Been Warned.

##### References

Okabe, A. and Sugihara, K. (2012)
*Spatial analysis along networks*.
Wiley.

##### See Also

##### Examples

```
# NOT RUN {
X <- runiflpp(3, simplenet)
D <- density(X, 0.2, verbose=FALSE)
plot(D, 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)
# }
```

*Documentation reproduced from package spatstat, version 1.49-0, License: GPL (>= 2)*