likelo: (log) likelihood of Elo-rating model

Description Usage Arguments Details Value References Examples

View source: R/likelo.R

Description

(log) likelihood of Elo-rating model

Usage

1
likelo(eloobject, burnin = 0, ll = TRUE, daterange = NULL)

Arguments

eloobject

output from elo.seq (or from fastelo)

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 burnin = 0, i.e. all interactions are considered.

ll

logical, should the log likelihood be returned rather than the likelihood, by default TRUE

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

\insertRef

franz2015aEloRating

\insertRef

mcmahan1984EloRating

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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]))

EloRating documentation built on March 26, 2020, 7:29 p.m.