Calculate the probability that team A beats team B. This is vectorized.

elo.prob(elo.A, ...)

# S3 method for default
elo.prob(elo.A, elo.B, ..., elos = NULL, adjust.A = 0, adjust.B = 0)

# S3 method for formula
elo.prob(formula, data, na.action, subset, ..., elos = NULL)

# S3 method for elo.multiteam.matrix
elo.prob(elo.A, ..., elos = NULL)

Arguments

elo.A, elo.B

Numeric vectors of elo scores, or else vectors of teams.

...

Other arguments (not in use at this time).

elos

An optional named vector containing Elo ratings for all teams in formula or elo.A and elo.B.

adjust.A

Numeric vectors to adjust elo.A and elo.B by.

adjust.B

Numeric vectors to adjust elo.A and elo.B by.

formula

A formula. See the help page for formulas for details.

data

A data.frame in which to look for objects in formula.

na.action

A function which indicates what should happen when the data contain NAs.

subset

An optional vector specifying a subset of observations.

Value

A vector of Elo probabilities.

Details

Note that formula can be missing the wins.A component. If present, it's ignored by elo.model.frame.

See also

elo.update, elo.calc, elo.model.frame

Examples

elo.prob(1500, 1500)
#> [1] 0.5
elo.prob(c(1500, 1500), c(1500, 1600))
#> [1] 0.500000 0.359935

dat <- data.frame(wins.A = c(1, 0), elo.A = c(1500, 1500),
                  elo.B = c(1500, 1600), k = c(20, 20))
elo.prob(~ elo.A + elo.B, data = dat)
#> [1] 0.500000 0.359935

## Also works to include the wins and k:
elo.prob(wins.A ~ elo.A + elo.B + k(k), data = dat)
#> [1] 0.500000 0.359935

## Also allows teams
elo.prob(c("A", "B"), c("C", "C"), elos = c(A = 1500, B = 1600, C = 1500))
#> [1] 0.500000 0.640065