kcca                package:flexclust                R Documentation

_K-_C_e_n_t_r_o_i_d_s _C_l_u_s_t_e_r _A_n_a_l_y_s_i_s

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

     Perform k-centroids clustering on a data matrix.

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

     kcca(x, k, family=kccaFamily("kmeans"), weights=NULL, group=NULL,
          control=NULL, simple=FALSE)
     kccaFamily(which=NULL, dist=NULL, cent=NULL, name=which, similarity=FALSE,
                preproc = NULL, trim=0, groupFun = "minSumClusters")

     ## S4 method for signature 'kccasimple':
     summary(object)

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

       x: A numeric matrix of data, or an object that can be coerced to
          such a matrix (such as a numeric vector or a data frame with
          all numeric columns).

       k: Either the number of clusters or a set of initial (distinct)
          cluster centroids.  If a number, a random set of (distinct)
          rows in 'x' is chosen as the initial centroids.

  family: Object of class 'kccaFamily'.

 weights: An optional vector of weights to be used in the clustering
          process, cannot be combined with all families.

   group: An optional grouping vector for the data, see details below.

 control: An object of class 'flexclustControl'.

  simple: Return an object of class 'kccasimple'?

   which: One of '"kmeans"', '"kmedians"', '"angle"', '"jaccard"', or
          '"ejaccard"'.

    name: Optional long name for family, used only for show methods.

    dist: A function for distance or similarity computation, ignored if
          'which' is specified.

    cent: A function for centroid computation, ignored if 'which' is
          specified.

similarity: Logical, if 'TRUE' then 'dist' is interpreted as a
          similarity instead of a distance measure, ignored if 'which'
          is specified.

 preproc: Function for data preprocessing.

    trim: A number in between 0 and 0.5, if non-zero then trimmed means
          are used for the 'kmeans' family, ignored by all other
          families.

groupFun: Function or name of function to obtain clusters for grouped
          data, currently an experimental feature.

  object: Object of class '"kcca"'.

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

     If 'group' is not 'NULL', then observations from the same group
     are restricted to belong to the same cluster during the fitting
     process. The cluster for each group is determined by taking the
     cluster in which the majority of the group members belong to, ties
     are broken at random. Note that at the moment not all methods for
     fitted '"kcca"' objects respect the grouping information, most
     importantly the plot method when a data argument is specified.

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

     Function 'kcca' returns objects of class '"kcca"' or
     '"kccasimple"' depending on the value of argument 'simple'. The
     simpler objects contain fewer slots and hence are faster to
     compute, but contain no auxiliary information used by the plotting
     methods. All plot methods for '"kccasimple"' objects do nothing
     and return a warning. If only centroids, cluster membership or
     prediction for new data are of interest, then the simple objects
     are sufficient.

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

     Friedrich Leisch

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

     'stepFlexclust', 'cclust'

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

     data("Nclus")
     plot(Nclus)

     ## try kmeans 
     cl1 = kcca(Nclus, k=4)
     cl1

     image(cl1)
     points(Nclus)

     ## A barplot of the centroids 
     barplot(cl1)

     ## now use k-medians, cluster centroids should be similar ...
     cl2 = kcca(Nclus, k=4, family=kccaFamily("kmedians"))
     cl2

     ## ... but the boundaries of the partitions have a different shape
     image(cl2)
     points(Nclus)

