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

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

[复制链接]
发表于 2012-2-25 21:45:31 | 显示全部楼层 |阅读模式
distancematrix(hopach)
distancematrix()所属R语言包:hopach

                                        functions to compute pair wise distances between vectors
                                         函数计算向量之间的距离成对

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

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

The function distancematrix is applied to a matrix of data to compute the pair wise distances between all rows of the matrix. In hopach versions >= 2.0.0 these distance functions are calculated in C, rather than R, to improve run time performance. function distancevector is applied to a matrix and a vector to compute the pair wise distances between each row of the matrix and  the vector. Both functions allow different choices of distance metric. The functions dissmatrix and dissvector allow one to  convert between a distance matrix and a vector of the upper triangle. The  function vectmatrix is used internally.
功能distancematrix被应用到的数据矩阵,计算矩阵的所有行之间的成对距离。在hopach版本> = 2.0.0这些距离函数计算在C,而比R,提高运行时性能。功能distancevector应用到矩阵和向量计算每行的矩阵和矢量之间的成对距离。这两个函数允许选择不同的距离度量。职能dissmatrix和dissvector“允许一个转换之间的距离矩阵和上三角向量。功能vectmatrix内部使用。


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


distancematrix(X, d, na.rm=TRUE)

distancevector(X, y, d, na.rm=TRUE)

dissmatrix(v)

dissvector(M)

vectmatrix(index, p)



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

参数:X
a numeric matrix. Missing values will be ignored if na.rm=TRUE.
数字矩阵。如果na.rm = TRUE,遗漏值将被忽略。


参数:y
a numeric vector, possibly a row of X. Missing values will be ignoredif na.rm=TRUE.
一个数值向量,可能将ignoredif na.rm = TRUE,一排十遗漏值。


参数:na.rm
an indicator of whether or not to remove missing values. If na.rm=TRUE (default), then distances are computed over all pairwise non-missing values. Else missing values are propagated through the distance computation.
是否删除遗漏值指标。如果na.rm = True(默认),则距离超过所有成对的非缺失值计算。遗漏值是其他传播通过的距离计算。


参数:d
character string specifying the metric to be used for calculating  dissimilarities between vectors. The currently available options are  "cosangle" (cosine angle or uncentered correlation distance), "abscosangle"  (absolute cosine angle or absolute uncentered correlation distance),  "euclid" (Euclidean distance), "abseuclid" (absolute Euclidean distance), "cor" (correlation distance), and "abscor" (absolute correlation distance). Advanced users can write their own distance functions and add these.
字符串指定的度量用于计算向量之间的异同。目前可用的选项是“cosangle”(余弦角或者非中心的相关距离),的“abscosangle”(绝对余弦角度或绝对非中心相关距离),“欧几里得”(欧氏距离),的“abseuclid”(绝对欧氏距离),“心病”(相关距离),和“abscor”(绝对相关距离)。高级用户可以编写自己的距离函数,并添加这些。


参数:M
a symmetric matrix of pair wise distances.
对称矩阵的成对距离。


参数:v
a vector of pair wise distances corresponding to the upper triangle of a distance matrix, stored by rows.
对相应的,按行存储的距离矩阵的上三角明智距离向量。


参数:index
index in a distance vector, like that returned by dissvector.
在距离向量的索引,返回这样的dissvector。


参数:p
number of elements, e.g. the number of rows in a distance matrix.
数量的元素,例如在距离矩阵的行数。


Details

详情----------Details----------

In hopach versions <2.0.0, these functions returned the square root of  the usual distance for d="cosangle", d="abscosangle",  d="cor", and d="abscor". Typically, this transformation makes the dissimilarity correspond more closely with the norm. In order to  agree with the dist function, the square root is no longer used  in versions >=2.0.0.
在hopach <2.0.0版本中,这些函数返回的平方根通常距离d="cosangle",d="abscosangle",d="cor",d="abscor"。通常情况下,这种转变使相异与规范,更加紧密地对应。以同意dist函数,> = 2.0.0版本中不再使用的平方根。


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

