nndist(spatstat)
nndist()所属R语言包:spatstat
Nearest neighbour distances
最近邻距离
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes the distance from each point to its nearest neighbour in a point pattern. Alternatively computes the distance to the second nearest neighbour, or third nearest, etc.
计算每个点的距离其最近的邻居在点模式。或者计算的距离,所述第二近邻,或第三最近等
用法----------Usage----------
nndist(X, ...)
## S3 method for class 'ppp'
nndist(X, ..., k=1, method="C")
## Default S3 method:
nndist(X, Y=NULL, ..., k=1, method="C")
参数----------Arguments----------
参数:X,Y
Arguments specifying the locations of a set of points. For nndist.ppp, the argument X should be a point pattern (object of class "ppp"). For nndist.default, typically X and Y would be numeric vectors of equal length. Alternatively Y may be omitted and X may be a list with two components x and y, or a matrix with two columns.
指定的位置的一组点的引数。 nndist.ppp,参数X应该是一个点模式(类的对象"ppp"“)。对于nndist.default,通常X和Y将数字向量的长度相等。或者Y可以省略,并且X可以是带有两个组件的列表x和y,或一个具有两列的矩阵。
参数:...
Ignored by nndist.ppp and nndist.default.
忽略nndist.ppp和nndist.default。
参数:k
Integer, or integer vector. The algorithm will compute the distance to the kth nearest neighbour.
整数或整数向量。该算法计算距离的的k日最近的邻居。
参数:method
String specifying which method of calculation to use. Values are "C" and "interpreted".
字符串,用于指定使用的计算方法。值是"C"和"interpreted"。
Details
详细信息----------Details----------
This function computes the Euclidean distance from each point in a point pattern to its nearest neighbour (the nearest other point of the pattern). If k is specified, it computes the distance to the kth nearest neighbour.
该函数计算其近邻(最接近的其他点的图案)的点图案中的每个点的欧几里得距离。如果k指定,计算距离的的k日最近的邻居。
The function nndist is generic, with a method for point patterns (objects of class "ppp"), and a default method for coordinate vectors. There is also a method for line segment patterns, nndist.psp.
的功能nndist是通用的,与点图案的方法(类"ppp"),以及一个默认的坐标向量的方法的对象。还设有一个线段图案的方法,nndist.psp。
The method for point patterns expects a single point pattern argument X and returns the vector of its nearest neighbour distances.
点模式的方法,预计单点模式的话,X和返回其近邻距离矢量。
The default method expects that X and Y will determine the coordinates of a set of points. Typically X and Y would be numeric vectors of equal length. Alternatively Y may be omitted and X may be a list with two components named x and y, or a matrix or data frame with two columns.
默认的方法,希望这X和Y将确定一组点的坐标。通常情况下X和Y将数字向量的长度相等。或者Y可以省略,并且X可能是一个名为x和y,或具有两列的矩阵或数据框的两个组件列表。
The argument k may be a single integer, or an integer vector. If it is a vector, then the kth nearest neighbour distances are computed for each value of k specified in the vector.
参数k可能是一个整数或整数向量。如果它是一个向量,然后k个近邻距离k向量中指定的每个值的计算。
The argument method is not normally used. It is retained only for checking the validity of the software. If method = "interpreted" then the distances are computed using interpreted R code only. If method="C" (the default) then C code is used. The C code is faster by two to three orders of magnitude and uses much less memory.
参数method不能正常使用。它只会保留检查的软件的有效性。如果method = "interpreted"的距离计算仅使用解释R代码。如果method="C"(默认值),那么C代码使用。 C代码由两到三个数量级,速度更快,占用更少的内存。
If there is only one point (if x has length 1), then a nearest neighbour distance of Inf is returned. If there are no points (if x has length zero) a numeric vector of length zero is returned.
如果只有一个点(如果x具有长度为1),那么一个近邻距离Inf被返回。如果没有点(如果x长度为零的)返回长度为零的一个数值向量。
To identify which point is the nearest neighbour of a given point, use nnwhich.
要确定哪个点是一个给定的点最近的邻居,使用nnwhich。
To use the nearest neighbour distances for statistical inference, it is often advisable to use the edge-corrected empirical distribution, computed by Gest.
要使用统计推断的距离最近的邻居,是经常建议使用边缘校正的经验分布,计算出Gest。
To find the nearest neighbour distances from one point pattern to another point pattern, use nncross.
要找到距离最近的邻居模式从一个点到另一个点的模式,使用nncross。
值----------Value----------
Numeric vector or matrix containing the nearest neighbour distances for each point.
包含近邻的每个点的距离的数值向量或矩阵。
If k = 1 (the default), the return value is a numeric vector v such that v[i] is the nearest neighbour distance for the ith data point.
如果k = 1(默认值),则返回值是一个数值向量v这样v[i]的i个数据点的距离是最近的邻居。
If k is a single integer, then the return value is a numeric vector v such that v[i] is the kth nearest neighbour distance for the ith data point.
如果k是一个整数,则返回值是一个数值向量v等v[i]是k日的最近邻距离i日数据点。
If k is a vector, then the return value is a matrix m such that m[i,j] is the k[j]th nearest neighbour distance for the ith data point.
如果k是一个向量,则返回值是一个矩阵m等m[i,j]是k[j]日最近的邻居i个数据点的距离。
警告----------Warnings----------
An infinite or NA value is returned if the distance is not defined (e.g. if there is only one point in the point pattern).
的无限NA返回值,如果没有被定义的距离(例如,如果只有一个点在点模式)。
(作者)----------Author(s)----------
Pavel Grabarnik
<a href="mailto:pavel.grabar@issp.serpukhov.su">pavel.grabar@issp.serpukhov.su</a>
and
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
参见----------See Also----------
nndist.psp, pairdist, Gest, nnwhich, nncross.
nndist.psp,pairdist,Gest,nnwhich,nncross。
实例----------Examples----------
data(cells)
# nearest neighbours[最近的邻居]
d <- nndist(cells)
# second nearest neighbours[次近邻]
d2 <- nndist(cells, k=2)
# first, second and third nearest[第一,第二和第三最近]
d1to3 <- nndist(cells, k=1:3)
x <- runif(100)
y <- runif(100)
d <- nndist(x, y)
# Stienen diagram[Stienen图]
plot(cells %mark% (nndist(cells)/2), markscale=1)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|