ppdistnet | R Documentation |
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.
ppdistnet( dmat, xi = NULL, eta = NULL, penalty = 1, type = c("tt", "rtt", "TT", "RTT"), ret_matching = FALSE, p = 1, precision = NULL )
dmat |
a matrix specifying in its (i,j)-th entry the shortest-path distance from the i-th point of xi to the j-th point of eta OR the distance matrix of a whole network. In the latter case arguments xi and eta have to be specified. |
xi |
a vector specifying the vertex-indices of xi, only needed if |
eta |
a vector specifying the vertex-indices of eta, only needed if |
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 >0. The matching is chosen such that the |
precision |
a small positive integer value. The precision of the computations, which
are currently performed in integers. After correcting for the penalty, |
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
.
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} * 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.
Raoul Müller raoul.mueller@uni-goettingen.de
Dominic Schuhmacher schuhmacher@math.uni-goettingen.de
ppdist
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.