mat2listw               package:spdep               R Documentation

_C_o_n_v_e_r_t _a _s_q_u_a_r_e _s_p_a_t_i_a_l _w_e_i_g_h_t_s _m_a_t_r_i_x _t_o _a _w_e_i_g_h_t_s _l_i_s_t _o_b_j_e_c_t

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

     The function converts a square spatial weights matrix to a weights
     list  object, optionally adding region IDs from the row names of
     the matrix, as a  sequence of numbers 1:nrow(x), or as given as an
     argument.

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

     mat2listw(x, row.names = NULL)

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

       x: A square non-negative matrix with no NAs representing spatial
           weights

row.names: row names to use for region IDs

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

     A 'listw' object with the following members: 

   style: "M", meaning matrix style, underlying style unknown

neighbours: the derived neighbours list

 weights: the weights for the neighbours derived from the matrix

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

     Roger Bivand Roger.Bivand@nhh.no

_S_e_e _A_l_s_o:

     'nb2listw', 'nb2mat'

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

     data(columbus)
     col005 <- dnearneigh(coords, 0, 0.5, attr(col.gal.nb, "region.id"))
     summary(col005)
     col005.w.mat <- nb2mat(col005, zero.policy=TRUE)
     col005.w.b <- mat2listw(col005.w.mat)
     summary(col005.w.b$neighbours)
     diffnb(col005, col005.w.b$neighbours)

