diana(x, diss = F, metric = "euclidean", stand = F)
In case of a matrix or dataframe, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric. Missing values (NAs) are allowed.
In case of a dissimilarity matrix, x is typically the output of daisy or dist. Also a vector with length n*(n-1)/2 is allowed (where n is the number of objects), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (NAs) are not allowed.
The diana-algorithm constructs a hierarchy of clusterings, starting with one large cluster containing all n objects. Clusters are divided until each cluster contains only a single object. At each stage, the cluster with the largest diameter is selected. (The diameter of a cluster is the largest dissimilarity between any two of its objects.) To divide the selected cluster, the algorithm first looks for its most disparate object (i.e., which has the largest average dissimilarity to the other objects of the selected cluster). This object initiates the "splinter group". In subsequent steps, the algorithm reassigns objects that are closer to the "splinter group" than to the "old party". The result is a division of the selected cluster into two new clusters.
dia1 <- diana(votes.repub, metric = "manhattan", stand = T) print(dia1) plot(dia1)dia2 <- diana(daisy(votes.repub), diss = T, method = "complete") pltree(dia2)
diana(dist(votes.repub), diss = T)