invIrM(spdep)
invIrM()所属R语言包:spdep
Compute SAR generating operator
计算SAR产生运营商
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes the matrix used for generating simultaneous autoregressive random variables, for a given value of rho, a neighbours list object, a chosen coding scheme style, and optionally a list of general weights corresponding to neighbours.
计算所使用的矩阵,用于产生同时自回归的随机变量,对于一个给定的值,rho沸石,一个邻居列表对象,编码方案选择样式,和任选的一般的权重对应的邻居列表。
用法----------Usage----------
invIrM(neighbours, rho, glist=NULL, style="W", method="solve",
feasible=NULL)
invIrW(listw, rho, method="solve", feasible=NULL)
powerWeights(W, rho, order=250, X, tol=.Machine$double.eps^(3/5))
参数----------Arguments----------
参数:neighbours
an object of class nb
一个对象的类nb
参数:rho
autoregressive parameter
自回归参数
参数:glist
list of general weights corresponding to neighbours
一般的权重对应的邻居列表
参数:style
style can take values W, B, C, and S
style可以采取的值W,B,C,和S的
参数:method
default solve, can also take value chol
默认情况下solve,也可以采取值chol
参数:feasible
if NULL, the given value of rho is checked to see if it lies within its feasible range, if TRUE, the test is not conducted
如果为NULL,给定值的Rho检查,看它是否是在可行范围内,如果是真的,测试进行
参数:listw
a listw object from for example nb2listw
一个listw的对象例如nb2listw
参数:W
A spatial weights matrix (either a dense matrix or a CsparseMatrix)
空间权重矩阵(无论是密集的矩阵或CsparseMatrix的)
参数:order
Power series maximum limit
电源系列最高限额
参数:X
A numerical matrix
一个数值矩阵
参数:tol
Tolerance for convergence of power series
幂级数的收敛公差
Details
详细信息----------Details----------
The invIrW function generates the full weights matrix V, checks that rho lies in its feasible range between 1/min(eigen(V)) and 1/max(eigen(V)), and returns the nxn inverted matrix
invIrW函数生成的全部权重矩阵V,支票,rho沸石是在其之间的可行范围1/min(本征(V))和1/max(本征(Ⅴ)),并返回nxn的逆矩阵
. With method=“chol”, Cholesky decomposition is used, thanks to contributed code by Markus Reder and Werner Mueller.
。使用方法=“哲”,Cholesky分解,这要归功于贡献的代码由马库斯·REDER的维尔纳·米勒。
The powerWeights function uses power series summation to cumulate the product
powerWeights功能使用幂级数求和来累积的产品
from
从
, which can be done by storing only sparse V and several matrices of the same dimensions as X. This makes it possible to handle larger spatial weights matrices.
,这可以通过只存储稀疏V和多个作为X的相同的尺寸,这使得能够处理较大的空间权重矩阵的矩阵。
值----------Value----------
An nxn matrix with a "call" attribute; the powerWeights function returns a matrix of the same dimensions as X which has been multipled by the power series equivalent of the dense matrix
nxn矩阵“呼叫”属性;powerWeights函数返回已乘以电源串联等效的密集矩阵的矩阵的相同的尺寸为X
.
。
(作者)----------Author(s)----------
Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参考文献----------References----------
<h3>See Also</h3>
实例----------Examples----------
nb7rt <- cell2nb(7, 7, torus=TRUE)
set.seed(1)
x <- matrix(rnorm(500*length(nb7rt)), nrow=length(nb7rt))
res0 <- apply(invIrM(nb7rt, rho=0.0, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
res2 <- apply(invIrM(nb7rt, rho=0.2, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
res4 <- apply(invIrM(nb7rt, rho=0.4, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
res6 <- apply(invIrM(nb7rt, rho=0.6, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
res8 <- apply(invIrM(nb7rt, rho=0.8, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
res9 <- apply(invIrM(nb7rt, rho=0.9, method="chol",
feasible=TRUE) %*% x, 2, function(x) var(x)/length(x))
plot(density(res9), col="red", xlim=c(-0.01, max(density(res9)$x)),
ylim=range(density(res0)$y),
xlab="estimated variance of the mean",
main=expression(paste("Effects of spatial autocorrelation for different ",
rho, " values")))
lines(density(res0), col="black")
lines(density(res2), col="brown")
lines(density(res4), col="green")
lines(density(res6), col="orange")
lines(density(res8), col="pink")
legend(c(-0.02, 0.01), c(7, 25),
legend=c("0.0", "0.2", "0.4", "0.6", "0.8", "0.9"),
col=c("black", "brown", "green", "orange", "pink", "red"), lty=1, bty="n")
## Not run: [#不运行:]
x <- matrix(rnorm(length(nb7rt)), ncol=1)
system.time(e <- invIrM(nb7rt, rho=0.9, method="chol", feasible=TRUE) %*% x)
system.time(e <- invIrM(nb7rt, rho=0.9, method="chol", feasible=NULL) %*% x)
system.time(e <- invIrM(nb7rt, rho=0.9, method="solve", feasible=TRUE) %*% x)
system.time(e <- invIrM(nb7rt, rho=0.9, method="solve", feasible=NULL) %*% x)
W <- as(as_dgRMatrix_listw(nb2listw(nb7rt)), "CsparseMatrix")
system.time(ee <- powerWeights(W, rho=0.9, X=x))
all.equal(e, as(ee, "matrix"), check.attributes=FALSE)
nb60rt <- cell2nb(60, 60, torus=TRUE)
W <- as(as_dgRMatrix_listw(nb2listw(nb60rt)), "CsparseMatrix")
set.seed(1)
x <- matrix(rnorm(dim(W)[1]), ncol=1)
system.time(ee <- powerWeights(W, rho=0.3, X=x))
str(as(ee, "matrix"))
obj <- errorsarlm(as(ee, "matrix")[,1] ~ 1, listw=nb2listw(nb60rt), method="Matrix")
coefficients(obj)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|