elo
formulas and the specials thereinR/elo.players.R
, R/formula.specials.R
formula.specials.Rd
Details on elo
functions and the special functions allowed in them to change functions' behaviors.
players(..., weights = NULL) multiteam(...) k(x, y = NULL) adjust(x, adjustment) regress(x, to, by, regress.unused = TRUE) group(x) neutral(x)
... | Vectors to be coerced to character, which comprise of the players of a team. |
---|---|
weights | A vector giving the weights of Elo updates for the players in |
x, y | A vector. |
adjustment | A single value or a vector of the same length as |
to | Numeric: what Elo to regress to. Can be a single value or named vector the same length as the number of teams. |
by | Numeric: by how much should Elos be regressed toward |
regress.unused | Logical: whether to continue regressing teams which have stopped playing. |
In the functions in this package, formula
is usually of the form wins.A ~ elo.A + elo.B
,
where elo.A
and elo.B
are vectors of Elos, and wins.A
is between 0 and 1,
denoting whether team A (Elo A) won or lost (or something between). elo.prob
also allows
elo.A
and elo.B
to be character or factors, denoting which team(s) played. elo.run
requires elo.A
to be a vector of teams or a players matrix from players()
(sometimes denoted by "team.A"
), but elo.B
can be either a vector of teams or
players matrix ("team.B"
) or else a numeric column (denoting a fixed-Elo opponent).
elo.glm
requires both to be a vector of teams or players matrix. elo.markovchain
requires both to be a vector of teams.
formula
accepts six special functions in it:
k()
allows for complicated Elo updates. For
constant Elo updates, use the k =
argument instead of this special function.
Note that elo.markovchain
uses this function (or argument) as a convenient
way of specifying transition probabilities. elo.colley
uses this to indicate
the fraction of a win to be assigned to the winning team.
adjust()
allows for Elos to be adjusted for, e.g., home-field advantage. The second argument
to this function can be a scalar or vector of appropriate length. This can also be used in
elo.glm
and elo.markovchain
as an adjuster to the logistic regressions.
regress()
can be used to regress Elos back to a fixed value
after certain matches. Giving a logical vector identifies these matches after which to
regress back to the mean. Giving any other kind of vector regresses after the appropriate
groupings (see, e.g., duplicated(..., fromLast = TRUE)
). The other three arguments determine
what Elo to regress to (to =
), by how much to regress toward that value
(by =
), and whether to continue regressing teams which have stopped playing (regress.unused
,
default = TRUE
).
group()
is used to group matches (by, e.g., week). For elo.run
, Elos are not updated until
the group changes. It is also fed to as.matrix.elo.run
, giving the number of rows to return.
to produce only certain rows of matrix output. It also determines how many models to run (and on what data)
for elo.glm
and elo.markovchain
when running=TRUE
.
neutral()
is used in elo.glm
and elo.markovchain
to determine the intercept.
In short, the intercept is 1 - neutral()
, denoting home-field advantage. Therefore, the column
passed should be 0 (denoting home-field advatange) or 1 (denoting a neutral game). If omitted, all matches
are assumed to have home field advantage.
players()
is used for multiple players on a team contributing to an overall Elo. The Elo updates
are then assigned based on the specified weights. The weights are ignored in elo.glm
.
multiteam()
is used for matchups consisting of multiple teams and is only valid in elo.run.multiteam
.