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

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

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

                                        K nearest neighbours for spatial weights
                                         K近邻的空间权重

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

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

The function returns a matrix with the indices of regions belonging to the set of the k nearest neighbours of each other. If longlat = TRUE, Great Circle distances are used.
该函数返回一个矩阵的指数集的k近邻,彼此的区域属于。如果longlat = TRUE,大圆距离使用。


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


knearneigh(x, k=1, longlat = NULL, RANN=TRUE)



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

参数:x
matrix of region point coordinates or a SpatialPoints object
区域点的坐标矩阵或SpatialPoints对象


参数:k
number of nearest neighbours to be returned
一些最近的邻居将返回


参数:longlat
TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers; if x is a SpatialPoints object, the value is taken from the object itself
TRUE,如果点坐标的经纬度小数度,在这种情况下,测量距离(公里),如果x是一个SpatialPoints,对象,对象本身的价值是从


参数:RANN
logical value, if the RANN package is available, use for finding k nearest neighbours when longlat is FALSE
逻辑值,如果兰恩包,使用时发现k近邻longlat是FALSE


Details

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

The underlying C code is based on the knn function in the class package in the VR bundle.
底层的C代码是基于knn功能在VR包中的类包。


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

A list of class knn
列表类knn


参数:nn
integer matrix of region number ids
整数矩阵的区域编号IDS


参数:np
number of input points
输入点的数


参数:k
input required k
输入所需K表


参数:dimension
number of columns of x
的x的列数


参数:x
input coordinates
输入坐标


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


Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>



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

knn, dnearneigh,
knn,dnearneigh,


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


example(columbus)
coords <- coordinates(columbus)
col.knn <- knearneigh(coords, k=4)
plot(columbus, border="grey")
plot(knn2nb(col.knn), coords, add=TRUE)
title(main="K nearest neighbours, k = 4")
data(state)
us48.fipsno <- read.geoda(system.file("etc/weights/us48.txt",
package="spdep")[1])
if (as.numeric(paste(version$major, version$minor, sep="")) < 19) {
m50.48 <- match(us48.fipsno$"State.name", state.name)
} else {
m50.48 <- match(us48.fipsno$"State_name", state.name)
}
xy <- as.matrix(as.data.frame(state.center))[m50.48,]
llk4.nb <- knn2nb(knearneigh(xy, k=4, longlat=FALSE))
gck4.nb <- knn2nb(knearneigh(xy, k=4, longlat=TRUE))
plot(llk4.nb, xy)
plot(diffnb(llk4.nb, gck4.nb), xy, add=TRUE, col="red", lty=2)
title(main="Differences between Euclidean and Great Circle k=4 neighbours")
summary(llk4.nb, xy, longlat=TRUE)
summary(gck4.nb, xy, longlat=TRUE)

xy1 <- SpatialPoints((as.data.frame(state.center))[m50.48,],
  proj4string=CRS("+proj=longlat"))
gck4a.nb <- knn2nb(knearneigh(xy1, k=4))
summary(gck4a.nb, xy1)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 21:45 , Processed in 0.022378 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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