ppdistnet {ttbary} | R Documentation |
Compute Distance Between Two Point Patterns on a Network
Description
Based on an arbitrary matrix of "distances" on a network, this function computes versions
of the transport-transform distance between two point patterns \xi
and \eta
on this network.
Usage
ppdistnet(
dmat,
xi = NULL,
eta = NULL,
penalty = 1,
type = c("tt", "rtt", "TT", "RTT"),
ret_matching = FALSE,
p = 1,
precision = NULL
)
Arguments
dmat |
a matrix specifying in its |
xi |
a vector specifying the vertex-indices of |
eta |
a vector specifying the vertex-indices of |
penalty |
a positive number. The penalty for adding/deleting points. |
type |
either |
ret_matching |
Logical. Shall the optimal point matching be returned? |
p |
a number |
precision |
a small positive integer value. The precision of the computations, which
are currently performed in integers. After correcting for the penalty, |
Details
This function provides a more convenient way for computing (relative)
transport-transform distances on networks if the points of the patterns are given in
terms of indices of network vertices. If dmat
contains only the distances
between the points of \xi
and \eta
, this function
does the same as ppdist
.
Value
The corresponding distance between the point patterns if ret_matching
is FALSE
.
Otherwise a list with components dist
containing
this distance and two vectors target1, target2
of integers, where
target
i
specifies the indices of the points in the other pattern
that the points of the i
-th pattern are matched to and NA
every
time a point is deleted.
There may be a minus in front of an index, where
-j
indicates that the corresponding pairing with point j
would be over a distance of more than 2^{1/p} \cdot
\code{penalty}
. This is
equivalent to saying that the corresponding point of the first pattern
is deleted and the j
-th point of the second pattern is added.
Note that having more than one minus implies that the matching is non-unique.
Author(s)
Raoul Müller raoul.mueller@uni-goettingen.de
Dominic Schuhmacher schuhmacher@math.uni-goettingen.de
See Also
Examples
set.seed(123456)
nvert <- 100 #number of vertices in the network
lambda <- 0.5 #expected number of points per unit length
ln <- delaunayNetwork(runifpoint(nvert)) #create an artificial network
ppnetwork <- rpoislpp(lambda, ln, nsim = 2)
#simulate two point patterns on the network
plot(ppnetwork[[1]]$domain, cex=0.5, main="")
plot(as.ppp(ppnetwork[[1]]),vpch=1,col=2,add=TRUE)
plot(as.ppp(ppnetwork[[2]]),vpch=1,col=4,add=TRUE)
res <- netsplit(ln, ppnetwork)
#incorporate data point patterns into the network
#calculating all pairwise distances between vertices
#and creating matrix of vertex-indices of data point patterns
xi <- res$ppmatrix[1:npoints(ppnetwork[[1]]), 1]
eta <- res$ppmatrix[1:npoints(ppnetwork[[2]]), 2]
res2 <- ppdistnet(res$network$dpath, xi = xi, eta = eta,
penalty = 1, type = "tt", ret_matching = TRUE, p = 1)
res2