sim2diss {smacof} | R Documentation |
Converts similarites to dissimilarities
Description
Utility function for converting similarities into dissimilarities. Different methods are provided.
Usage
sim2diss(s, method = "corr", to.dist = FALSE)
Arguments
s |
Similarity matrix (not necessarily symmetric, nor square) |
method |
Various methods for converting similarities into dissimilarities: |
to.dist |
If |
Details
The conversion formulas for the various methods can be found in the package vignette.
Value
Returns dissimiarities either as matrix or as dist object.
References
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. doi:10.18637/jss.v102.i10
Examples
## 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")