# Introduction to the implied package

#### 2022-06-08

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 basic method

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)
#> If you find this package useful, please consider supporting the development at
#> https://ko-fi.com/opisthokonta

# 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 #> Home Draw Away #> [1,] 0.2331556 0.2646631 0.5021813 #> [2,] 0.3988848 0.2641264 0.3369888 #> [3,] 0.4586948 0.2938514 0.2474538 res1$margin
#> [1] 0.02118602 0.02326112 0.06346277

## Margin Weights Proportional to the Odds

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 #> Home Draw Away #> [1,] 0.2310332 0.2632083 0.5057585 #> [2,] 0.4004096 0.2625166 0.3370739 #> [3,] 0.4666506 0.2913457 0.2420036 # The margins applied to each outcome. res2$specific_margins
#>            Home       Draw       Away
#> [1,] 0.03056706 0.02683049 0.01396320
#> [2,] 0.01936444 0.02953607 0.02300299
#> [3,] 0.04533211 0.07260878 0.08741297

## The odds ratio method

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 #> Home Draw Away #> [1,] 0.2320048 0.2636415 0.5043537 #> [2,] 0.3996912 0.2633869 0.3369219 #> [3,] 0.4634406 0.2919032 0.2446562 # The odds ratios converting the proper probablities to bookmaker probabilities. res3$odds_ratios
#> [1] 1.034449 1.035805 1.102606

## The power method

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 #> Home Draw Away #> [1,] 0.2311414 0.2630644 0.5057941 #> [2,] 0.4003156 0.2627189 0.3369655 #> [3,] 0.4667137 0.2908986 0.2423877 # The inverse exponents (n) used to convert the proper probablities to bookmaker probabilities. res4$exponents
#> [1] 0.9797666 0.9788117 0.9419759

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 #> Home Draw Away #> [1,] 0.2310332 0.2632083 0.5057585 #> [2,] 0.4004096 0.2625166 0.3370739 #> [3,] 0.4666506 0.2913457 0.2420036 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') #> Warning in implied_probabilities(my_odds2, method = "additive"): Probabilities outside the 0-1 range produced at 1 instances. res6$probabilities
#>             X1        X2         X3          X4          X5          X6
#> [1,] 0.8283333 0.1583333 0.05833333 0.008333333 -0.02166667 -0.03166667

## Balanced books and Shin’s method

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 #> Home Draw Away #> [1,] 0.2315811 0.2635808 0.5048382 #> [2,] 0.4000160 0.2629336 0.3370505 #> [3,] 0.4645977 0.2919757 0.2434266 # The estimated proportion of inside traders. res7$zvalues
#> [1] 0.01054734 0.01157314 0.03187455
# Balanced books
res8 <- implied_probabilities(my_odds, method = 'bb')

res8$probabilities #> Home Draw Away #> [1,] 0.2299380 0.2624575 0.5076046 #> [2,] 0.4011989 0.2616832 0.3371179 #> [3,] 0.4710196 0.2899698 0.2390106 # The estimated proportion of inside traders. res8$zvalues
#> [1] 0.01059301 0.01163056 0.03173139

## The Jensen–Shannon distance method

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

and

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.

The method was developed by Christopher D. Long (twitter: @octonion), and described in a series of Twitter postings [1].

# Balanced books
res9 <- implied_probabilities(my_odds, method = 'jsd')

res9$probabilities #> Home Draw Away #> [1,] 0.2315189 0.2634117 0.5050694 #> [2,] 0.4000505 0.2629589 0.3369906 #> [3,] 0.4650456 0.2915675 0.2433869 # The estimated noise (JS distance) res9$distance
#> [1] 0.005485370 0.005849242 0.016099288

## Converting probabilities to odds

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[1],
method = 'power')

res_odds1$odds #> Home Draw Away #> [1,] 4.2 3.700001 1.950005 # The exponents. res_odds1$exponents
#> [1] 0.9797634

# Compare to the exponent from the odds-to-probability conversion.
res4\$exponents[1]
#> [1] 0.9797666

## Other packages

The odds.converter package can convert between different odds formats, including to decimal odds, that this package requires.

## Literature

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