Skip to contents

Reciprocal Ranking Seriation

Usage

seriate_rank(object, ...)

# S4 method for class 'data.frame'
seriate_rank(object, EPPM = FALSE, margin = c(1, 2), stop = 100)

# S4 method for class 'matrix'
seriate_rank(object, EPPM = FALSE, margin = c(1, 2), stop = 100)

Arguments

object

A \(m \times p\) numeric matrix or data.frame of count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table). A data.frame will be coerced to a numeric matrix via data.matrix().

...

Currently not used.

EPPM

A logical scalar: should the seriation be computed on EPPM instead of raw data?

margin

A numeric vector giving the subscripts which the rearrangement will be applied over: 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows then columns, c(2, 1) indicates columns then rows.

stop

An integer giving the stopping rule (i.e. maximum number of iterations) to avoid infinite loop.

Value

A RankPermutationOrder object.

Details

This procedure iteratively rearrange rows and/or columns according to their weighted rank in the data matrix until convergence.

Note that this procedure could enter into an infinite loop. If no convergence is reached before the maximum number of iterations, it stops with a warning.

References

Desachy, B. (2004). Le sériographe EPPM: un outil informatisé de sériation graphique pour tableaux de comptages. Revue archéologique de Picardie, 3(1), 39-56. doi:10.3406/pica.2004.2396 .

Dunnell, R. C. (1970). Seriation Method and Its Evaluation. American Antiquity, 35(03), 305-319. doi:10.2307/278341 .

Ihm, P. (2005). A Contribution to the History of Seriation in Archaeology. In C. Weihs & W. Gaul (Eds.), Classification: The Ubiquitous Challenge. Berlin Heidelberg: Springer, p. 307-316. doi:10.1007/3-540-28084-7_34 .

See also

Other seriation methods: permute(), seriate_average(), seriate_refine()

Author

N. Frerebeau

Examples

## Replicates Desachy 2004 results
data("compiegne", package = "folio")

## Get seriation order for columns on EPPM using the reciprocal averaging method
## Expected column order: N, A, C, K, P, L, B, E, I, M, D, G, O, J, F, H
(indices <- seriate_rank(compiegne, EPPM = TRUE, margin = 2))
#> <RankPermutationOrder>
#> Permutation order for matrix seriation:
#> - Row order: 1 2 3 4 5...
#> - Column order: 14 1 3 11 16 12 2 5 9 13 4 7 15 10 6 8...

## Get permutation order
get_order(indices, 1) # rows
#> [1] 1 2 3 4 5
get_order(indices, 2) # columns
#>  [1] 14  1  3 11 16 12  2  5  9 13  4  7 15 10  6  8

## Permute columns
(new <- permute(compiegne, indices))
#>      N     A     C    K   P    L    B    E   I   M    D    G   O    J    F    H
#> 5 1510 13740  8270 1740   0  460  375   20   0   0  250   40 350    5   10   80
#> 4  565 13540 10110 7210 450 1785 1520 1230   0 410  740  265 310  105  635  400
#> 3  160 12490  4220 6750 275 5930 5255 1395  30 350  980  440  10  580 1415  680
#> 2  410  6940  5800 2130 410 2410 2880 1510 620 910 3400 1080 310 2075 2280 2840
#> 1  190  6490  6900 1080  50  570 2350  670 340 740 2745  950 985 2660 3020 6700

## See the vignette
if (FALSE) { # \dontrun{
utils::vignette("seriation")
} # }