Learn R Programming

extracat (version 1.7-6)

quickfechner: fechnerian scaling

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

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.

Value

The Fechnerian distance matrix.

Details

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

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab