isi98: Compute best ranked matrixed based on original I&SI method

Description Usage Arguments Value Further details Examples

View source: R/isi98.R

Description

Compute best ranked matrixed based on original I&SI method

Usage

1
isi98(m, nTries = 100, random = FALSE)

Arguments

m

A win-loss matrix

nTries

Number of tries to find best order

random

Whether to randomize initial matrix order

Value

A matrix with best ranking of I and SI plus the correlation (rs) between found ranking and David's Scores

Further details

Code based on algorithm described by de Vries, H. 1998. Finding a dominance order most consistent with a linear hierarchy: a new procedure and review. Animal Behaviour, 55, 827-843. The code is written in R and is fairly slow. It will be replaced by a function written in C++ soon. The number of iterations should be very high and/or the function should be run several times to detect the optimal matrix or matrices. It may take several runs to find a matrix with the lowest SI, especially for very large matrices. The function will stop once it finds a matrix with an I or SI that it can no longer improve upon. The order of this matrix will be dependent upon the input name order of the original matrix. To find further solutions, try using random==TRUE to shuffle the name order of the initial matrix. For solutions with identical I and SI, better fits have a higher value of rs. See isi13: for further info.

Examples

1
2
isi98(mouse,nTries=50)
isi98(people, random=TRUE)

Example output

INITIAL RANK: 
 [1] "H" "J" "K" "I" "F" "A" "E" "C" "G" "L" "D" "B"
I = 5
SI = 17
$best_matrix
  H J  K  F C I E G L B A D
H 0 7 14  6 4 5 5 2 5 7 4 4
J 4 0 25 15 6 1 7 3 6 8 5 2
K 2 1  0  9 6 4 2 5 2 5 1 1
F 0 0  3  0 2 0 0 2 1 0 0 2
C 0 0  0  1 0 1 0 1 1 2 0 1
I 0 0  3  0 0 0 1 1 0 2 0 1
E 0 0  0  0 0 0 0 0 0 1 0 0
G 0 1  0  0 1 0 0 0 2 2 1 1
L 2 0  1  2 0 0 0 0 0 1 0 0
B 0 0  0  0 1 1 0 0 0 0 1 1
A 0 0  0  0 0 0 0 2 0 0 0 1
D 0 0  0  1 1 0 0 1 1 0 0 0

$best_order
 [1] "H" "J" "K" "F" "C" "I" "E" "G" "L" "B" "A" "D"

$I
[1] 3

$SI
[1] 11

$rs
[1] 0.8391608


INITIAL RANK: 
[1] "Chris" "Eddie" "Bryan" "Frank" "Adam"  "Derek"
I = 6
SI = 11
$best_matrix
      Chris Adam Bryan Frank Eddie Derek
Chris     0   11    32    52    14    36
Adam      4    0    33    26    14    43
Bryan     0    5     0    28     3    11
Frank    12   25     9     0    11     2
Eddie     6   11     0     9     0    30
Derek     3    1     4    16    23     0

$best_order
[1] "Chris" "Adam"  "Bryan" "Frank" "Eddie" "Derek"

$I
[1] 1

$SI
[1] 2

$rs
[1] 0.8285714

compete documentation built on May 29, 2017, 1:39 p.m.