creatematrix | R Documentation |
create a dominance matrix from the underlying observed sequence
creatematrix(
eloobject,
daterange = NULL,
drawmethod = "omit",
onlyinteracting = FALSE,
winners,
losers,
draw = NULL
)
eloobject |
output from |
daterange |
character of length 2, date range to which the matrix should correspond (default from beginning to end of sequence) |
drawmethod |
character with the following options: |
onlyinteracting |
logical, indicating whether all individuals that were present (default, |
winners |
vector of winners (see details) |
losers |
vector of losers (see details) |
draw |
logical vector (currently not doing anything) |
The function works with either the output of elo.seq
, or with two vectors of winners and losers. If you use winner and loser vectors, their arguments need to be named, and also the remaining arguments (daterange=
and onlyinteracting=
) are ignored. The function does not yet allow to include draws if you supply winner/loser vectors. If you go via the elo.seq
-route, the function can handle draws (via the drawmethod=
argument).
square matrix with dominance interactions (winner in rows, loser in columns)
Christof Neumann
data(adv)
# from winner/loser sequence directly
creatematrix(winners=adv$winner, losers=adv$loser)
# via an eloobject
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)
# interactions restricted to single date
creatematrix(SEQ, daterange = c("2010-01-25", "2010-01-25"))
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.