quickfechner: fechnerian scaling

Description Usage Arguments Details Value Author(s) Examples

View source: R/fechner.R

Description

This function computes a fechnerian distance matrix from either a similarity matrix or a dissimilarity matrix. In addition to the basic procedure which looks for the shortest paths between the objects in the dissimilarity matrix a second approach is offered which connects similarities in a multiplicative manner.

Usage

1
2
quickfechner(x, x.type = "diss", scale ="-", path.op = "+", sym.op = "+", 
rescale = FALSE, exclude.zero = FALSE, check = TRUE)

Arguments

x

A similarity or dissimilarity matrix.

x.type

The type of the matrix ('sim' or 'diss').

scale

Either divide the similarities by the diagonal entries ('div', '/','*','exp','expected','mult','multiplicative') or subtract the diagonal entries in the dissimilarity matrix ('-', '+', 'add','additive')

path.op

Whether to use the similarities to find multiplicative paths ('*','exp','expected','mult','multiplicative') or to use the dissimilarities and find additive paths ('+','add','additive','max','maximum'). Note that similarity matrices are simply converted to dissimilarity matrices by subtraction from 1. Other transitions such as 2M/(1+M) are not yet implemented and have to be done by hand.

sym.op

This sets the function which is used to ensure symmetry. "min" uses the minumum value, "+", "sum" or "mean" use the sum. "none", NA or FALSE stand for no operation and hence the resulting matrix will not necessarily be symmetric.

rescale

Whether or not the original diagonal will be used for a correction of the results.

exclude.zero

If TRUE zero-entries are not considered in the updating algorithm.

check

Whether or not to check for regular minimality or maximality.

Details

The algorithm first computes a dissimilarity matrix with a zero-diagonal. Then it iteratively tries to find shorter paths between the items.

Value

The Fechnerian distance matrix.

Author(s)

Alexander Pilhoefer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(olives)
#not a distance matrix, but a similarity matrix in some sense
cx <- 1-abs(cor(olives[-c(1,2,11)]))

cx2 <- quickfechner(cx)

rownames(cx2) <- names(olives)[-c(1,2,11)]
plot(hclust(as.dist(cx2)))

dm <- matrix(runif(100),10,10)
dm <- dm+t(dm)
diag(dm) <- 0
dm2 <- quickfechner(dm)

dmS <- 1-dm/max(dm)
dmS2 <- quickfechner(dmS, x.type="sim", path.op = "*")

## Not run: 
# check triangular inequality:
	extracat:::trinq(dm)
	extracat:::trinq(dm2)
	extracat:::trinq(dmS2)

## End(Not run)

extracat documentation built on July 17, 2018, 5:05 p.m.