R/elo_prediction.R

Defines functions elo_prediction

Documented in elo_prediction

#' Elo-Based Win Prediction
#'
#' This function returns the match win prediction based on player Elo ratings
#'
#' @param rating1 Numeric of Player 1 Elo rating
#' @param rating2 Numeric of Player 2 Elo rating
#'
#' @examples
#' elo_prediction(2000, 1842)
#'
#' @export
#'
#' @return Match win probability for Player 1
elo_prediction <- function(rating1, rating2){
	
	rating_diff <- rating2 - rating1
	
1 / (1 + 10^(rating_diff / 400))
}

elo_prediction <- Vectorize(elo_prediction)
skoval/deuce documentation built on March 7, 2023, 2:39 p.m.