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

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

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

                                        Spatial weights for neighbours lists
                                         空间权重的邻居列表

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

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

The function supplements a neighbours list with spatial weights for the chosen coding scheme.
一个邻居列表的功能补充的空间权重选择的编码方案。


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


nb2listw(neighbours, glist=NULL, style="W", zero.policy=NULL)



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

参数:neighbours
an object of class nb
一个对象的类nb


参数:glist
list of general weights corresponding to neighbours
一般的权重对应的邻居列表


参数:style
style can take values “W”, “B”, “C”, “U”, “minmax” and “S”
style值“W”,“B”,“C”,“U”,“最小最大”和“S”


参数:zero.policy
default NULL, use global option value; if FALSE stop with error for any empty neighbour sets, if TRUE permit the weights list to be formed with zero-length weights vectors
默认为空,使用全局选项的值,如果为FALSE停止错误任何空的邻居集,如果真要形成与长度为零的权重向量允许的权重列表


Details

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

Starting from a binary neighbours list, in which regions are either listed as neighbours or are absent (thus not in the set of neighbours for some definition), the function adds a weights list with values given by the coding scheme style chosen. B is the basic binary coding, W is row standardised (sums over all links to n), C is globally standardised (sums over all links to n), U is equal to C divided by the number of neighbours (sums over all links to unity), while S is the variance-stabilizing coding scheme proposed by Tiefelsdorf et al. 1999, p. 167-168 (sums over all links to n).
开始,在哪些区域被列为邻居或不存在(因此不是集合中的一些定义的邻居),从一个二进制邻居列表中值的编码方案,风格选择的功能增加了一个砝码列表。 B是基本的二进制编码,W是行标准(总结以上所有链接到n),C是全球统一的(求和的所有链接到n),U等于C的邻居数除以(金额以上的所有链接统一),而S是的方差稳定的编码方案提出的Tiefelsdorf等。 1999年,p。 167-168(链接到n的所有款项)。

If zero policy is set to TRUE, weights vectors of zero length are inserted for regions without neighbour in the neighbours list. These will in turn generate lag values of zero, equivalent to the sum of products of the zero row t(rep(0, length=length(neighbours))) %*% x, for arbitraty numerical vector x of length length(neighbours). The spatially lagged value of x for the zero-neighbour region will then be zero, which may (or may not) be a sensible choice.
如果为零策略设置为TRUE,权重向量的长度为零的区域没有邻居的邻居列表中插入。这些都将进而产生滞后值为零,相当于零行的总和的产品t(rep(0, length=length(neighbours))) %*% x,为arbitraty的数值向量x长度length(neighbours)。零邻域空间的x的滞后值将为零,这可能会(也可能不会)是一个明智的选择。

If the sum of the glist vector for one or more observations is zero, a warning message is issued. The consequence for later operations will be the same as if no-neighbour observations were present and the zero.policy argument set to true.
如果一个或多个观察的glist向量的总和是零,发出一条警告消息。为以后的操作的结果将是相同的,如果没有邻居的观察和zero.policy的参数设置为true。

The “minmax” style is based on Kelejian and Prucha (2010), and divides the weights by the minimum of the maximum row sums and maximum column sums of the input weights. It is similar to the C and U styles; it is also available in Stata.
“最小最大”风格的基础上Kelejian和Prucha(2010),和行的最大金额和最大列和输入权重的最小分的权重。这是一个类似的C和U的风格,它也可在Stata。


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

A listw object with the following members:
Alistw对象具有下列成员:


参数:style
one of W, B, C, U, S, minmax as above
W,B,C,U,S,极大极小的任意一个如上


参数:neighbours
the input neighbours list
输入的邻居列表


参数:weights
the weights for the neighbours and chosen style, with attributes set to report the type of relationships (binary or general, if general the form of the glist argument), and style as above
的权重为邻居和挑选的风格,属性设置报告类型的关系(二进制的或一般的,如果一般的glist参数的形式),和风格如上


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


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



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

<h3>See Also</h3>

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


example(columbus)
coords <- coordinates(columbus)
cards <- card(col.gal.nb)
col.w <- nb2listw(col.gal.nb)
plot(cards, unlist(lapply(col.w$weights, sum)),xlim=c(0,10),
ylim=c(0,10), xlab="number of links", ylab="row sums of weights")
col.b <- nb2listw(col.gal.nb, style="B")
points(cards, unlist(lapply(col.b$weights, sum)), col="red")
col.c <- nb2listw(col.gal.nb, style="C")
points(cards, unlist(lapply(col.c$weights, sum)), col="green")
col.u <- nb2listw(col.gal.nb, style="U")
points(cards, unlist(lapply(col.u$weights, sum)), col="orange")
col.s <- nb2listw(col.gal.nb, style="S")
points(cards, unlist(lapply(col.s$weights, sum)), col="blue")
legend(x=c(0, 1), y=c(7, 9), legend=c("W", "B", "C", "U", "S"),
col=c("black", "red", "green", "orange", "blue"), pch=rep(1,5))
summary(nb2listw(col.gal.nb, style="minmax"))
dlist <- nbdists(col.gal.nb, coords)
dlist <- lapply(dlist, function(x) 1/x)
col.w.d <- nb2listw(col.gal.nb, glist=dlist)
summary(unlist(col.w$weights))
summary(unlist(col.w.d$weights))
# introducing other conditions into weights - only earlier sales count[其他条件重量 - 只有早期的销售数]
# see http://sal.uiuc.edu/pipermail/openspace/2005-October/000610.html[看到http://sal.uiuc.edu/pipermail/openspace/2005-October/000610.html]
data(baltimore)
set.seed(211)
dates <- sample(1:500, nrow(baltimore), replace=TRUE)
nb_15nn <- knn2nb(knearneigh(cbind(baltimore$X, baltimore$Y), k=15))
glist <- vector(mode="list", length=length(nb_15nn))
for (i in seq(along=nb_15nn))
  glist[[i]] <- ifelse(dates[i] > dates[nb_15nn[[i]]], 1, 0)
listw_15nn_dates <- nb2listw(nb_15nn, glist=glist, style="B")
which(lag(listw_15nn_dates, baltimore$PRICE) == 0.0)
which(sapply(glist, sum) == 0)
ex <- which(sapply(glist, sum) == 0)[1]
dates[ex]
dates[nb_15nn[[ex]]]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-18 01:43 , Processed in 0.026125 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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