USCounties              package:Matrix              R Documentation

_U_S_C_o_u_n_t_i_e_s _C_o_n_t_i_g_u_i_t_y _M_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     This matrix represents the contiguities of 3111 US counties using
     the Queen criterion of at least a single shared boundary point.
     The representation is as a row standardised spatial weights matrix
     transformed to a symmetric matrix (see Ord (1975), p. 125).

_U_s_a_g_e:

     data(USCounties)

_F_o_r_m_a_t:

     A 3111 ^2 symmetric sparse matrix of class 'dsCMatrix' with 9101
     non-zero entries.

_D_e_t_a_i_l_s:

     The data were read into R using 'read.gal', and row-standardised
     and transformed to symmetry using 'nb2listw' and 'similar.listw'.
     This spatial weights object was converted to class 'dsCMatrix'
     using 'as_dsTMatrix_listw' and coercion.

_S_o_u_r_c_e:

     The data were retrieved from <URL:
     http://sal.uiuc.edu/weights/zips/usc.zip>, files "usc.txt" and
     "usc_q.GAL", with permission for use and distribution from Luc
     Anselin.

_R_e_f_e_r_e_n_c_e_s:

     Ord, J. K. (1975) Estimation methods for models of spatial
     interaction; _Journal of the American Statistical Association_
     *70*, 120-126.

_E_x_a_m_p_l_e_s:

     data(USCounties)
     (n <- ncol(USCounties))
     IM <- .symDiagonal(n)
     nn <- 50
     set.seed(1)
     rho <- runif(nn, 0, 1)
     system.time(MJ <- sapply(rho, function(x) determinant(IM - x * USCounties, logarithm = TRUE)$modulus))

     nWC <- -USCounties
     C1 <- Cholesky(nWC, Imult = 2)
     system.time(MJ1 <- n * log(rho) +
                 sapply(rho, function(x) c(determinant(update(C1, nWC, 1/x))$modulus)))
     all.equal(MJ, MJ1)

     C2 <- Cholesky(nWC, super = TRUE, Imult = 2)
     system.time(MJ2 <- n * log(rho) +
                 sapply(rho, function(x) c(determinant(update(C2, nWC, 1/x))$modulus)))
     all.equal(MJ, MJ2)
     system.time(MJ3 <- n * log(rho) + Matrix:::ldetL2up(C1, nWC, 1/rho))
     all.equal(MJ, MJ3)
     system.time(MJ4 <- n * log(rho) + Matrix:::ldetL2up(C2, nWC, 1/rho))
     all.equal(MJ, MJ4)

