knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This package contains functions that convert between bookmaker odds and probabilities. The function implied_probabilities() convert bookmaker odds into proper probabiltiies. The function implied_odds() does the inverse conversion, it turns proper probabilities into bookmaker odds. Several methods are available, with different assumptions regarding the underlying mechanism the bookmakers convert their probabilities into odds. The main focus of this introduction is present how the package works and the methods that convert bookmaker odds into probabilities and. Towards the end is a small demostration on how to convert probabiliteis to bookmaker odds.
A naive conversion of bookmaker odds into probabilities has two main problems. The first is that the probabilities are not proper probabilities, since they sum to more than 1. The excess probability is called the bookmakers margin. The second problem is that the probabilities, even if the margin is removed, will be biased in several ways, usually because of what is called the favorite-longshot bias. The methods in this package remove the bookmaker margin and some of them also adjust for favorite-longshot bias.
The default method used by the function implied_probabilities() is called the basic method. This is the simplest and most common method for converting bookmaker odds into probabilties, and is obtained by dividing the naive probabilities (the inverted odds) by the sum of the inverted odds. If pi is the true underlying probability for outcome i, and ri is the cooresponding inverted odds, then the probabilities are computed as
pi = ri / sum(r)
This method tend to be the least accurate of the methods in this package. I have also seen this normalization method been referred to as the multiplicative method.
The implied_probabilities() function return a list with the proper probabilities (as a matrix) and the bookmaker margins.
In the examples below are three sets of bookmaker odds from three football matches.
library(implied) # One column for each outcome, one row for each race or match. my_odds <- rbind(c(4.20, 3.70, 1.95), c(2.45, 3.70, 2.90), c(2.05, 3.20, 3.80)) colnames(my_odds) <- c('Home', 'Draw', 'Away') res1 <- implied_probabilities(my_odds) res1$probabilities res1$margin
This method is from Joseph Buchdahl's Wisom of the Crowds document, and assumes that the margin applied by the bookmaker for each of the outcome is proprtional to the probabilitiy of the outcome. In other words, the excessive probabilties are unevenly applied in a way that is reflects the favorite-longshot bias.
The probabilities are calculated from the bookmaker odds O using the following formula
pi = (n - M * Oi) / n * Oi
where n is the number of outcomes, and M is the bookmaker margin.
res2 <- implied_probabilities(my_odds, method = 'wpo') res2$probabilities # The margins applied to each outcome. res2$specific_margins
The odds ratio method is also from the Wisdom of the Crowds document, but is originally from an article by Keith Cheung. This method models the relationship between the proper probabilities and the improper bookmaker probabilties using the odds ratio (OR) function:
OR = pi (1 - ri) / ri (1 - pi)
This gives the probabilities
pi = ri / OR + ri - (OR * ri)
where the odds ratio OR is selected so that sum(pi) = 1.
res3 <- implied_probabilities(my_odds, method = 'or') res3$probabilities # The odds ratios converting the proper probablities to bookmaker probabilities. res3$odds_ratios
The power method models the bookmaker probabilties as a power function of the proper probabilties. This method is also described in the Wisdom of the Crowds document, where it is referred to as the logarithmic method.
pi = ri(1/k)
where k is selected so that sum(pi) = 1.
res4 <- implied_probabilities(my_odds, method = 'power') res4$probabilities # The inverse exponents (n) used to convert the proper probablities to bookmaker probabilities. res4$exponents
The additive method removes the margin from the naive probabilites by subtracting an equal amount of of the margin from each outcome. The formula used is
pi = ri - ((sum(r) - 1) / n)
If there are only two outcomes, the additive method and Shin's method are equivalent.
res5 <- implied_probabilities(my_odds, method = 'additive') res5$probabilities
One problem with the additive method is that it can produce negative probabilities, escpecially for outcomes with low probabilties. This can often be the case when there are many outcomes, for example in racing sports. If this happens, you will be given a warning. Here is an example taken from Clarke et al (2017):
my_odds2 <- t(matrix(1/c(0.870, 0.2, 0.1, 0.05, 0.02, 0.01))) colnames(my_odds2) <- paste('X', 1:6, sep='') res6 <- implied_probabilities(my_odds2, method = 'additive') res6$probabilities
The two methods referred to as "balanced book" and Shin's method are based on the assumption that there is a small proportion of bettors that actually knows the outcome (called inside traders), and the rest of the bettors reflect the otherwise "true" uncertainty about the outcome. The proportion of inside traders is denoted Z.
The two methods differ in what assumptions they make about how the bookmakers react to the pressence of inside traders. Shin's method is derived from the assumption that the bookmakers tries to maximize their profits when there are inside traders. The balanced books method assumes the bookmakers tries to minimize their losses in the worst case scenario if the least likely outcome were to acctually occur.
We can not know what the insiders know, but both methods gives an estimate of the proportion of insiders.
res7 <- implied_probabilities(my_odds, method = 'shin') res7$probabilities # The estimated proportion of inside traders. res7$zvalues
# Balanced books res8 <- implied_probabilities(my_odds, method = 'bb') res8$probabilities # The estimated proportion of inside traders. res8$zvalues
This method sees the improper bookmaker probabilties as a noisy version of the true underlying probabilities, and uses the Jensen–Shannon (JS) distance as a measure of how noisy the bookmaker probabilities are.
For the sake of finding the denoised proabilities pi, each outcome i is modelled as a binomial variable, with outcomes i and NOT i. These have probabilities pi and 1-pi, with corresponding improper bookmaker probabilities ri and 1-ri. For a given noise-level D, as measued by the symmetric JS distance, the underlying probabilities can be found by solving the JS distance equation for pi:
D = 0.5 * BKL(pi, mi) + 0.5 * BKL(ri, mi)
where mi = (pi + ri) / 2
BKL(x, y) = x * log(x/y) + (1-x) * log((1-x)/(1-y))) + y * log(y/x) + (1-y) * log((1-y)/(1-y))
is the "binomial" Kullback–Leibler divergence.
The solution is found numerically by finding the value of of D so that sum(pi) = 1.
# Balanced books res9 <- implied_probabilities(my_odds, method = 'jsd') res9$probabilities # The estimated noise (JS distance) res9$distance
There is also a function that can do the opposite what the implied_probabilities() function does, namely the implied_odds() function. This function converts probabilities to odds, for a given margin, the inverse of the methods as described above. Not all methods have been implemented yet. Take a look at the help file for the function for more details.
In the code example below we use take the results of converting the odds to probabilities using the power method, and convert them back to odds again, with the same margin. We pretty much recover the original odds, except for some small numerical inaccuracy.
res_odds1 <- implied_odds(res4$probabilities[1,], margin = res4$margin, method = 'power') res_odds1$odds # The exponents. res_odds1$exponents # Compare to the exponent from the odds-to-probability conversion. res4$exponents
The odds.converter package can convert between different odds formats, including to decimal odds, that this package requires.
Here are some relevant references and links:
Joseph Buchdahl - USING THE WISDOM OF THE CROWD TO FIND VALUE IN A FOOTBALL MATCH BETTING MARKET Link
Keith Cheung (2015) Fixed-odds betting and traditional odds Link
Stephen Clarke, Stephanie Kovalchik & Martin Ingram (2017) Adjusting Bookmaker’s Odds to Allow for Overround Link
Hyun Song Shin (1992) Prices of State Contingent Claims with Insider Traders, and the Favourite-Longshot Bias Link
Hyun Song Shin (1993) Measuring the Incidence of Insider Trading in a Market for State-Contingent Claims Link
Bruno Jullien & Bernard Salanié (1994) Measuring the incidence of insider trading: A comment on Shin Link
John Fingleton & Patrick Waldron (1999) Optimal Determination of Bookmakers' Betting Odds: Theory and Tests.Link
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.