1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
\name{densityEqualSplit}
\alias{densityEqualSplit}
\title{
Equal-Split Algorithm for Kernel Density on a Network
}
\description{
Computes a kernel density estimate on a linear network
using the Okabe-Sugihara equal-split algorithms.
}
\usage{
densityEqualSplit(x, sigma = NULL, \dots,
at = c("pixels", "points"),
leaveoneout=TRUE,
weights = NULL,
kernel = "epanechnikov", continuous = TRUE,
epsilon = 1e-06, verbose = TRUE, debug = FALSE, savehistory = TRUE)
}
\arguments{
\item{x}{
Point pattern on a linear network (object of class \code{"lpp"})
to be smoothed.
}
\item{sigma}{
Smoothing bandwidth (standard deviation of the kernel).
A numeric value in the same units as the spatial coordinates of \code{x}.
Alternatively \code{sigma} may be a function which selects a
bandwidth when applied to \code{X},
for example, \code{\link[spatstat.explore]{bw.scott.iso}} or \code{\link{bw.lppl}}.
There is a sensible default.
}
\item{\dots}{
Arguments passed to \code{\link[spatstat.geom]{as.mask}} determining the
resolution of the result.
}
\item{at}{
String (partially matched)
specifying whether to compute the intensity values
at a fine grid of locations on the network
(\code{at="pixels"}, the default) or
only at the points of \code{x} (\code{at="points"}).
}
\item{leaveoneout}{
Logical value indicating whether to compute a leave-one-out
estimator. Applicable only when \code{at="points"}.
}
\item{weights}{
Optional. Numeric vector of weights associated with the
points of \code{x}. Weights may be positive, negative or zero.
}
\item{kernel}{
Character string specifying the smoothing kernel.
See \code{\link[spatstat.univar]{dkernel}} for possible options.
}
\item{continuous}{
Logical value indicating whether to compute the
\dQuote{equal-split continuous} smoother (\code{continuous=TRUE}, the
default) or the \dQuote{equal-split discontinuous} smoother
(\code{continuous=FALSE}).
}
\item{epsilon}{
Tolerance value. A tail of the kernel with total mass
less than \code{epsilon} may be deleted.
}
\item{verbose}{
Logical value indicating whether to print progress reports.
}
\item{debug}{
Logical value indicating whether to print debugging information.
}
\item{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 \code{x}
using a kernel based on path distances in the network.
The result is a pixel image on the linear network (class
\code{"linim"}) which can be plotted.
Smoothing is performed using one of the \dQuote{equal-split} rules described in
Okabe and Sugihara (2012).
\itemize{
\item
If \code{continuous=TRUE} (the default), smoothing is performed
using the \dQuote{equal-split continuous} rule described in
Section 9.2.3 of Okabe and Sugihara (2012).
The resulting function is continuous on the linear network.
\item
If \code{continuous=FALSE}, smoothing is performed
using the \dQuote{equal-split discontinuous} rule described in
Section 9.2.2 of Okabe and Sugihara (2012). The
resulting function is not continuous.
}
Computation is performed by path-tracing
as described in Okabe and Sugihara (2012).
It is advisable to choose a kernel with bounded support
such as \code{kernel="epanechnikov"}.
With a Gaussian kernel, computation time can be long, and
increases exponentially with \code{sigma}.
Faster algorithms are available through \code{\link{density.lpp}}.
The argument \code{sigma} specifies the smoothing bandwidth.
If \code{sigma} is missing or \code{NULL},
the default is one-eighth of the length of the shortest side
of the bounding box of \code{x}.
If \code{sigma} is a function in the \R language, it is assumed
to be a bandwidth selection rule, and it will be applied to \code{x}
to compute the bandwidth value.
}
\section{Infinite bandwidth}{
If \code{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).
}
\value{
If \code{at="pixels"} (the default),
a pixel image on the linear network (object of class \code{"linim"}).
If \code{at="points"}, a numeric vector with one entry for each point
of \code{x}.
}
\references{
Okabe, A. and Sugihara, K. (2012)
\emph{Spatial analysis along networks}.
Wiley.
}
\author{
\adrian and Greg McSwiggan.
}
\seealso{
\code{\link{density.lpp}}
}
\examples{
X <- runiflpp(3, simplenet)
De <- density(X, 0.2, kernel="epanechnikov", verbose=FALSE)
Ded <- density(X, 0.2, kernel="epanechnikov", continuous=FALSE, verbose=FALSE)
}
\keyword{spatial}
\keyword{methods}
\keyword{smooth}
|