correlationordering          package:hopach          R Documentation

_f_u_n_c_t_i_o_n _t_o _c_o_m_p_u_t_e _e_m_p_i_r_i_c_a_l _c_o_r_r_e_l_a_t_i_o_n _b_e_t_w_e_e_n _d_i_s_t_a_n_c_e _i_n _a _l_i_s_t _a_n_d _d_i_s_t_a_n_c_e _b_y _a _m_e_t_r_i_c

_D_e_s_c_r_i_p_t_i_o_n:

     Given a matrix of pair wise distances based on a choice of
     distance metric, 'correlationordering' computes the empirical
     correlation (over all pairs of elements) between the distance
     apart in the rows/columns of the matrix and the distance according
     to the metric. Correlation ordering will be high if elements close
     to each other in the matrix have small pair wise distances. If the
     rows/columns of the distance matrix are ordered according to a
     clustering of the elements, then correlation ordering should be
     large compared to a matrix with randomly ordered rows/columns.

_U_s_a_g_e:

     correlationordering(dist)

     improveordering(dist,echo=FALSE)

_A_r_g_u_m_e_n_t_s:

    dist: matrix of all pair wise distances between a set of 'p'
          elements,  as produced, for example, by the 'distancematrix'
          function.  The value in row 'j' and column 'i' is the
          distance between element 'i' and element 'j'. The matrix must
          be symmetric. The ordering of the rows/ columns is compared
          to the values in the matrix.

    echo: indicator of whether the value of correlation ordering before
          and after rearranging the ordering should be printed.

_D_e_t_a_i_l_s:

     Correlation ordering is defined as the empirical correlation
     between distance in a list and distance according to some other
     metric. The value in row 'i' and column 'j' of 'dist' is compared
     to 'j-i'. The function 'correlationordering' computes the
     correlation ordering for a matrix 'dist', whereas the function
     'improveordering' swaps the ordering of elements in 'dist' until
     doing so no longer improves correlation ordering. The algorithm
     for 'improveordering' is not optimized, so that the function can
     be quite slow for more than 50 elements. These functions are used
     by the 'hopach' clustering function to sensibly order the clusters
     in the first level of the hierarchical tree, and can also be used
     to order elements within clusters when the number of elements is
     not too large.

_V_a_l_u_e:

     For 'correlationordering', a number between -1 and 1, as returned
     by the 'cor' function, equal to the correlation ordering for the
     matrix 'dist'.

     For 'improveordering', a vector of length 'p' containing the row
     indices for the new ordering of the rows/columns of 'dist', so
     that dist[improveordering(dist)] now has higher correlation
     ordering.

_W_a_r_n_i_n_g:

     The function 'improveordering' can be very slow for more than
     about 50 elements. The method employed is a greedy, step-wise
     algorithm, in which sequentially swaps all pairs of elements and
     accepts any swap that improves correlation ordering.

_A_u_t_h_o_r(_s):

     Katherine S. Pollard <kpollard@gladstone.ucsf.edu> and Mark J. van
     der Laan <laan@stat.berkeley.edu>

_R_e_f_e_r_e_n_c_e_s:

     van der Laan, M.J. and Pollard, K.S. A new algorithm for hybrid
     hierarchical clustering with visualization and the bootstrap.
     Journal of Statistical Planning and Inference, 2003, 117, pp.
     275-303.

     <URL:
     http://www.stat.berkeley.edu/~laan/Research/Research_subpages/Papers/hopach.pdf>

_S_e_e _A_l_s_o:

     'distancematrix', 'hopach'

_E_x_a_m_p_l_e_s:

     mydata<-matrix(rnorm(50),nrow=10)
     mydist<-distancematrix(mydata,d="euclid")
     image(as.matrix(mydist))
     correlationordering(mydist)
     neword<-improveordering(mydist,echo=TRUE)
     correlationordering(mydist[neword,neword])
     image(as.matrix(mydist[neword,neword]))

