skater                 package:spdep                 R Documentation

_S_p_a_t_i_a_l '_K'_l_u_s_t_e_r _A_n_a_l_y_s_i_s _b_y _T_r_e_e _E_d_g_e _R_e_m_o_v_a_l

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

     This function implements a SKATER procedure for spatial clustering
     analysis. This procedure essentialy begins with an edges set, a
     data set and a number of cuts. The output is an object of 'skater'
     class and is valid for input again.

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

     skater(edges, data, ncuts, crit, vec.crit, method = c("euclidean", 
         "maximum", "manhattan", "canberra", "binary", "minkowski", 
         "mahalanobis", "other"), p = 2, cov, inverted = FALSE, otherfun) 

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

   edges: A matrix with 2 colums with each row is an edge

    data: A data.frame with data observed over nodes.

   ncuts: The number of cuts

    crit: A numeric or integer with criteria for groups. Example:
          minimum population size.

vec.crit: A vector for evaluating critera.

  method: Character for declare the distance method. For "euclidean",
          "maximum", "manhattan", "canberra", "binary" and "minkowisk",
          see 'dist' for details, because this function as used to
          compute the distance. If 'method="mahalanobis"', the
          mahalanobis distance is computed between neighbour areas. If
          'method="other"', any function must be informed in 'otherfun'
          argument.

       p: The power of the Minkowski distance.

     cov: The covariance matrix used to compute the mahalanobis
          distance.

inverted: logical.  If 'TRUE', 'cov' is supposed to contain the inverse
          of the covariance matrix.

otherfun: A user defined function to compute the distance

_D_e_t_a_i_l_s:

     to do

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

     A object of 'skater' class with:

  groups: A vector with length equal the number of nodes. Each position
          identifies the group of node

edges.groups: A list of length equal the number of groups with each
          element is a set of edges

not.prune: A vector identifying the groups with are not candidates to
          partition.

candidates: A vector identifying the groups with are candidates to
          partition.

    ssto: The total dissimilarity in each step of edge removal.

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

     Renato M. Assuncao and Elias T. Krainski

_R_e_f_e_r_e_n_c_e_s:

     Assuncao, R.M., Lage J.P., and Reis, E.A. (2002). Analise de
     conglomerados espaciais via arvore geradora minima. Revista
     Brasileira de Estatistica, 62, 1-23. 

     Assuncao, R. M, Neves, M. C., Camara, G. and Freitas, C. da C.
     (2006). Efficient regionalization techniques for socio-economic
     geographical units using minimum spanning trees. International
     Journal of Geographical Information Science Vol. 20, No. 7, August
     2006, 797-811

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

     See Also as 'mstree'

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

     ### loading data
     bh <- readShapePoly(system.file("etc/shapes/bhicv.shp",
           package="spdep")[1])
     ### data padronized
     dpad <- data.frame(scale(bh@data[,5:8]))

     ### neighboorhod list
     bh.nb <- poly2nb(bh)

     ### calculing costs
     lcosts <- nbcosts(bh.nb, dpad)

     ### making listw
     nb.w <- nb2listw(bh.nb, lcosts, style="B")

     ### find a minimum spanning tree
     mst.bh <- mstree(nb.w,5)

     ### the mstree plot
     par(mar=c(0,0,0,0))
     plot(mst.bh, coordinates(bh), col=2,       
          cex.lab=.7, cex.circles=0.035, fg="blue")
     plot(bh, border=gray(.5), add=TRUE)

     ### three groups with no restriction
     res1 <- skater(mst.bh[,1:2], dpad, 2)

     ### thee groups with minimum population 
     res2 <- skater(mst.bh[,1:2], dpad, 2, 200000, bh@data$Pop)

     ### thee groups with minimun number of areas
     res3 <- skater(mst.bh[,1:2], dpad, 2, 3, rep(1,nrow(bh@data)))

     ### groups frequency
     table(res1$groups)
     table(res2$groups)
     table(res3$groups)

     ### the skater plot
     par(mar=c(0,0,0,0))
     plot(res1, coordinates(bh), cex.circles=0.035, cex.lab=.7)

     ### more one partition
     res1b <- skater(res1, dpad, 1)

     ### length groups frequency
     table(res1$groups)
     table(res1b$groups)

     ### the skater plot, using other colors
     plot(res1b, coordinates(bh), cex.circles=0.035, cex.lab=.7,
          groups.colors=colors()[(1:length(res1b$ed))*10])

     ### the Spatial Polygons plot
     plot(bh, col=heat.colors(4)[res1b$groups])