For versions >= 2.0.0 distancematrix, a hdist  object of of all pair wise distances between the rows of the data matrix 'X', i.e. the value of hdist[i,j] is the distance between rows 'i' and 'j' of 'X', as defined by 'd'.  A hdist object is an S4 class containing  four slots:
对于版本> = 2.0.0distancematrix,hdist对象的所有成对的数据矩阵“X”,即hdist[i,j]是距离值的行之间的距离行与行之间的我和J的X,D的定义。一个hdist对象是一个S4类包含四个插槽:


参数:Data
representing the lower triangle of the symmetric distance matrix.  
代表下三角对称的距离矩阵。


参数:Size
the number of objects (i.e. rows of the data  matrix).  
对象的数目(即行数据矩阵)。


参数:Labels
labels for the objects, usually the numbers 1 to  Size.  
标签为对象,通常是数字1的大小。


参数:Call
the distance used in the call to  distancematrix.         
使用调用distancematrix在距离。

A hdist object and can be converted to a matrix using as.matrix(hdist). (See hdist for more details.)
一个hdist对象和可以转换成一个矩阵使用as.matrix(hdist)。 (见hdist更多细节。)

For distancevector, a vector of all pair wise distances between rows of 'X' and the vector 'y'. Entry 'j' is the distance between row 'j' of 'X' and the vector 'y'.
distancevector,所有成对的X和Y向量的行之间的距离向量。项目J行J的X和Y向量之间的距离。

For distancevector, a vector of all pair wise distances between rows of 'X' and the vector 'y'. Entry 'j' is the distance between row 'j' of 'X' and the vector 'y'.
distancevector,所有成对的X和Y向量的行之间的距离向量。项目J行J的X和Y向量之间的距离。

For dissmatrix, the corresponding distance vector. For  dissvector, the corresponding distance matrix. If 'M' has 'p' rows (and columns), then 'v' is length 'p*(p-1)/2'.
对于dissmatrix,相应的距离向量。 dissvector,相应的距离矩阵。如果“M”“P”的行(列),然后V长P *(P-1)/ 2。

For vectmatrix, the indices of the row and column of a distance matrix corresponding to entry index in the corresponding  distance vector.
vectmatrix,相应的条目index在相应的距离向量的距离矩阵的行和列的指数。


警告----------Warning ----------

The  correlation and absolute correlation distance functions call the cor function, and will therefore fail if there are missing values in the data and na.rm!=TRUE.
的相关性和绝对的关系距离函数调用cor功能,所以会失败,如果有丢失= TRUE,数据和na.rm值。


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


Katherine S. Pollard &lt;kpollard@gladstone.ucsf.edu&gt; and Mark J. van der Laan &lt;laan@stat.berkeley.edu&gt;, with Greg Walll



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




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

hopach, correlationordering, disscosangle
hopach,correlationordering,disscosangle


举例----------Examples----------


mydata<-matrix(rnorm(50),nrow=10)
deuclid<-distancematrix(mydata,d="euclid")
# old method vdeuclid&lt;-dissvector(deuclid)[老的方法vdeuclid <-dissvector(deuclid)]
vdeuclid<-deuclid@Data
ddaisy<-daisy(mydata)
vdeuclid
ddaisy/sqrt(length(mydata[1,]))

d1<-distancematrix(mydata,d="abscosangle")
d2<-distancevector(mydata,mydata[1,],d="abscosangle")
d1[1,]
d2 #equal to d1[1,][等于D1 [1]]

# old method d3&lt;-dissvector(d1)[老方法D3 <dissvector(D1)]
d3<-d1@Data
pair<-vectmatrix(5,10)
d1[pair[1],pair[2]]
d3[5]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-6 04:12 , Processed in 0.026580 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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