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)

