https://github.com/cran/CluMix
Raw File
Tip revision: 4fbb09ab94eb59bfa4196e2a4898f4e30c2845ab authored by Manuela Hummel on 21 January 2019, 08:10 UTC
version 2.3.1
Tip revision: 4fbb09a
dist.variables.R
dist.variables <-
function(data, method=c("associationMeasures", "distcor"), associationFun=association, check.psd=TRUE){
# data: data.frame of original data 
# method: method to calculate distances: combination of association measures ("associationMeasures") or distance correlation ("distcor")
# associationFun: function that calculates association measure for each pair of variables in case of method="association"
# check.psd: check if resulting similarity matrix S is positive semi-definite?

  method <- match.arg(method)
  
  if(method == "associationMeasures"){
    S <- similarity.variables(data, associationFun=associationFun, check.psd=check.psd)
    D <- as.dist(sqrt(1 - S))
  }
  
  else if(method == "distcor")
    D <- dcor_dist_bc(data)
  
  return(D)
}
back to top