classCenter           package:randomForest           R Documentation

_P_r_o_t_o_t_y_p_e_s _o_f _g_r_o_u_p_s.

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

     Prototypes are `representative' cases of a group of data points,
     given the similarity matrix among the points.  They are very
     similar to medoids.  The function is named `classCenter' to avoid
     conflict with the function 'prototype' in the 'methods' package.

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

     classCenter(x, label, prox, nNbr = min(table(label))-1) 

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

       x: a matrix or data frame

   label: group labels of the rows in 'x'

    prox: the proximity (or similarity) matrix, assumed to be symmetric
          with 1 on the diagonal and in [0, 1] off the diagonal (the
          order of row/column must match that of 'x')

    nNbr: number of nearest neighbors used to find the prototypes.

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

     This version only computes one prototype per class.  For each case
     in 'x', the 'nNbr' nearest neighors are found.  Then, for each
     class, the case that has most neighbors of that class is
     identified. The prototype for that class is then the medoid of
     these neighbors (coordinate-wise medians for numerical variables
     and modes for categorical variables).

     This version only computes one prototype per class.  In the future
     more prototypes may be computed (by removing the `neighbors' used,
     then iterate).

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

     A data frame containing one prototype in each row.

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

     Andy Liaw

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

     'randomForest', 'MDSplot'

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

     data(iris)
     iris.rf <- randomForest(iris[,-5], iris[,5], prox=TRUE)
     iris.p <- classCenter(iris[,-5], iris[,5], iris.rf$prox)
     plot(iris[,3], iris[,4], pch=21, xlab=names(iris)[3], ylab=names(iris)[4],
          bg=c("red", "blue", "green")[as.numeric(factor(iris$Species))],
          main="Iris Data with Prototypes")
     points(iris.p[,3], iris.p[,4], pch=21, cex=2, bg=c("red", "blue", "green"))

