pppdist {spatstat} | R Documentation |
Given two point patterns, find the optimal match between them.
pppdist(X, Y, q = 1, precision = 7, show.rprimal = FALSE, belowone = TRUE, timelag = 0)
X,Y |
Two point patterns (objects of class "ppp" ). |
q |
Exponent of the Wasserstein distance
(or Inf for the Prohorov distance).
|
precision |
Index controlling accuracy of algorithm.
Interpoint distances will be rounded to the nearest multiple of
10^(-precision) .
|
show.rprimal |
Logical. Whether to display a plot showing the iterative solution of the restricted primal problem. |
belowone |
Logical. Experimental use only. Indicates whether to rescale the distances by a fudge factor. |
timelag |
Time lag, in seconds, between successive displays of the iterative solution of the restricted primal problem. |
Finds the matching between the point patterns X
and Y
which minimises the sum of the distances between matched points
(if q=1
), the maximum distance between matched points
(if q=Inf
), and in general the 1/q
th power of the sum of
the q
th powers of the distances between matched points.
If q < 1 this is known as the Wasserstein distance,
and if q = infty it is the Prohorov distance.
For finite exponents q
, there is a fast C algorithm,
which will handle patterns of 100 points without difficulty,
but should not be used with thousands of points.
If show.rprimal=TRUE
, slower interpreted code is used
to demonstrate the algorithm.
For q=Inf
, even slower interpreted R code is used,
and this works only for very small point patterns.
An object of class pppmatching
that represents the
matching. There are methods for plot
, print
and summary
for this class.
Dominic Schuhmacher.
X <- runifpoint(42) Y <- runifpoint(42) pppdist(X, Y) pppdist(X[1:10], Y[1:10], q=Inf)