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)

