criterion {seriation} | R Documentation |
Compute the value for different loss functions L and merit function M for data given a permutation.
criterion(x, order = NULL, method = "all")
x |
an object of class dist or a matrix (currently no
functions are implemented for array). |
order |
an object of class ser_permutation suitable for x .
If NULL , the identity permutation is used.
|
method |
a vector of character strings with names of the criteria
The dummy method "all"
can be used to calculate all available criteria. |
For a symmetric dissimilarity matrix D with elements d(i,j) where i, j = 1 ... p, the aim is generally to place low distance values close to the diagonal. The following criteria to judge the quality of a certain permutation of the objects in a dissimilarity matrix are currently implemented:
"Gradient\_raw", "Gradient\_weighted"
A symmetric dissimilarity matrix where the values in all rows and columns only increase when moving away from the main diagonal is called a perfect anti-Robinson matrix (Robinson 1951). A suitable merit measure which quantifies the divergence of a matrix from the anti-Robinson form is
M(D) = sum_{i<k<j}f(d_{ij}, d_{ik}) + sum_{i<k<j}f(d_{ij}, d_{kj})
where f(cdot,cdot) is a function which defines how a violation or satisfaction of a gradient condition for an object triple (O_i, O_k, O_j) is counted.
Hubert et al (1987) suggest two functions. The first function is given by:
f(z,y) = mathrm{sign}(y-z) = +1 quad mathrm{if} quad z < y; quad 0 quad mathrm{if} quad z = y; quad mathrm{and} quad -1 quad mathrm{if} quad z > y.
It results in raw number of triples satisfying the gradient constraints minus triples which violate the constraints.
The second function is defined as:
f(z,y) = |y-z|mathrm{sign}(y-z) = y-z
It weights the each satisfaction or violation by the difference by its magnitude given by the absolute difference between the values.
"AR\_events", "AR\_deviations"
L(D) = sum_{i<k<j}f(d_{ik}, d_{ij}) + sum_{i<k<j}f(d_{kj}, d_{ij})
To only count the violations we use
f(z, y) = I(z, y) = 1 quad mathrm{if} quad z < y quad mathrm{and} quad 0 quad mathrm{otherwise.}
I(cdot) is an indicator function returning 1 only for violations. Chen (2002) presented a formulation for an equivalent loss function and called the violations anti-Robinson events and also introduced a weighted versions of the loss function resulting in
f(z, y) = |y-z|I(z, y)
using the absolute deviations as weights.
"Path\_length"
The order of the objects in a dissimilarity matrix corresponds to a path through a graph where each node represents an object and is visited exactly once, i.e., a Hamilton path. The length of the path is defined as the sum of the edge weights, i.e., dissimilarities.
L(D) = sum_{i=1}^{n-1} d_{i,i+1}
The length of the Hamiltonian path is equal to the value of the minimal span loss function (as used by Chen 2002). Both notions are related to the traveling salesperson problem (TSP).
If order
is not unique or
there are non-finite distance values NA
is returned.
"Inertia"
Measures the moment of the inertia of dissimilarity values around the diagonal as
M(D) = sum_i sum_j d(i,j)|i-j|^2.
|i-j| is used as a measure for the distance to the diagonal and d(i,j) gives the weight. This criterion gives higher weight to values farther away from the diagonal. It increases with quality.
"Least\_squares"
The sum of squares of deviations between the dissimilarities and rank differences (in the matrix) between two elements:
L(D) = sum_i sum_j (d(i,j) - |i-j|)^2,
where d(i,j) is an element of the dissimilarity matrix D and |i-j| is the rank difference between the objects.
Note that if Euclidean distance is used to calculate D from a data matrix X, the order of the elements in X by projecting them on the first principal component of X minimizes this criterion. The least squares criterion is related to unidimensional scaling.
For a general matrix X = x_{ij}, i = 1 ... m and j = 1 ... n, currently the following loss/merit functions are implemented:
"ME"
The measure of effectiveness (ME) for matrix X, is defined as
M(X) = 1/2 sum_{i=1}^{n} sum_{j=1}^{m} x_{i,j}(x_{i,j-1}+x_{i,j+1}+x_{i-1,j}+x_{i+1,j})
with, by convention
x_{0,j}=x_{m+1,j}=x_{i,0}=x_{i,n+1}=0.
ME is a merit measure, i.e. a higher ME indicates a better arrangement. Maximizing ME is the objective of the bond energy algorithm (BEA).
"Moore_stress"
, "Neumann_stress"
Stress measures the conciseness of the presentation of a matrix/table and can be seen as a purity function which compares the values in a matrix/table with its neighbors. The stress measure used here is computed as the sum of squared distances of each matrix entry from its adjacent entries. The following types of neighborhoods are available:
The major difference between the Moore and the Neumann neighborhood is that for the later the contribution of row and column permutations to stress are independent and thus can be optimized independently.
A named vector of real values.
G. Caraux and S. Pinloche (2005): Permutmatrix: A Graphical Environment to Arrange Gene Expression Profiles in Optimal Linear Order, Bioinformatics, 21(7), 1280–1281.
C.-H. Chen (2002): Generalized association plots: Information visualization via iteratively generated correlation matrices, Statistica Sinica, 12(1), 7–29.
L. Hubert, P. Arabie, and J. Meulman (1987): Combinatorial Data Analysis: Optimization by Dynamic Programming. Society for Industrial Mathematics.
S. Niermann (2005): Optimizing the Ordering of Tables With Evolutionary Computation, The American Statistician, 59(1), 41–46.
W.S. Robinson (1951): A method for chronologically ordering archaeological deposits, American Antiquity, 16, 293–301.
W.T. McCormick, P.J. Schweitzer and T.W. White (1972): Problem decomposition and data reorganization by a clustering technique, Operations Research, 20(5), 993-1009.
## create random data and calculate distances m <- matrix(runif(10),ncol=2) d <- dist(m) ## get an order for rows (optimal for the least squares criterion) o <- seriate(m, method = "PCA", margin = 1) o ## compare the values for all available criteria rbind( unordered = criterion(d), ordered = criterion(d, o) )