lextrB: Find extreme eigenvalues of binary symmetric spatial weights

Description Usage Arguments Value Control arguments Note Author(s) References Examples

View source: R/lextrB.R

Description

The functions find extreme eigenvalues of binary symmetric spatial weights, when these form planar graphs; general weights are not permiited. l_max finds the largest eigenvalue using Rayleigh quotient methods of any “listw” object. lextrB first calls l_max, and uses its output to find the smallest eigenvalue in addition for binary symmetric spatial weights. lextrW extends these to find the smallest eigenvalue for intrinsically symmetric row-standardized binary weights matrices (transformed to symmetric through similarity internally). lextrS does the same for variance-stabilized (“S” style) intrinsically symmetric binary weights matrices (transformed to symmetric through similarity internally).

Usage

1
2
3
4
lextrB(lw, zero.policy = TRUE, control = list())
lextrW(lw, zero.policy=TRUE, control=list())
lextrS(lw, zero.policy=TRUE, control=list())
l_max(lw, zero.policy=TRUE, control=list())

Arguments

lw

a binary symmetric listw object from, for example, nb2listw with style “B” for lextrB, style “W” for lextrW and style “S” for lextrS; for l_max, the object may be asymmetric and does not have to be binary

zero.policy

default NULL, use global option value; if TRUE assign zero to the lagged value of zones without neighbours, if FALSE assign NA

control

a list of control arguments

Value

The functions return approximations to the extreme eigenvalues with the eigenvectors returned as attributes of this object.

Control arguments

trace

report values in while loops, default NULL assuming FALSE; logical

tol

tolerance for breaking while loops, default .Machine$double.eps^(1/2); numeric

maxiter

maximum number of iterations in while loops, default 6 * (length(lw$neighbours) - 2; integer

useC

use C code, default TRUE, logical (not in l_max)

Note

It may be necessary to modify control arguments if warnings about lack of convergence are seen.

Author(s)

Roger Bivand, Yongwan Chun, Daniel Griffith

References

Griffith, D. A. (2004). Extreme eigenfunctions of adjacency matrices for planar graphs employed in spatial analyses. Linear Algebra and its Applications, 388:201<e2><80><93>219.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
data(boston)
ab.listb <- nb2listw(boston.soi, style="B")
er <- range(eigenw(ab.listb))
er
res_1 <- lextrB(ab.listb)
c(res_1)
#if (require(igraph)) {
#  B <- as(ab.listb, "symmetricMatrix")
#  n <- length(boston.soi)
#  f2 <- function(x, extra=NULL) {as.vector(B %*% x)}
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="LA", maxiter=200))
#  print(ar1$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  arn <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="SA", maxiter=200))
#  print(arn$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=2, ncv=8,
#    which="BE", maxiter=300))
# "BE" gives: At line 558 of file dsaup2.f: Fortran runtime error: 
# Index '9' of dimension 1 of array 'bounds' above upper bound of 8
# "BE" 
#  print(ar1$values)
#}
k5 <- knn2nb(knearneigh(boston.utm, k=5))
c(l_max(nb2listw(k5, style="B")))
max(Re(eigenw(nb2listw(k5, style="B"))))
c(l_max(nb2listw(k5, style="C")))
max(Re(eigenw(nb2listw(k5, style="C"))))
ab.listw <- nb2listw(boston.soi, style="W")
er <- range(eigenw(similar.listw(ab.listw)))
er
res_1 <- lextrW(ab.listw)
c(res_1)
#if (require(igraph)) {
#  B <- as(similar.listw(ab.listw), "symmetricMatrix")
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="LA", maxiter=400))
#  print(ar1$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  arn <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="SA", maxiter=400))
#  print(arn$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=2, ncv=8,
#    which="BE", maxiter=300))
# "BE" gives: At line 558 of file dsaup2.f: Fortran runtime error: 
# Index '9' of dimension 1 of array 'bounds' above upper bound of 8
#  print(ar1$values)
#}
ab.listw <- nb2listw(boston.soi, style="S")
er <- range(eigenw(similar.listw(ab.listw)))
er
res_1 <- lextrS(ab.listw)
c(res_1)
#if (require(igraph)) {
#  B <- as(similar.listw(ab.listw), "symmetricMatrix")
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="LA", maxiter=300))
#  print(ar1$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  arn <- arpack(f2, sym=TRUE, options=list(n=n, nev=1, ncv=8,
#    which="SA", maxiter=300))
#  print(arn$values)
# At line 409 of file dsaupd.f: Fortran runtime error: Actual string
# length is shorter than the declared one for dummy argument 'which' (0/2)
#  ar1 <- arpack(f2, sym=TRUE, options=list(n=n, nev=2, ncv=8,
#    which="BE", maxiter=300))
# "BE" gives: At line 558 of file dsaup2.f: Fortran runtime error: 
# Index '9' of dimension 1 of array 'bounds' above upper bound of 8
#  print(ar1$values)
#}

spdep documentation built on Aug. 19, 2017, 3:01 a.m.