Correlation with size
This function computes the correlation between an attribute and the size of the groups.
correlation_with_size(partition, attribute, categorical)
partition
: A partition (vector)attribute
: A vector containing the values of the attributecategorical
: A Boolean (True or False) indicating if the attribute is categoricalA number corresponding to the correlation coefficient if the attribute is numerical or the correlation ratio if the attribute is categorical.
p <- c(1,2,2,3,3,4,4,4,5) at <- c(3,5,23,2,1,0,3,9,2) correlation_with_size(p,at,categorical=FALSE)