creatematrix: create a dominance matrix

Description Usage Arguments Value Author(s) Examples

View source: R/creatematrix.R

Description

create a dominance matrix from the underlying observed sequence

Usage

1
2
creatematrix(eloobject, daterange=NULL,
             drawmethod="omit", onlyinteracting=FALSE)

Arguments

eloobject

output from elo.seq

daterange

date range to which the matrix should correspond (default from beginning to end of sequence)

drawmethod

"omit" = undecided interactions (draws/ties) are ignored (default)
"0.5" = each undecided is counted half a win for each dyad member
"1" = each undecided interaction is counted twice, i.e. as win for both individuals

onlyinteracting

logical. Indicating whether all individuals that were present (default) are shown in the matrix, or only those that were involved in an interaction in the specified date period. If no presence data was supplied to elo.seq, it is assumed that all individuals were present at all times.

Value

square matrix with dominance interactions (winner in rows, loser in columns)

Author(s)

Christof Neumann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(adv)
SEQ <- elo.seq(winner=adv$winner, loser=adv$loser, Date=adv$Date)
# create dyadic matrix over the entire period of data collection
creatematrix(SEQ)
# limit to a subset of interactions
creatematrix(SEQ, daterange=c("2010-01-25", "2010-02-01"))
# limit to a subset of interactions and show only those IDs that were 
# involved in at least one interaction
creatematrix(SEQ, daterange=c("2010-01-25", "2010-02-01"),
             onlyinteracting=TRUE)

## dealing with undecided interactions
data(adv2)
SEQ <- elo.seq(winner=adv2$winner, loser=adv2$loser, Date=adv2$Date, 
               draw=adv2$tie)
# omit ties/draws
creatematrix(SEQ)
# omit ties/draws
creatematrix(SEQ, drawmethod="0.5")
# omit ties/draws
creatematrix(SEQ, drawmethod="1")

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

[1] "loop 1: Elo calculations"

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |....                                                                  |   6%
  |                                                                            
  |......                                                                |   9%
  |                                                                            
  |........                                                              |  12%
  |                                                                            
  |...........                                                           |  15%
  |                                                                            
  |.............                                                         |  18%
  |                                                                            
  |...............                                                       |  21%
  |                                                                            
  |.................                                                     |  24%
  |                                                                            
  |...................                                                   |  27%
  |                                                                            
  |.....................                                                 |  30%
  |                                                                            
  |.......................                                               |  33%
  |                                                                            
  |.........................                                             |  36%
  |                                                                            
  |............................                                          |  39%
  |                                                                            
  |..............................                                        |  42%
  |                                                                            
  |................................                                      |  45%
  |                                                                            
  |..................................                                    |  48%
  |                                                                            
  |....................................                                  |  52%
  |                                                                            
  |......................................                                |  55%
  |                                                                            
  |........................................                              |  58%
  |                                                                            
  |..........................................                            |  61%
  |                                                                            
  |.............................................                         |  64%
  |                                                                            
  |...............................................                       |  67%
  |                                                                            
  |.................................................                     |  70%
  |                                                                            
  |...................................................                   |  73%
  |                                                                            
  |.....................................................                 |  76%
  |                                                                            
  |.......................................................               |  79%
  |                                                                            
  |.........................................................             |  82%
  |                                                                            
  |...........................................................           |  85%
  |                                                                            
  |..............................................................        |  88%
  |                                                                            
  |................................................................      |  91%
  |                                                                            
  |..................................................................    |  94%
  |                                                                            
  |....................................................................  |  97%
  |                                                                            
  |......................................................................| 100%
[1] "loop 2: Stability calculations"

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |....                                                                  |   6%
  |                                                                            
  |......                                                                |   9%
  |                                                                            
  |........                                                              |  12%
  |                                                                            
  |...........                                                           |  15%
  |                                                                            
  |.............                                                         |  18%
  |                                                                            
  |...............                                                       |  21%
  |                                                                            
  |.................                                                     |  24%
  |                                                                            
  |...................                                                   |  27%
  |                                                                            
  |.....................                                                 |  30%
  |                                                                            
  |.......................                                               |  33%
  |                                                                            
  |.........................                                             |  36%
  |                                                                            
  |............................                                          |  39%
  |                                                                            
  |..............................                                        |  42%
  |                                                                            
  |................................                                      |  45%
  |                                                                            
  |..................................                                    |  48%
  |                                                                            
  |....................................                                  |  52%
  |                                                                            
  |......................................                                |  55%
  |                                                                            
  |........................................                              |  58%
  |                                                                            
  |..........................................                            |  61%
  |                                                                            
  |.............................................                         |  64%
  |                                                                            
  |...............................................                       |  67%
  |                                                                            
  |.................................................                     |  70%
  |                                                                            
  |...................................................                   |  73%
  |                                                                            
  |.....................................................                 |  76%
  |                                                                            
  |.......................................................               |  79%
  |                                                                            
  |.........................................................             |  82%
  |                                                                            
  |...........................................................           |  85%
  |                                                                            
  |..............................................................        |  88%
  |                                                                            
  |................................................................      |  91%
  |                                                                            
  |..................................................................    |  94%
  |                                                                            
  |....................................................................  |  97%
  |                                                                            
  |......................................................................| 100%
  a b c d e f g
