找回密码
 注册
查看: 325|回复: 0

R语言 spatstat包 pppdist()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 14:00:07 | 显示全部楼层 |阅读模式
pppdist(spatstat)
pppdist()所属R语言包:spatstat

                                        Distance Between Two Point Patterns
                                         两个点模式之间的距离

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Given two point patterns, find the distance between them based on optimal point matching.
鉴于两个点图案,发现它们之间的距离的基础上最佳的点匹配。


用法----------Usage----------


  pppdist(X, Y, type = "spa", cutoff = 1, q = 1, matching = TRUE,
    ccode = TRUE, precision = NULL, approximation = 10,
    show.rprimal = FALSE, timelag = 0)



参数----------Arguments----------

参数:X,Y
Two point patterns (objects of class "ppp").
二点模式(对象类"ppp")。


参数:type
A character string giving the type of distance to be computed. One of "spa" (default), "ace" or "mat", indicating whether the algorithm should find the optimal matching based on "subpattern assignment", "assignment only if cardinalities are equal" or "mass transfer". See details below.   
的字符字符串,给出的类型,要计算的距离。 "spa"(默认),"ace"或"mat",表示如果基数是平等的“或是否应该找到最佳匹配算法的基础上”的子模式转让“,”转让“质量转移”。详见下文。


参数:cutoff
The value > 0 at which interpoint distances are cut off.  
值> 0INTERPOINT距离被切断。


参数:q
The order of the average that is applied to the interpoint distances. May be Inf, in which case the maximum of the interpoint distances is taken.  
的平均的顺序被施加到INTERPOINT距离。可能是Inf,在这种情况下,采取INTERPOINT距离的最大值的。


参数:matching
Logical. Whether to return the optimal matching or only the associated distance.  
逻辑。是否返回最佳匹配或相关的距离。


参数:ccode
Logical. If FALSE, R code is used which allows for higher precision, but is much slower.  
逻辑。如果FALSE,R代码是用来允许更高的精度,但会非常慢。


参数:precision
Index controlling accuracy of algorithm. The q-th powers of interpoint distances will be rounded to the nearest multiple of 10^(-precision). There is a sensible default which depends on ccode.  
指数控制精度的算法。 q次方INTERPOINT距离将被四舍五入到最接近的10^(-precision)。有一个合理的默认,这取决于ccode。


参数:approximation
If q = Inf, compute distance based on the optimal matching for the corresponding distance of order approximation. Can be Inf, but this makes computations extremely slow.  
如果q = Inf,计算距离的基础上的最佳匹配相应的距离,为了approximation。可以Inf,但是这使得计算非常缓慢。


参数:show.rprimal
Logical. Whether to display a plot showing the iterative solution of the restricted primal problem.  
逻辑。是否显示一个图禁区的原始问题的迭代求解。


参数:timelag
Time lag, in seconds, between successive displays of the iterative solution of the restricted primal problem.  
时间的滞后性,在几秒钟内,在连续的显示器的限制原始问题的迭代解法。


Details

详细信息----------Details----------

Computes the distance between point patterns X and Y based on finding the matching between them which minimizes the average of the distances between matched points (if q=1), the maximum distance between matched points (if q=Inf), and in general the q-th order average (i.e. the 1/qth power of the sum of the qth powers) of the distances between matched points. Distances between matched points are Euclidean distances cut off at the value of cutoff.
计算点图案之间的距离X和Y找到最小的平均匹配点之间的距离(它们之间的匹配的基础上,如果q=1),匹配点之间的最大距离(如果q=Inf),并在总体之间q第顺序平均(即1/q次方q次方的总和)的距离匹配点。匹配点之间的距离是欧氏距离的价值cutoff切断。

The parameter type controls the behaviour of the algorithm if the cardinalities of the point patterns are different. For the type "spa" (subpattern assignment) the subpattern of the point pattern with the larger cardinality n that is closest to the point pattern with the smaller cardinality m is determined; then the q-th order average is taken over n values: the m distances of matched points and n-m "penalty distances" of value cutoff for the unmatched points. For the type "ace" (assignment only if  cardinalities equal) the matching is empty and the distance returned is equal to cutoff if the cardinalities differ. For the type "mat" (mass transfer) each point pattern is assumed to have total mass m (= the smaller cardinality) distributed evenly among its points; the algorithm finds then the "mass transfer plan" that minimizes the q-th order weighted average of the distances, where  the weights are given by the transferred mass divided by m. The result is a fractional matching (each match of two points has a weight in (0,1])  with the minimized quantity as the associated distance.
参数type的算法控制的行为,如果是不同的点图案的基数。对于类型"spa"(分配)的子模式的子模式的点图案与较大的基数n]是最近的点图案与较小的基数m被确定,然后q阶平均被接管n值m的匹配点的距离和n-m“惩罚距离”的值cutoff的匹配点。如果基数等于类型"ace"(分配)的匹配是空的,,如果基数不同,返回的距离等于cutoff。对于类型"mat"(传质)的每个点图案被假定为具有总质量m(=的小基数)均匀分布的点之间,然后该算法发现“传质计划”,最小的q-阶加权平均的距离,其中权重由下式给出传送的质量除以m。其结果是一个分数匹配(两个点的每一个匹配具有重量在(0,1]),作为相关联的距离最小化的数量。

The computations for all three types rely heavily on a specialized primal-dual algorithm (described in Luenberger (2003), Section 5.9) for Hitchcock's problem of optimal transport of a product from a number of suppliers to a number of (e.g. vending) locations. The C implementation used by default can handle patterns with a few hundreds of points, but should not be used with thousands of points. By setting show.rprimal = TRUE, some insight in the working of the algorithm can be gained.
所有这三种类型的计算依靠大量上一个专门的原 - 对偶算法(卢恩伯格(2003年),第5.9节中描述的)希区柯克的问题的最佳运输的产品从一个数一个数的(例如,自动售货机)位置的供应商。默认情况下所使用的C语言实现可以处理与几百点的模式,但不应该被使用数千点。通过设置show.rprimal = TRUE,一些有识之士的算法的工作可以取得了。

For moderate and large values of q there can be numerical issues based on the fact that the q-th powers of distances are taken and some positive values enter the optimization algorithm as zeroes because they are too small in comparison with the larger values. In this case the number of zeroes introduced is given in a warning message, and it is possible then that the matching obtained is not optimal and the associated distance is only a strict upper bound of the true distance. As a general guideline (which can be very wrong in special situations) a small number of zeroes (up to about 50 percent of the smaller point pattern cardinality m) usually still results in the right matching, and the number can even be quite a bit higher and usually still provides a highly accurate upper bound for the distance. These numerical problems can be reduced by enforcing (much slower) R code via the  argument ccode = FALSE.
q对于中度和大的值q-次方的距离采取一些积极的值输入的优化算法作为零的事实的基础上可以有数值的问题,因为它们是太小比较具有较大的值。在这种情况下,引入的零的数目是给定的警告消息中,它是可能的,那么,所得的匹配是不是最佳的,相关联的距离仅是一个严格的上限,绑定的真实距离。作为一般指引(在特殊情况下,这是非常错误的)零(少数的小点图案基数m)通常仍然在正确的匹配结果,约50%的数量甚至可以是相当高一点,通常还提供了一个高度精确的上界的距离。这些数值的问题,可以减少的R代码执行(很慢)通过参数ccode = FALSE。

For q = Inf there is no fast algorithm available, which is why approximation is normally used: for finding the optimal matching, q is set to the value of approximation. The resulting distance is still given as the maximum rather than the q-th order average in the corresponding distance computation. If approximation = Inf, approximation is suppressed and a very inefficient exhaustive search for the best matching is performed.
对于q = Inf有没有可用的快速算法,这就是为什么通常使用近似:寻找最优匹配,q被设置为approximation的值。将得到的距离仍是给出q-阶平均在相应的距离计算的,而不是作为最大。如果approximation = Inf,近似抑制,一个非常低效的穷举搜索的最佳匹配。

The value of precision should normally not be supplied by the user. If ccode = TRUE, this value is preset to the highest exponent of 10 that the C code still can handle (usually 9). If ccode = FALSE, the value is preset according to q (usually 15 if q is small), which can sometimes be changed to obtain less severe warning messages.
通常不应由用户提供的价值precision。如果ccode = TRUE,这个值是预设的最高指数10,仍然可以处理的C代码(通常是9)。如果ccode = FALSE,值是预先设定的根据q(通常是15如果q小),有时可以改变,以获得较严重的警告消息。


值----------Value----------

Normally an object of class pppmatching that contains detailed information about the parameters used and the resulting distance. See pppmatching.object for details. If matching = FALSE, only the numerical value of the distance is returned.
通常一个对象的类pppmatching的包含所使用的参数的详细信息和确定的距离。见pppmatching.object的详细信息。如果matching = FALSE,只有数值返回的距离。


(作者)----------Author(s)----------



Dominic Schuhmacher
<a href="mailto:dominic.schuhmacher@stat.unibe.ch">dominic.schuhmacher@stat.unibe.ch</a>
<a href="http://www.dominic.schuhmacher.name">http://www.dominic.schuhmacher.name</a>




参考文献----------References----------

The distribution of a product from several sources to numerous localities. J. Math. Physics 20, 224&ndash;230.
Second edition. Kluwer.
A new metric between distributions of point processes. Advances in Applied Probability 40, 651&ndash;672
A consistent metric for performance evaluation of multi-object filters. IEEE Transactions on Signal Processing 56, 3447&ndash;3457.

参见----------See Also----------

pppmatching.object matchingdist
pppmatching.objectmatchingdist


实例----------Examples----------


  # equal cardinalities[等于基数]
  X <- runifpoint(100)
  Y <- runifpoint(100)
  m <- pppdist(X, Y)
  m
  ## Not run: [#不运行:]
  plot(m)
  
## End(Not run)[#(不执行)]
  
  # differing cardinalities[不同的基数]
  X <- runifpoint(14)
  Y <- runifpoint(10)
  m1 <- pppdist(X, Y, type="spa")
  m2 <- pppdist(X, Y, type="ace")
  m3 <- pppdist(X, Y, type="mat")
  summary(m1)
  summary(m2)
  summary(m3)
  ## Not run: [#不运行:]
  m1$matrix
  m2$matrix
  m3$matrix
  
## End(Not run)[#(不执行)]

  # q = Inf[Q =天道酬勤]
  X <- runifpoint(10)
  Y <- runifpoint(10)
  mx1 <- pppdist(X, Y, q=Inf)$matrix
  mx2 <- pppdist(X, Y, q=Inf, ccode=FALSE, approximation=50)$matrix
  mx3 <- pppdist(X, Y, q=Inf, approximation=Inf)$matrix
  ((mx1 == mx2) &amp;&amp; (mx2 == mx3))
       # TRUE if approximations are good[TRUE,如果近似好]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-16 16:32 , Processed in 0.033400 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表