Title: | Convert Between Bookmaker Odds and Probabilities |
---|---|
Description: | Convert between bookmaker odds and probabilities. Eight different algorithms are available, including basic normalization, Shin's method (Hyun Song Shin, (1992) <doi:10.2307/2234526>), and others. |
Authors: | Jonas Christoffer Lindstrøm |
Maintainer: | Jonas Christoffer Lindstrøm <[email protected]> |
License: | GPL-3 |
Version: | 0.5 |
Built: | 2025-01-29 05:39:08 UTC |
Source: | https://github.com/opisthokonta/implied |
This functions converts probabilities to odds in decimal format, while adding overround.
The function does the inverse of what the function implied_probabilities
does.
implied_odds( probabilities, method = "basic", margin = 0, grossmargin = NULL, normalize = TRUE )
implied_odds( probabilities, method = "basic", margin = 0, grossmargin = NULL, normalize = TRUE )
probabilities |
A matrix or numeric of probabilities, where each column is an outcome. |
method |
A string giving the method to use. Valid methods are 'basic', 'shin', 'bb', 'wpo', 'or', 'power' or 'additive'. |
margin |
numeric. How large margin (aka overround) should be added to the probabilities. |
grossmargin |
Numeric. Must be 0 or greater. See the details. |
normalize |
Logical. If TRUE (default), scale the input probabilites to sum to 1. |
A named list. The first component is named 'odds' and contain a matrix of implied odds. The second depends on the method used to compute the probabilities.
This function calculate the implied probabilities from bookmaker odds in decimal format, while accounting for over-round in the odds.
implied_probabilities( odds, method = "basic", normalize = TRUE, target_probability = 1, grossmargin = 0, shin_method = "js", shin_maxiter = 1000, uniroot_options = NULL )
implied_probabilities( odds, method = "basic", normalize = TRUE, target_probability = 1, grossmargin = 0, shin_method = "js", shin_maxiter = 1000, uniroot_options = NULL )
odds |
A matrix or numeric of bookmaker odds. The odds must be in the decimal format. |
method |
A string giving the method to use. Valid methods are 'basic', 'shin', 'bb', 'wpo', 'or', 'power', 'additive', and 'jsd'. |
normalize |
Logical. Some of the methods will give small rounding errors. If TRUE (default) a final normalization is applied to make absolutely sure the probabilities sum to 1. |
target_probability |
Numeric. The value the probabilities should sum to. Default is 1. |
grossmargin |
Numeric. Must be 0 or greater. See the details. |
shin_method |
Character. Either 'js' (default) or 'uniroot'. See the details. |
shin_maxiter |
numeric. Max number of iterations for shin method 'js'. |
uniroot_options |
list. Option passed on to the uniroot solver, for those methods where it is applicable. See 'details'. |
The method 'basic' is the simplest method, and computes the implied probabilities by dividing the inverted odds by the sum of the inverted odds.
The methods 'wpo' (Weights Proportional to the Odds), 'or' (Odds Ratio) and 'power' are form the Wisdom of the Crowds document (the updated version) by Joseph Buchdahl. The method 'or' is originally by Cheung (2015), and the method 'power' is there referred to as the logarithmic method.
The method 'shin' uses the method by Shin (1992, 1993). This model assumes that there is a fraction of insider trading, and that the bookmakers tries to maximize their profits. In addition to providing implied probabilities, the method also gives an estimate of the proportion if inside trade, denoted z. Two algorithms are implemented for finding the probabilities and z. Which algorithm to use is chosen via the shin_method argument. The default method (shin_method = 'js') is based on the algorithm in Jullien & Salanié (1994). The 'uniroot' method uses R's built in equation solver to find the probabilities. The uniroot approach is also used for the 'pwr' and 'or' methods. The two methods might give slightly different answers, especially when the bookmaker margin (and z) is small.
The 'bb' (short for "balanced books") method is from Fingleton & Waldron (1999), and is a variant of Shin's method. It too assume a fraction of insiders, but instead of assuming that the bookmakers maximize their profits, they minimize their risk.
Both the 'shin' and 'bb' methods can be used together with the 'grossmargin' argument. This is also from the Fingleton & Waldron (1999) paper, and adds some further assumption to the calculations, related to operating costs. grossmargin should be 0 (default) or greater, typical range is 0 to 0.05. For values other than 0, this might sometimes cause some probabilities to not be identifiable. A warning will be given if this happens.
The method 'jsd' was developed by Christopher D. Long, and described in a series of Twitter postings and a python implementation posted on GitHub.
Methods 'shin', 'or', 'power', and 'jsd' use the uniroot solver to find the correct probabilities. Sometimes it will fail to find a solution, but it can be made to work by tuning some setting. The uniroot_options argument accepts a list with options that are passed on to the uniroot function. Currently the interval, maxit, tol and extendInt argument of uniroot can be changed. See the Troubleshooting vignette for more details.
A named list. The first component is named 'probabilities' and contain a matrix of implied probabilities. The second is the bookmaker margins (aka the overround). The third depends on the method used to compute the probabilities:
zvalues (method = 'shin' and method='bb'): The estimated amount of insider trade.
specific_margins (method = 'wpo'): Matrix of the margins applied to each outcome.
odds_ratios (method = 'or'): Numeric with the odds ratio that are used to convert true probabilities to bookmaker probabilities.
exponents (method = 'power'): The (inverse) exponents that are used to convert true probabilities to bookmaker probabilities.
distance (method = 'jsd'): The Jensen-Shannon distances that are used to convert true probabilities to bookmaker probabilities.
The fourth component 'problematic' is a logical vector called indicating if any probabilities has fallen outside the 0-1 range, or if there were some other problem computing the probabilities.
Hyun Song Shin (1992) Prices of State Contingent Claims with Insider Traders, and the Favourite-Longshot Bias
Hyun Song Shin (1993) Measuring the Incidence of Insider Trading in a Market for State-Contingent Claims
Bruno Jullien & Bernard Salanié (1994) Measuring the incidence of insider trading: A comment on Shin.
John Fingleton & Patrick Waldron (1999) Optimal Determination of Bookmakers' Betting Odds: Theory and Tests.
Joseph Buchdahl - USING THE WISDOM OF THE CROWD TO FIND VALUE IN A FOOTBALL MATCH BETTING MARKET (https://www.football-data.co.uk/wisdom_of_crowd_bets)
Keith Cheung (2015) Fixed-odds betting and traditional odds (https://www.sportstradingnetwork.com/article/fixed-odds-betting-traditional-odds/)
# Two sets of odds for a three-outcome game. my_odds <- rbind(c(4.20, 3.70, 1.95), c(2.45, 3.70, 2.90)) # Convert to probabilities using Shin's method. converted_odds <- implied_probabilities(my_odds, method='shin') # Look at the probabilities converted_odds$probabilities
# Two sets of odds for a three-outcome game. my_odds <- rbind(c(4.20, 3.70, 1.95), c(2.45, 3.70, 2.90)) # Convert to probabilities using Shin's method. converted_odds <- implied_probabilities(my_odds, method='shin') # Look at the probabilities converted_odds$probabilities