a 0 0 0 0 0 1 0
b 3 0 2 0 2 1 0
c 0 1 0 2 1 0 3
d 2 0 0 0 1 1 1
e 2 0 0 0 0 0 2
f 1 0 0 0 2 0 1
g 2 0 0 0 0 2 0
  a b c d e f g
a 0 0 0 0 0 0 0
b 2 0 1 0 1 0 0
c 0 0 0 0 0 0 0
d 0 0 0 0 0 0 0
e 0 0 0 0 0 0 2
f 0 0 0 0 0 0 0
g 2 0 0 0 0 0 0
  a b c e g
a 0 0 0 0 0
b 2 0 1 1 0
c 0 0 0 0 0
e 0 0 0 0 2
g 2 0 0 0 0
[1] "loop 1: Elo calculations"

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |....                                                                  |   6%
  |                                                                            
  |......                                                                |   9%
  |                                                                            
  |........                                                              |  12%
  |                                                                            
  |...........                                                           |  15%
  |                                                                            
  |.............                                                         |  18%
  |                                                                            
  |...............                                                       |  21%
  |                                                                            
  |.................                                                     |  24%
  |                                                                            
  |...................                                                   |  27%
  |                                                                            
  |.....................                                                 |  30%
  |                                                                            
  |.......................                                               |  33%
  |                                                                            
  |.........................                                             |  36%
  |                                                                            
  |............................                                          |  39%
  |                                                                            
  |..............................                                        |  42%
  |                                                                            
  |................................                                      |  45%
  |                                                                            
  |..................................                                    |  48%
  |                                                                            
  |....................................                                  |  52%
  |                                                                            
  |......................................                                |  55%
  |                                                                            
  |........................................                              |  58%
  |                                                                            
  |..........................................                            |  61%
  |                                                                            
  |.............................................                         |  64%
  |                                                                            
  |...............................................                       |  67%
  |                                                                            
  |.................................................                     |  70%
  |                                                                            
  |...................................................                   |  73%
  |                                                                            
  |.....................................................                 |  76%
  |                                                                            
  |.......................................................               |  79%
  |                                                                            
  |.........................................................             |  82%
  |                                                                            
  |...........................................................           |  85%
  |                                                                            
  |..............................................................        |  88%
  |                                                                            
  |................................................................      |  91%
  |                                                                            
  |..................................................................    |  94%
  |                                                                            
  |....................................................................  |  97%
  |                                                                            
  |......................................................................| 100%
[1] "loop 2: Stability calculations"

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |....                                                                  |   6%
  |                                                                            
  |......                                                                |   9%
  |                                                                            
  |........                                                              |  12%
  |                                                                            
  |...........                                                           |  15%
  |                                                                            
  |.............                                                         |  18%
  |                                                                            
  |...............                                                       |  21%
  |                                                                            
  |.................                                                     |  24%
  |                                                                            
  |...................                                                   |  27%
  |                                                                            
  |.....................                                                 |  30%
  |                                                                            
  |.......................                                               |  33%
  |                                                                            
  |.........................                                             |  36%
  |                                                                            
  |............................                                          |  39%
  |                                                                            
  |..............................                                        |  42%
  |                                                                            
  |................................                                      |  45%
  |                                                                            
  |..................................                                    |  48%
  |                                                                            
  |....................................                                  |  52%
  |                                                                            
  |......................................                                |  55%
  |                                                                            
  |........................................                              |  58%
  |                                                                            
  |..........................................                            |  61%
  |                                                                            
  |.............................................                         |  64%
  |                                                                            
  |...............................................                       |  67%
  |                                                                            
  |.................................................                     |  70%
  |                                                                            
  |...................................................                   |  73%
  |                                                                            
  |.....................................................                 |  76%
  |                                                                            
  |.......................................................               |  79%
  |                                                                            
  |.........................................................             |  82%
  |                                                                            
  |...........................................................           |  85%
  |                                                                            
  |..............................................................        |  88%
  |                                                                            
  |................................................................      |  91%
  |                                                                            
  |..................................................................    |  94%
  |                                                                            
  |....................................................................  |  97%
  |                                                                            
  |......................................................................| 100%
  a b c d e f g
a 0 0 0 0 0 0 0
b 1 0 2 0 2 1 0
c 0 1 0 2 1 0 3
d 2 0 0 0 0 1 1
e 1 0 0 0 0 0 2
f 1 0 0 0 2 0 1
g 1 0 0 0 0 1 0
    a b c   d   e   f   g
a 0.0 1 0 0.0 0.5 0.5 0.5
b 2.0 0 2 0.0 2.0 1.0 0.0
c 0.0 1 0 2.0 1.0 0.0 3.0
d 2.0 0 0 0.0 0.5 1.0 1.0
e 1.5 0 0 0.5 0.0 0.0 2.0
f 1.5 0 0 0.0 2.0 0.0 1.5
g 1.5 0 0 0.0 0.0 1.5 0.0
  a b c d e f g
a 0 2 0 0 1 1 1
b 3 0 2 0 2 1 0
c 0 1 0 2 1 0 3
d 2 0 0 0 1 1 1
e 2 0 0 1 0 0 2
f 2 0 0 0 2 0 2
g 2 0 0 0 0 2 0

EloRating documentation built on May 29, 2017, 7:14 p.m.