nb2blocknb(spdep)
nb2blocknb()所属R语言包:spdep
Block up neighbour list for location-less observations
座的邻居列表中的位置的观察
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function blocks up a neighbour list for know spatial locations to create a new neighbour list for multiple location-less observations know to belong to the spatial locations, using the identification tags of the locations as the key.
知道空间的位置,以便建立一个新的邻居列表中的多个位置的观测了一个邻居列表的功能块知道属于到的空间的位置,使用的位置的识别标记作为密钥。
用法----------Usage----------
nb2blocknb(nb, ID, row.names = NULL)
参数----------Arguments----------
参数:nb
an object of class nb with a list of integer vectors containing neighbour region number ids
对象的列表,的类nb的整数向量含有邻域的id
参数:ID
identification tags of the locations for the location-less observations; sort(unique(as.character(ID))) must be identical to sort(as.character(attr(nb, "region.id"))); same length as row.names if provided.
识别标签的位置观察的位置,“sort(unique(as.character(ID)))必须是相同的sort(as.character(attr(nb, "region.id")));相同的长度,row.names。
参数:row.names
character vector of observation ids to be added to the neighbours list as attribute region.id, default seq(1, nrow(x)); same length as ID if provided.
观察IDS矢量字符被添加到属性region.id,默认seq(1, nrow(x));相同长度的邻居列表ID。
Details
详细信息----------Details----------
Assume that there is a list of unique locations, then a neighbour list can build for that, to create an input neighbour list. This needs to be "unfolded", so that observations belonging to each unique location are observation neighbours, and observations belonging to the location neighbours of the unique location in question are also observation neighbours, finally removing the observation itself (because it should not be its own neighbour). This scenario also arises when say only post codes are available, and some post codes contain multiple observations, where all that is known is that they belong to a specific post code, not where they are located within it (given that the post code locations are known).
假设有一个独特的位置的列表,然后可以建立一个邻居列表是,创建一个输入的邻居列表。这需要被“展开”,使观测属于每个独特位置的观察邻居,和观测属于有问题的独特的位置的位置的邻居也观察邻居,最后除去观察本身(因为它不应该是它自己的邻居)。这种情况也时说,只有POST代码,一些职位代码包含多个观测值,其中所知道的是,他们都属于一个特定的职位代码,而不是它们的所在位置内(后的代码的位置是已知的)。
值----------Value----------
The function returns an object of class nb with a list of integer vectors containing neighbour observation number ids.
该函数返回一个类的对象nb整数向量的邻居观察IDS的列表。
(作者)----------Author(s)----------
Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参见----------See Also----------
knn2nb, dnearneigh, cell2nb, tri2nb, poly2nb
knn2nb,dnearneigh,cell2nb,tri2nb,poly2nb
实例----------Examples----------
## Not run: [#不运行:]
data(boston)
summary(as.vector(table(boston.c$TOWN)))
townaggr <- aggregate(boston.utm, list(town=boston.c$TOWN), mean)
block.rel <- graph2nb(relativeneigh(as.matrix(townaggr[,2:3])),
as.character(townaggr[,1]), sym=TRUE)
block.rel
print(is.symmetric.nb(block.rel))
plot(block.rel, as.matrix(townaggr[,2:3]))
points(boston.utm, pch=18, col="lightgreen")
block.nb <- nb2blocknb(block.rel, as.character(boston.c$TOWN))
block.nb
print(is.symmetric.nb(block.nb))
plot(block.nb, boston.utm)
points(boston.utm, pch=18, col="lightgreen")
moran.test(boston.c$CMEDV, nb2listw(boston.soi))
moran.test(boston.c$CMEDV, nb2listw(block.nb))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|