lm.morantest(spdep)
lm.morantest()所属R语言包:spdep
Moran's I test for residual spatial autocorrelation
莫兰的剩余空间自相关测试
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Moran's I test for spatial autocorrelation in residuals from an estimated linear model (lm()). The helper function listw2U() constructs a weights list object corresponding to the sparse matrix 1/2 (W + W')
莫兰是我估计的线性模型的残差(lm()),空间自相关测试。辅助函数listw2U()构造了一个权重列表对象对应的稀疏矩阵1/2 (W + W')
用法----------Usage----------
lm.morantest(model, listw, zero.policy=NULL, alternative = "greater",
spChk=NULL, resfun=weighted.residuals, naSubset=TRUE)
listw2U(listw)
参数----------Arguments----------
参数:model
an object of class lm returned by lm; weights may be specified in the lm fit, but offsets should not be used
类的一个对象lm返回lm;权重可以指定lm适合,但偏移量不应该使用
参数:listw
a listw object created for example by nb2listw
例如创建一个listw对象的nb2listw
参数: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), "less" or "two.sided".
一个字符串,指定其他假设,必须是一个“大”(默认),“少”或“two.sided的”。
参数: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()
参数:resfun
default: weighted.residuals; the function to be used to extract residuals from the lm object, may be residuals, weighted.residuals, rstandard, or rstudent
默认:weighted.residuals要使用的函数提取残差lm对象,可能是residuals,weighted.residuals,rstandard或rstudent
参数:naSubset
default TRUE to subset listw object for omitted observations in model object (this is a change from earlier behaviour, when the model$na.action component was ignored, and the listw object had to be subsetted by hand)
默认TRUE的子集listw对象省略观测对象模型(这是一个变化,从早期的行为,model$na.action部分被忽略时,和的listw对象子集的手)
值----------Value----------
A list with class htest containing the following components:
列表类htest包含以下组件:
参数:statistic
the value of the standard deviate of Moran's I.
标准值的偏离,莫兰的一
参数:p.value
the p-value of the test.
的p值的测试。
参数:estimate
the value of the observed Moran's I, its expectation and variance under the method assumption.
所观察到的莫兰我的价值,期望和方差的方法假设下。
参数: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.
给予(s)的数据的名称的字符串。
注意----------Note----------
The examples also show how to use permutation bootstrap if desired.
的例子也表明如果需要的话,如何使用排列引导。
(作者)----------Author(s)----------
Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参考文献----------References----------
<h3>See Also</h3>
实例----------Examples----------
data(oldcol)
oldcrime1.lm <- lm(CRIME ~ 1, data = COL.OLD)
oldcrime.lm <- lm(CRIME ~ HOVAL + INC, data = COL.OLD)
lm.morantest(oldcrime.lm, nb2listw(COL.nb, style="W"))
lm.LMtests(oldcrime.lm, nb2listw(COL.nb, style="W"))
lm.morantest(oldcrime.lm, nb2listw(COL.nb, style="S"))
lm.morantest(oldcrime1.lm, nb2listw(COL.nb, style="W"))
moran.test(COL.OLD$CRIME, nb2listw(COL.nb, style="W"),
randomisation=FALSE)
oldcrime.wlm <- lm(CRIME ~ HOVAL + INC, data = COL.OLD,
weights = I(1/AREA))
lm.morantest(oldcrime.wlm, nb2listw(COL.nb, style="W"),
resfun=weighted.residuals)
lm.morantest(oldcrime.wlm, nb2listw(COL.nb, style="W"),
resfun=rstudent)
if (require(boot)) {
oldcrime.lmx <- lm(CRIME ~ HOVAL + INC, data = COL.OLD, x=TRUE)
listw <- nb2listw(COL.nb, style="W")
MoraneI.boot <- function(var, i, ...) {
var <- var[i]
lmres <- lm(var ~ oldcrime.lmx$x - 1)
return(moran(x=residuals(lmres), ...)$I)
}
boot1 <- boot(residuals(oldcrime.lmx), statistic=MoraneI.boot, R=499,
sim="permutation", listw=listw, n=length(listw$neighbours),
S0=Szero(listw))
zi <- (boot1$t0 - mean(boot1$t))/sqrt(var(boot1$t))
boot1
plot(boot1)
cat("Bootstrap permutation standard deviate:", zi, "\n\n")
lm.morantest(oldcrime.lm, nb2listw(COL.nb, style="W"))
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|