moran.mc(spdep)
moran.mc()所属R语言包:spdep
Permutation test for Moran's I statistic
莫兰我统计的置换测试
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A permutation test for Moran's I statistic calculated by using nsim random permutations of x for the given spatial weighting scheme, to establish the rank of the observed statistic in relation to the nsim simulated values. The examples show how boot(sim="permutation") can replicate this function (thanks to Virgilio G贸mez Rubio and the DCluster package).
莫兰我使用NSIM随机排列的x给定的空间权重方案,建立所观察到的有关模拟值NSIM统计排名统计计算置换的测试。以下示例显示了如何boot(sim="permutation")可以复制此功能(由于维尔吉利奥·戈麦斯卢比奥和DCluster的包)。
用法----------Usage----------
moran.mc(x, listw, nsim, zero.policy=NULL, alternative="greater",
na.action=na.fail, spChk=NULL, return_boot=FALSE)
参数----------Arguments----------
参数:x
a numeric vector the same length as the neighbours list in listw
一个数值向量相同的长度的邻居列表中listw
参数:listw
a listw object created for example by nb2listw
例如创建一个listw对象的nb2listw
参数:nsim
number of permutations
的排列数
参数:zero.policy
default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA
默认为空,请使用全局选项的值,如果真没有邻居的滞后值的区域分配了零,如果为FALSE分配NA
参数:alternative
a character string specifying the alternative hypothesis, must be one of "greater" (default), or "less".
一个字符串,指定其他假设,必须是一个“大”(默认),或“少”。
参数:na.action
a function (default na.fail), can also be na.omit or na.exclude - in these cases the weights list will be subsetted to remove NAs in the data. It may be necessary to set zero.policy to TRUE because this subsetting may create no-neighbour observations. Note that only weights lists created without using the glist argument to nb2listw may be subsetted. na.pass is not permitted because it is meaningless in a permutation test.
一个函数(默认na.fail),也可以是na.omit或na.exclude“ - 在这些情况下,将子集的权重列表中删除NAS的数据。这可能是必要的设置为TRUE zero.policy子集,因为这可能创建没有邻居观测。需要注意的是只重列表创建时没有使用的glist的参数nb2listw可能是子集。 na.pass是不允许的,因为它是没有意义的一种排列测试。
参数:spChk
should the data vector names be checked against the spatial objects for identity integrity, TRUE, or FALSE, default NULL to use get.spChkOption()
应的数据向量空间对象的名称进行核对身份完整性,TRUE,否则返回FALSE,默认为空,使用get.spChkOption()
参数:return_boot
return an object of class boot from the equivalent permutation bootstrap rather than an object of class htest
返回类的boot的等效置换引导,而不是一个对象类htest的对象
值----------Value----------
A list with class htest and mc.sim containing the following components:
列表类htest和mc.sim包含以下组件:
参数:statistic
the value of the observed Moran's I.
Moran的所观察到的一值
参数:parameter
the rank of the observed Moran's I.
排名所观察到的莫兰的一
参数:p.value
the pseudo p-value of the test.
伪p值的测试。
参数:alternative
a character string describing the alternative hypothesis.
一个字符串,描述了另一种假设。
参数:method
a character string giving the method used.
一个字符串提供的方法使用。
参数:data.name
a character string giving the name(s) of the data, and the number of simulations.
一个字符的字符串,给出的名称(s)的数据,并将模拟数量。
参数:res
nsim simulated values of statistic, final value is observed statistic
NSIM模拟的统计值,终值的观察统计
(作者)----------Author(s)----------
Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参考文献----------References----------
<h3>See Also</h3>
实例----------Examples----------
data(oldcol)
colw <- nb2listw(COL.nb, style="W")
nsim <- 99
set.seed(1234)
sim1 <- moran.mc(COL.OLD$CRIME, listw=colw, nsim=nsim)
sim1
mean(sim1$res[1:nsim])
var(sim1$res[1:nsim])
summary(sim1$res[1:nsim])
MoranI.boot <- function(var, i, ...) {
var <- var[i]
return(moran(x=var, ...)$I)
}
set.seed(1234)
library(boot)
boot1 <- boot(COL.OLD$CRIME, statistic=MoranI.boot, R=nsim,
sim="permutation", listw=colw, n=nrow(COL.OLD), S0=Szero(colw))
boot1
plot(boot1)
mean(boot1$t)
var(boot1$t)
summary(boot1$t)
colold.lags <- nblag(COL.nb, 3)
set.seed(1234)
sim2 <- moran.mc(COL.OLD$CRIME, nb2listw(colold.lags[[2]],
style="W"), nsim=nsim)
summary(sim2$res[1:nsim])
sim3 <- moran.mc(COL.OLD$CRIME, nb2listw(colold.lags[[3]],
style="W"), nsim=nsim)
summary(sim3$res[1:nsim])
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|