# isi13: Compute best ranked matrixed based on new I&SI method In compete: Analyzing Social Hierarchies

## Description

Compute best ranked matrixed based on new I&SI method

## Usage

 ```1 2``` ```isi13(m, p = c(1, 0, 0, 0), a_max = 50, nTries = 30, p2 = 0.5, random = FALSE) ```

## Arguments

 `m` A win-loss matrix `p` A vector of probabilities for each of 4 methods `a_max` Number of tries `nTries` Number of iterations `p2` probability for last method `random` Whether to randomize initial matrix order

## Value

A computed ranked matrix best_matrix best_ranking I and SI, and rs - the Spearman correlation between best order and David's Scores.

## Further details

Code based on algorithm described by Schmid & de Vries 2013, Finding a dominance order most consistent with a linear hierarchy: An improved algorithm for the I&SI method, Animal Behaviour 86:1097-1105. This first implementation of this algorithm is not very fast. The code is written in R and is fairly slow. It will be replaced by a function written in C++ soon. The number of tries 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 the matrix with the lowest SI, especially for very large matrices. For small matrices it may be more efficient to use the older algorithm. See `isi98`: for further info. If the algorithm can no longer improve on reducing the I and SI it will return the order found. For some sparse matrices many orders may have an equal I and SI. The best matrix found here will therefore be dependent upon the initial order of individuals in the matrix. By using `random=TRUE` it is possible to randomize the initial order of individuals in the matrix. This can be helpful in identifying other potentially better fits. For solutions with identical I and SI, better fits have a higher value of rs.

## Examples

 `1` ```isi13(people,nTries=10) ```

### Example output

```\$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.