likelo {EloRating} | R Documentation |
(log) likelihood of Elo-rating model
Description
(log) likelihood of Elo-rating model
Usage
likelo(eloobject, burnin = 0, ll = TRUE, daterange = NULL)
Arguments
eloobject |
|
burnin |
numeric, the number of interactions to be excluded from the calculation of the (log) likelihood. This parameter is ignored if a date range is supplied. By default |
ll |
logical, should the log likelihood be returned rather than the likelihood, by default |
daterange |
character or Date of length 2, gives the date range for which likelihood should be calculated. By default, the entire date range of all interactions is considered. |
Details
This function returns the (log) likelihood of a dominance interaction sequence. The likelihood is the product of all winning probabilities (for each interaction).
Value
numeric of length 1, the (log) likelihood
References
Franz M, McLean E, Tung J, Altmann J, Alberts SC (2015). “Self-organizing dominance hierarchies in a wild primate population.” Proceedings of the Royal Society B: Biological Sciences, 282, 20151512. doi:10.1098/rspb.2015.1512.
McMahan CA, Morris MD (1984). “Application of maximum likelihood paired comparison ranking to estimation of a linear dominance hierarchy in animal societies.” Animal Behaviour, 32, 374-378. doi:10.1016/S0003-3472(84)80271-7.
Examples
data(adv)
res <- elo.seq(winner = adv$winner, loser = adv$loser, Date = adv$Date, k = 200)
likelo(res)
res <- elo.seq(winner = adv$winner, loser = adv$loser, Date = adv$Date, k = 100)
likelo(res)
ks <- seq(100, 400, by = 20)
liks <- numeric(length(ks))
for(i in 1:length(liks)) {
liks[i] <- likelo(elo.seq(winner = adv$winner, loser = adv$loser,
Date = adv$Date, k = ks[i]))
}
plot(ks, liks, type = "l")
# discard early interactions via 'burnin'
likelo(res)
# the same as above:
likelo(res, burnin = 0)
# discard the first 10 interactions:
likelo(res, burnin = 10)
# discard all but the last interaction:
likelo(res, burnin = 32)
# which is the same as the log of the last winning probability:
log(winprob(res$logtable$Apre[33], res$logtable$Bpre[33]))