predict.rating {PlayerRatings} | R Documentation |
Predict Result Of Games Based On Player Ratings
Description
Predict the result of two-player or multi-player games, given the estimated ratings for each player.
Usage
## S3 method for class 'rating'
predict(object, newdata, tng=15, trat=NULL, gamma=30,
thresh, placing = FALSE, ...)
Arguments
object |
An object of class |
newdata |
For two player games, a dataframe containing
three variables: (1) a numeric vector denoting the time period
in which the game is taking place (2) a numeric or character
identifier for player one (3) a numeric or character identifier
for player two. The time period can contain missing values as
it is not used for the prediction. For N-player games (i.e.
for objects created by the |
tng |
A single value. If the number of games played by
any player is below this value, then either the prediction
will be a missing value, or the prediction will be based on
|
trat |
A single number (for Elo and EloM), or a vector of
length two (for Glicko or Glicko-2 or Stephenson) giving the
rating and deviation parameters to be used for players who have
played less than |
gamma |
A player one advantage parameter; either a single
value or a numeric vector equal to the number of rows in
|
thresh |
A single value. If given, a binary vector is returned indicating whether the prediction is greater than this value. Ignored for multi-player. |
placing |
For multi-player only. If |
... |
Not used. |
Details
The function predicts the expectation of the game result. In two-player games, if the value of one is a win for player one, and the value of zero is a win for player two, and there are no other possibilities, then the prediction is the probability of a win for player one. This is not the case when draws are a possibility.
For multi-player predictions using objects produced by elom
,
expected base scores are given for each player. These are simply the
difference between the rating of a player and the average of all
players in the game, divided by 40.
Value
A numeric vector of predictions of two-player games, or a matrix of expected base scores for multi-player games, either of which may contain missing values.
See Also
Examples
afl <- aflodds[,c(2,3,4,7)]
train <- afl[afl$Week <= 80,]
test <- afl[afl$Week > 80,]
robj <- elo(train)
pvals <- predict(robj, test)
train <- riichi[riichi$Time <= 250,]
test <- riichi[riichi$Time > 250,]
robj <- elom(train)
predict(robj, test, trat = 1400, placing = TRUE)