predict.mELO_rating: Predict results of a game from a ELO or mELO model

Description Usage Arguments Value Examples

View source: R/predict.mELO_rating.R

Description

This function gives predictions of success probabilities for agent or player 1 from a fitted ELO or mELO model (a mELO_rating oject).

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'mELO_rating'
predict(
  object,
  new_match_data,
  min_games = 15,
  default_ratings = NULL,
  p1_advantage = 0,
  thresh
)

Arguments

object

An object of class mELO_rating.

new_match_data

A data frame containing four columns: (1) a numeric vector denoting the time period in which the game took place (2) a numeric or character identifier for player one (3) a numeric or character identifier for player two.

min_games

A single value. If the number of games of either player is below this value, the prediction will be based on the default_ratings parameter.

default_ratings

The rating to be used for agents or players who have not yet played min_games.

p1_advantage

Player 1 advantage parameter. A single value or numeric vector with length equal to the number of rows in new_match_data. Can be though of as representing first move or home ground advantage.

thresh

A single value. If given, a binary vector is returned indicating whether the prediction is greater than this value.

Value

A numeric vector of predictions, which may contain missing values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Rock paper scissors
head(rps_df)

# Note that ELO doesn't perform well
rps_ELO <- ELO(rps_df)
rps_ELO
ELO_preds <- predict(
    rps_ELO,
    head(rps_df)
)
cbind(
    head(rps_df),
    ELO_preds
)
    # Predictions are all ~0.5

# Fit a mELO model that can handle these types of interactions.
rps_mELO <- mELO(rps_df, k=1)
rps_mELO
# Inspect advantage matrix
get_adv_mat(rps_mELO)
# Get predictioncs
mELO_preds <- predict(
    rps_mELO,
    head(rps_df)
)
cbind(
    head(rps_df),
    mELO_preds
)
    # Much better predictions!

dclaz/mELO documentation built on May 17, 2021, 2:27 a.m.