No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
man
.Rbuildignore
.gitignore First commit Nov 5, 2018
DESCRIPTION First commit Nov 5, 2018
NAMESPACE
README.Rmd Link to the odds.converter package. Nov 17, 2018
README.md
implied.Rproj First commit Nov 5, 2018

README.md

implied

This package contain a single function, implied_probabilities(), that convert bookmaker odds into proper probabiltiies. Several methods are available, with different assumptions regarding the underlying mechanism the bookmakers convert their probabilities into 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.

Installation

install.packages("devtools")
devtools::install_github("opisthokonta/implied")

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)

# 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

Shin's method

Shin's method is 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. Unfortunately, we can not know what the insiders know, but Shin's method gives an estimate of the proportion of insiders (denoted Z).

res2 <- implied_probabilities(my_odds, method = 'shin')

res2$probabilities
#>           Home      Draw      Away
#> [1,] 0.2315716 0.2635742 0.5048542
#> [2,] 0.4000221 0.2629271 0.3370508
#> [3,] 0.4645882 0.2919788 0.2434331

# The estimated proportion of inside traders.
res2$zvalues
#> [1] 0.01061048 0.01163552 0.03182353

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 can be calculated from the bookmaker odds O using the following formula

pi = n * Oi / (n - M * Oi)

where n is the number of outcomes, and M is the bookmaker margin.

res3 <- implied_probabilities(my_odds, method = 'wpo')

res3$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.
res3$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.

res4 <- implied_probabilities(my_odds, method = 'or')

res4$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.
res4$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/n)

where n 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.5057942
#> [2,] 0.4003156 0.2627189 0.3369655
#> [3,] 0.4667139 0.2908985 0.2423876

# The inverse exponents (n) used to convert the proper probablities to bookmaker probabilities.
res4$exponents
#> [1] 0.9797664 0.9788115 0.9419744

Other packages

The only other R package I know of with related functionality is the gambleR package. 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: