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

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

[复制链接]
发表于 2012-9-30 12:22:32 | 显示全部楼层 |阅读模式
nearestdist(spam)
nearestdist()所属R语言包:spam

                                        Distance Matrix Computation
                                         距离矩阵的计算

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

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

This function computes and returns specific elements of distance matrix computed by
此函数计算并返回特定元素的距离矩阵计算


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


nearest.dist( x, y=NULL, method = "euclidean",
             delta = 1, upper = if (is.null(y)) FALSE else NULL,
             p=2, miles=TRUE, R=NULL,
             eps = NULL, diag = NULL)



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

参数:x
Matrix of first set of locations where each row gives the coordinates of a particular point. See also "Details".
矩阵的第一组,其中每一行给出一个特定的点的坐标的位置。另请参阅“详细信息”。


参数:y
Matrix of second set of locations where each row gives the coordinates of a particular point. If this is missing x is used. See also "Details".
矩阵的第二组,其中每一行给出一个特定的点的坐标的位置。如果缺少x使用。另请参阅“详细信息”。


参数:method
the distance measure to be used. This must be one of "euclidean", "maximum", "minkowski" or "greatcircle". Any unambiguous substring can be given.
要使用的距离测量。这必须是一个"euclidean","maximum","minkowski"或"greatcircle"。可以给任何明确的子串。


参数:delta
only distances smaller than delta are recorded, see Details.  
只距离小于delta记录,详细。


参数:upper
Should the entire matrix (NULL) or only the upper-triagonal (TRUE) or lower-triagonal (FALSE) values be calculated.  
如果整个矩阵(NULL)或仅上部triagonal(TRUE)或较低triagonal的(FALSE)值来计算。


参数:p
The power of the Minkowski distance.  
闵可夫斯基距离的力量。


参数:miles
For great circle distance: If true distances are in statute miles if false distances in kilometers.  
大圆距离:如果真正的距离是假公里的距离,如果在法定英里。


参数:R
For great circle distance: Radius to use for sphere to find spherical distances. If NULL the radius is either in miles or kilometers depending on the values of the miles argument. If R=1 then distances are of course in radians.
大圆距离:半径,使用领域找到球的距离。如果NULL半径英里或公里的里程参数的值。如果R=1然后距离是当然的弧度。


参数:eps
deprecated. Left for backwards consistency.  
过时了。左向后一致性。


参数:diag
deprecated. Left for backwards consistency. See "Details".  
过时了。左向后一致性。请参阅“详细信息”。


Details

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

For great circle distance, the by 2 matrices x and y contain the degrees longitudes in the first and the degrees latitudes in the second column. eps and delta are in degrees. Hence to restrict to distances smaller than delta.km, one has to specify delta=delta.km*360/(6378.388*2*pi).
大圆距离,×2矩阵x和y包含的程度在第一和度在第二列中的纬度经度。 eps和delta度。因此,要限制距离小于delta.km的,一个到指定delta=delta.km*360/(6378.388*2*pi)。

The distance is in single precision (I am still not sure where I lose the double precision in the Fortran code) and if calculating the entire matrix upper=NULL (instead of adding its transpose) it may not pass the symmetry checks, for example.<br>
距离在单精度(我现在还不能确定,我失去了双精度的Fortran代码),如果计算整个矩阵upper=NULL(而不是增加其转)它可以不通过的对称性检查,例如,<BR>

Default value of Earth's radius is 3963.34miles (6378.388km).<br>
地球半径的默认值是3963.34英里(6378.388公里)。<BR>

The arguments eps and diag do not have any effect and are left for compatibility reasons.
的参数eps和diag不产生任何影响,并留下兼容性的原因。

x and y can be any object with an existing as.matrix method.<br>
x和y可以是任何对象与现有的as.matrix方法。<BR>

A quick scan revealed distance functions in at least 7 packages (around 2008). The argument names should be as general as possible and be coherent with many (but not all) available distance functions.<br>
快速扫描显示,至少有7包(约2008年)的距离函数。参数的名称应该是尽可能通用,并与许多(但不是全部)的距离函数是一致的。<BR>

The Fortran code is based on a idea of Doug Nychka.
Fortran代码是基于一个道格Nychka的想法。


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

A spam object containing the distances spanned between zero and delta. The sparse matrix may contain many zeros (e.g., collocated data). However, to calculate covariances, these zeros
Aspam对象,它包含跨越的距离之间的零和delta。稀疏矩阵可能包含许多零(例如,同位数据)。然而,计算协方差,这些零


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


Reinhard Furrer



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


# Note that upper=T and using t(X)+X is quicker than upper=NULL;[需要注意的是上= T和T(X)+ X速度比上= NULL;]
#     upper=T marginally slower than upper=F.[上稍微慢上= F = T]

# To compare nearest.dist with dist, use diag=FALSE, upper=TRUE[比较nearest.dist区,请使用diag = FALSE,上= TRUE]
nx <- 4
x <- expand.grid(as.double(1:nx),as.double(1:nx))
sum( (nearest.dist( x, delta=nx*2, diag=FALSE, upper=TRUE)@entries-
              c(dist(x)))^2)

# Create nearest neighbor structures:[创建最近的邻居结构:]
par(mfcol=c(1,2))
x <- expand.grid(1:nx,12*nx))
display( nearest.dist( x, delta=1))
x <- expand.grid(12*nx),1:nx)
display( nearest.dist( x, delta=1))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-9 22:01 , Processed in 0.021805 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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