predict.rating {PlayerRatings} | R Documentation |
Predict the result of two-player games as a number between zero and one, given the estimated ratings for each player.
## S3 method for class 'rating' predict(object, newdata, tng=15, trat=NULL, gamma=30, thresh, ...)
object |
An object of class |
newdata |
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. Note that this argument cannot be missing; if predictions on the original dataset are required, then this dataset must be passed to the prediction function. |
tng |
A single value. If the number of games played by
either 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), 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. |
... |
Not used. |
The function predicts the expectation of the game result. 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.
A numeric vector of predictions, which may contain missing values.
afl <- aflodds[,c(2,3,4,7)] train <- afl[afl$Week <= 80,] test <- afl[afl$Week > 80,] robj <- elo(train) pvals <- predict(robj, test)