# \donttest{
rho <- c(0.2, 0.5, 0.95, 0.999, 1.0)
ns <- c(5, 7, 9, 11, 13, 15, 17, 19)
mns <- matrix(0, nrow=length(ns), ncol=length(rho))
rownames(mns) <- ns
colnames(mns) <- rho
mxs <- matrix(0, nrow=length(ns), ncol=length(rho))
rownames(mxs) <- ns
colnames(mxs) <- rho
for (i in 1:length(ns)) {
nblist <- cell2nb(ns[i], ns[i])
nbdropped <- droplinks(nblist, ((ns[i]*ns[i])+1)/2, sym=FALSE)
listw <- nb2listw(nbdropped, style="W", zero.policy=TRUE)
wmat <- listw2mat(listw)
for (j in 1:length(rho)) {
mat <- diag(ns[i]*ns[i]) - rho[j] * wmat
res <- diag(solve(t(mat) %*% mat))
mns[i,j] <- mean(res)
mxs[i,j] <- max(res)
}
}
print(mns)
print(mxs)
# }
Run the code above in your browser using DataLab