sim2diss: Converts similarites to dissimilarities

Description Usage Arguments Details Value Examples

View source: R/sim2diss.R

Description

Utility function for converting similarities into dissimilarities. Different methods are provided.

Usage

1
sim2diss(s, method = "corr", to.dist = FALSE)

Arguments

s

Similarity matrix (not necessarily symmetric, nor square)

method

Various methods for converting similarities into dissimilarities: "corr", "reverse", "reciprocal", "ranks", "exp", "Gaussian", "cooccurrence", "gravity", "confusion", "transition", "membership", "probability", or an integer value from which the similarity is subtracted

to.dist

If TRUE, object of class dist is produced

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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")

smacof documentation built on Feb. 11, 2021, 3 a.m.