kdist                  package:ade4                  R Documentation

_t_h_e _c_l_a_s_s _o_f _o_b_j_e_c_t_s '_k_d_i_s_t' (_K _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:

     An object of class 'kdist' is a list of distance matrices observed
     on the same individuals

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

     kdist(..., epsi = 1e-07, upper = FALSE)

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

     ...: a sequence of objects of the class 'kdist'. 

    epsi: a tolerance threshold to test if distances are Euclidean
          (Gower's theorem) using frac{lambda_n}{lambda_1} is larger
          than -epsi. 

   upper: a logical value indicating whether the upper of a distance
          matrix is used (TRUE) or not (FALSE).  

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

     The attributs of a 'kdist' object are:
      'names': the names of the distances
      'size': the number of points between distances are known
      'labels': the labels of points
      'euclid': a logical vector indicating whether each distance of
     the list is Euclidean or not.
      'call': a call order
      'class': object 'kdist'

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

     returns an object of class 'kdist' containing a list of
     semidefinite matrices.

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

     Daniel Chessel chessel@biomserv.univ-lyon1.fr 
      Anne B Dufour dufour@biomserv.univ-lyon1.fr

_R_e_f_e_r_e_n_c_e_s:

     Gower, J. C. (1966) Some distance properties of latent root and
     vector methods used in multivariate analysis. _Biometrika_, *53*,
     325-338.

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

     # starting from a list of matrices 
     data(yanomama)
     lapply(yanomama,class)  
     kd1 = kdist(yanomama)
     print(kd1)

     # giving the correlations of Mantel's test
     cor(as.data.frame(kd1))
     pairs(as.data.frame(kd1))

     # starting from a list of objects 'dist'
     data(friday87)
     fri.w <- ktab.data.frame(friday87$fau, friday87$fau.blo, 
         tabnames = friday87$tab.names)
     fri.kd = lapply(1:10, function(x) dist.binary(fri.w[[x]],2))
     names(fri.kd) = friday87$tab.names
     unlist(lapply(fri.kd,class)) # a list of distances
     fri.kd = kdist(fri.kd)
     fri.kd
     s.corcircle(dudi.pca(as.data.frame(fri.kd), scan = FALSE)$co)

     # starting from several distances
     data(ecomor)
     d1 <- dist.binary(ecomor$habitat, 1)
     d2 <- dist.prop(ecomor$forsub, 5)
     d3 <- dist.prop(ecomor$diet, 5)
     d4 <- dist.quant(ecomor$morpho, 3)
     d5 <- taxo2phylog(ecomor$taxo)$Wdist
     ecomor.kd <- kdist(d1, d2, d3, d4, d5)
     names(ecomor.kd) = c("habitat", "forsub", "diet", "morpho", "taxo")
     class(ecomor.kd)
     s.corcircle(dudi.pca(as.data.frame(ecomor.kd), scan = FALSE)$co)

     data(bsetal97)
     X <- prep.fuzzy.var(bsetal97$biol, bsetal97$biol.blo)
     w1 <- attr(X, "col.num")
     w2 <- levels(w1)
     w3 <- lapply(w2, function(x) dist.quant(X[,w1==x], method = 1))
     names(w3) <- names(attr(X, "col.blocks"))
     w3 <- kdist(list = w3)
     s.corcircle(dudi.pca(as.data.frame(w3), scan = FALSE)$co)

     data(rpjdl)
     w1 = lapply(1:10, function(x) dist.binary(rpjdl$fau, method = x))
     w2 = c("JACCARD", "SOCKAL_MICHENER", "SOCKAL_SNEATH_S4", "ROGERS_TANIMOTO")
     w2 = c(w2, "CZEKANOWSKI", "S9_GOWER_LEGENDRE", "OCHIAI", "SOKAL_SNEATH_S13")
     w2 <- c(w2, "Phi_PEARSON", "S2_GOWER_LEGENDRE")
     names(w1) <- w2
     w3 = kdist(list = w1)
     w4 <- dudi.pca(as.data.frame(w3), scan = FALSE)$co
     w4

