Plot similarity objective by cluster

plot_similarity(x, groups)

Arguments

x

The data input. Can be one of two structures: (1) A data matrix where rows correspond to elements and columns correspond to features (a single numeric feature can be passed as a vector). (2) An N x N matrix dissimilarity matrix; can be an object of class dist (e.g., returned by dist or as.dist) or a matrix where the entries of the upper and lower triangular matrix represent the pairwise dissimilarities.

groups

A grouping vector of length N, usually the output of matching.

Value

The diversity (sum of distances) by group.

Details

Plots the sum of pairwise distances by group.

Author

Martin Papenberg martin.papenberg@hhu.de

Examples


# Match elements and plot similarity by match
N <- 100
lds <- data.frame(f1 = rnorm(N), f2 = rnorm(N))
pairs <- matching(lds, p = 2)
plot_similarity(lds, pairs)