as_dgRMatrix_listw           package:spdep           R Documentation

_I_n_t_e_r_f_a_c_e _b_e_t_w_e_e_n _M_a_t_r_i_x _c_l_a_s_s _o_b_j_e_c_t_s _a_n_d _w_e_i_g_h_t_s _l_i_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Interface between Matrix class objects and weights lists

_U_s_a_g_e:

     as_dgRMatrix_listw(listw)
     as_dsTMatrix_listw(listw)
     as_dsCMatrix_I(n)
     as_dsCMatrix_IrW(W, rho)
     Jacobian_W(W, rho)

_A_r_g_u_m_e_n_t_s:

   listw: a 'listw' object created for example by 'nb2listw'

       W: a 'dsTMatrix' object created using 'as_dsTMatrix_listw' from
          a symmetric 'listw' object

     rho: spatial regression coefficient

       n: length of diagonal for identity matrix

_V_a_l_u_e:

     Matrix package class objects

_A_u_t_h_o_r(_s):

     Roger Bivand

_E_x_a_m_p_l_e_s:

     example(NY_data)
     W <- as_dsTMatrix_listw(listw_NY)
     I <- as_dsCMatrix_I(dim(W)[1])
     W <- as(W, "CsparseMatrix")
     rho <- 0.1
     c(determinant(I - rho * W, logarithm=TRUE)$modulus)
     sum(log(1 - rho * eigenw(listw_NY)))
     n <- dim(W)[1]
     nW <- - W
     nChol <- Cholesky(nW, Imult=8)
     .f <- if(package_version(packageDescription("Matrix")$Version) >
                "0.999375-30") 2 else 1
     n * log(rho) + (.f * c(determinant(update(nChol, nW, 1/rho))$modulus))
     rho <- seq(0.01, 0.1, 0.01)
     n * log(rho) + Matrix:::ldetL2up(nChol, nW, 1/rho)

