hdist-class              package:hopach              R Documentation

_C_l_a_s_s "_h_d_i_s_t" - _S_4 _c_l_a_s_s _t_o _h_o_l_d _d_i_s_t_a_n_c_e _m_a_t_r_i_c_e_s.

_D_e_s_c_r_i_p_t_i_o_n:

     Class hdist was created to take advantage of the structure innate
     to symmetric  matrices.  It stores only the lower triangle of the
     matrix, thus reducing the size (and memory usage) from n x n to [n
     x (n - 1)] / 2.    

     Like a matrix, a hdist object is subsettable; thus, hdist[i,j]
     will  return the value at row 'i' column 'j'. Most valid indices
     for a matrix are also valid for a hdist object. (See examples
     below)

_S_l_o_t_s:


     '_D_a_t_a': Object of class '"numeric"' a vector containing the
          stacked columns of the lower triangle of a symmetric matrix -
          often the symmetric matrix is a distance matrix.

     '_S_i_z_e': Object of class '"numeric"' the dimension of the 
          symmetric matrix, from which 'Data' was constructed.

     '_L_a_b_e_l_s': Object of class '"numeric"' a list of values of  length
          'Size' to allow for pretty printing.

     '_C_a_l_l': Object of class '"character"' a character string 
          specifying the method used to create the distance matrix from
          which 'Data' was constructed.

_M_e_t_h_o_d_s:


     _h_d_i_s_t 'signature{Data = "numeric", Size = "numeric", Labels =
          "numeric", Call = "character"}': Create a new hdist object. 

     _a_s._h_d_i_s_t 'signature{from = "matrix"}': Converts a matrix to a
          hdist object. 

     _a_s._m_a_t_r_i_x 'signature(x = "hdist")': Converts a hdist object to a
          matrix. 

     _a_s._v_e_c_t_o_r 'signature(x = "hdist", mode = "missing")': Returns the
          hdist object as a vector. 

     [ 'signature(x = "hdist")': Subsetting function for hdist objects.
          See examples and warning. 

     _c_o_e_r_c_e 'signature(from = "matrix", to = "hdist")': Converts a
          matrix to a hdist object. 

     _c_o_e_r_c_e 'signature(from = "hdist", to = "matrix")': Converts a
          hdist object to a matrix. 

     _d_i_m 'signature(x = "hdist")': Returns the dimension of the hdist
          object if expanded to a square matrix.

     _l_a_b_e_l_s 'signature(object = "hdist")': Returns the labels used for
          printing. 

     _l_e_n_g_t_h 'signature(x = "hdist")': Returns the number of rows in
          hdist object. 

     _s_h_o_w 'signature(object = "hdist")': Prints the hdist object. 

_W_a_r_n_i_n_g:

     A hdist object is NOT closed under the subsetting operation. For
     instance, if a 100 x 100 symmetric matrix is stored as an hdist
     object, hdist[c(3,4,5),c(7,8,9)] will return a 3 x 3 matrix, since
     the subsetting will not result in a symmetric matrix. However, if
     index i = j, then subsetting a hdist object will result in a
     symmetric  matrix, and thus a hdist object will be returned.  (See
     examples below)

_N_o_t_e:

     Thank you to Larry Tai for his assistance creating run-time
     comparisons.

_A_u_t_h_o_r(_s):

     Katherine S. Pollard <kpollard@gladstone.ucsf.edu> and Gregory D.
     Wall <gwall@wald.ucdavis.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>

     <URL: http://www.bepress.com/ucbbiostat/paper107/>

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

     Kaufman, L. and Rousseeuw, P.J. (1990). Finding Groups in Data: An
     Introduction to Cluster Analysis. Wiley, New York.

_S_e_e _A_l_s_o:

     'hopach'

_E_x_a_m_p_l_e_s:

             showClass("hdist")

             library(hopach) 
             X <- matrix(rnorm(60,mean=10,sd=2),nrow=10,ncol=6,byrow=TRUE)
             dmat <- disscosangle(X) 
             dmat
             str(dmat) 
             
             # Examples where subsetting a hdist object returns a matrix...  
             dmat[c(3,4,5),c(5,6,7,8)]
             dmat[c(TRUE,FALSE),c(FALSE,TRUE)]
             dmat[c(4,5,6), ] 

             # Examples where subsetting a hdist object returns a hdist object...
             dmat[c(3,4,5,6,7),c(3,4,5,6,7)]
             dmat[c(TRUE,FALSE),c(TRUE,FALSE)]
             
             # Expand hdist object to a symmetric matrix...
             as.matrix(dmat)

