sim2diss | R Documentation |
Utility function for converting similarities into dissimilarities. Different methods are provided.
sim2diss(s, method = "corr", to.dist = FALSE)
s |
Similarity matrix (not necessarily symmetric, nor square) |
method |
Various methods for converting similarities into dissimilarities: |
to.dist |
If |
The conversion formulas for the various methods can be found in the package vignette.
Returns dissimiarities either as matrix or as dist object.
Mair, P., Groenen, P. J. F., De Leeuw, J. (2022). More on multidimensional scaling in R: smacof version 2. Journal of Statistical Software, 102(10), 1-47. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v102.i10")}
## Convert crimes data (correlations)
data(crimes)
crimeD <- sim2diss(crimes, method = "corr", to.dist = TRUE)
## Convert Wish data (similarities) by subtracting from 7
data(wish)
wishD <- sim2diss(wish, method = 7, to.dist = TRUE)
## Convert Ekman data (similarities) into dissimilarities
data(ekman)
ekmanD <- sim2diss(ekman, method = "confusion", to.dist = TRUE)
## Convert album ratings (rectangular similarities) by reversing the ratings
data(RockHard)
rockD1 <- sim2diss(RockHard[,5:18], method = "reverse")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.