Scibrokes® TonyStark®

Abstract

This is an academic research by apply R statistics analysis to an agency A of an existing betting consultancy firm A. According to the Dixon and Pope (2003), due to business confidential and privacy I am also using agency A and firm A in this paper. The purpose of the anaysis is measure the staking model of the firm A. For more sample which using R for Soccer Betting see http://rpubs.com/englianhu. Here is the references of rmarkdown and An Introduction to R Markdown. You are welcome to read the Wrangling F1 Data With R if you are getting interest to write a data analysis on Sports-book.

1. Introduction to the Betting Stategics

There are quite some betting strategies in sport-book industry. Value betting is the popular staking strategy. Money management is the key for betting strategy.

The best and the most successful punters are money managers looking for ideal situations, which are defined as matches with only high percentage of return. In individual situations luck will play into the outcome of an event, which no amount of odds compiling can overcome, but in the long run a disciplined punter will win more of those lucky games than lose.

2. Dataset

2.1 Collect and Reprocess the Dataset

I collect the data-set of World Wide soccer matches from year 2011 until 2015 from a British betting consultancy named firm A. All bets placed by display on HK currency, and the odds price also measure based on Hong Kong price.

I tried to apply RSelenium on RStudio Server Centos7 to scrape the data from live-score website includes the odds price but the binary phantomjs is not available for Linux, and I also not familiar with the installation of Java as well as setting of the path for rJava. Kindly refer to Natural Language Analysis for more information about the teams name matching.

table 2.1.1 : 48640 x 41 : Sample data collected for the research.

In order to analyse the AHOU, here I’ve filtered out all soccer matches other than AHOU which is the table showing above (For example : Corners, Total League Goals etc.) for whole research paper. Please refer to Natural Language Analysis to see the firm A staking raw data-set.

You are feel free to read Asian Handicap and Arbitrage of Synthetic Asian Handicap Bets for some basic lession about Asian Handicap Bets.

2.2 Overrounds / Vigorish

Fair odds: the odds that would be offered if the sum of the probabilities for all possible outcomes were exactly 1 (100%). For example, supposing we had a market with three possible outcomes {A, B, C} with probabilities of success \(P(A) = 0.5, P(B) = 0.4\) and \(P(C) = 0.1\), the fair odds would be 2.00, 2.50, and 10.00 respectively, which are just the inverse of the estimated probabilities.

Overround: Also called vigorish (or vig for short) in American sports betting, the over-round is a measure of the bookmaker’s edge over the gambler. The bookmaker will never offer fair odds on a market. In practice, the payout offered on each selection will be reduced, which in turn increases the reflected probability of an event. When odds have been adjusted in this way the sum of the probabilities for all events will exceed 1 (100%). The over-round is the amount by which the sum of all probabilities exceeds 100% and it is the bookmaker’s profit margin.

For example, if we had a market with two possible outcomes {A, B}, where \(P(A) = P(B) = 0.5\), the fair odds on each selection would be 2.00. However, the bookmaker may offer payouts of 1.85 on each selection. The corresponding probabilities for each selection are now 1/1.85 = 0.5405405, and the sum of the probabilities for all outcomes is 0.5405405 x 2 = 1.0810811. The over-round is 8.1%, and for every $100 paid out by gamblers the bookmaker expects to make a profit of 8.1 dollars, assuming that there are balanced bets on both A and B.

I just simply get the lay price by applying below equation.

\[P_i^{HK_{Lay}} = 1/P_i^{HK_{Back}}-\nu_{j}\] equation 2.2.1

While \(\nu\) is the vigorish and \(j={1,2}\) which are AH=0.1 and OU=0.1. I have just simply calculated the Layed Fair odds (Odds Price with Vigorish which offer by operators), here I apply a setting profile which is term as lProfile (you can casually edit the soccer match profile setting) to get the Real Odds (Net Odds Price without Vigorish). As well as the Value \(Value = Real Price/Fair Odds\). Here we can use the Bet Stake Calculator Kelly Staking Calculator. I simply reverse value \(\Re\) to get the estimated \(P_{i}^{EM}\) (firm A) where we will talk in Section 4.1 Linear Model and later 4.3 Poisson Modelling about odds modelling.

Table 2.2.1 : Sample Data of Virogish/Overrounds and Odds Price
No EUPrice HKPrice fHKPriceL fMYPriceB fMYPriceL netProbB netProbL
50 2.00 1.00 0.880 1.000 0.880 0.5319 0.4681
72 1.78 0.78 1.100 0.780 -0.909 0.4149 0.5851
122 2.11 1.11 0.781 -0.901 0.781 0.5870 0.4130
123 1.64 0.64 1.241 0.640 -0.806 0.3402 0.6598
164 1.97 0.97 0.910 0.970 0.910 0.5160 0.4840
219 1.92 0.92 0.980 0.920 0.980 0.4842 0.5158

table 2.2.1 : 48640 x 41 : Vigorish, price and probabilities sample table.

Above table 2.2.1 just provides some sample about the odds price and over-round while you can refer to table 2.1.1 for details. Meanwhile, you can know more details about the return of investment, convertion and also origin region based on same probabilities among different Odds Types/Styles via Betting Odds Converter or just simply google’ing.

3. Summarise the Staking Model

3.1 Summarise Diversified Periodic Stakes

Before we start analyse the staking model, we are firstly see some diversified periodic breakdown Stakes and Profit & Lose of the Agency A.

graph 3.1.1 : Investment Annual summary graph.

From the graph above showing that the investment of firm A through agency A generates a positive return (profit). Please refer to table 4.1.1 for more details about investment analysis.

table 3.1.1 : 55 x 16 : Investment monthly breakdown table.

From the table above, we realized that the Asian agency A make profit by follow the British sports betting consultancy firm A every year. Since thousands of bets (and maximum bet limit setting, league profile setting, and also value betting which properly based on Kelly model, mean value will be kinda bias) placed per month, here we take median will be accurate than mean value.

graph 3.1.2 : Investment monthly trend graph.

table 3.1.2 : 383 x 17 : Investment daily breakdown table.

graph 3.1.3 : Investment daily trend graph.

From the graph above, we can easily know the figure of Stakes, Returns and Profit & Lose while below table separate into daily breakdown. The table shows the daily stakes and also quantile values.

3.2 Summarise the Staking Handicap

table 3.2.1a : 30 x 18 : Asian Handicap - handicap breakdown table.

table 3.2.1b : 60 x 18 : Goal Line - handicap breakdown table.

Table 3.2.1c : Sample data about Handicap, Stakes and PL
HCap AHOU Stakes Return PL R.percent PL.percent
0.50 AH 134536.2 134138.0 -398.1590 0.9970% -0.0030%
-0.25 AH 157391.8 209674.0 52282.1525 1.3322% 0.3322%
0.25 AH 233920.2 235755.7 1835.4312 1.0078% 0.0078%
0.00 AH 262692.1 270381.5 7689.4210 1.0293% 0.0293%
3.00 OU 78662.0 79823.7 1161.6975 1.0148% 0.0148%
2.50 OU 79000.0 79756.0 756.0025 1.0096% 0.0096%
2.00 OU 104969.2 111165.0 6195.8041 1.0590% 0.0590%
2.25 OU 110072.4 132015.5 21943.1013 1.1994% 0.1994%

table 3.2.1c : 8 x 7 : Handicap, stakes and PL sample table.

From above tables, firm A mostly placed on Asian Handicap range concedes/taken 0 ball on agency A. Menwhile the odds -0.25 is most profitable from return rate.

Secondly, from the Goal Line mostly taking over selection on 2 balls. (Since Dutch, Japanese, Spanish and Women soccer leagues always scoring more goals, but Portuguese, Italian, French leagues always score less, English leagues average 2.5 balls)

graph 3.2.1a : Asian Handicap - handicap breakdown staking graph.

graph 3.2.1b : Goal Line - handicap breakdown staking graph.

Now we look at the graph above, we can know the Stakes breakdown on both AH and OU.

3.3 Summarise the Staking Prices

table 3.3.1a : 49 x 18 : Asian Handicap - price range breakdown table.

table 3.3.1b : 32 x 18 : Goal Line - price range breakdown table.

Table 3.3.1c : Sample data about Price Range, Stakes and PL
pHKRange pMYRange Stakes Return PL R.percent PL.percent
(0.6,0.7] (0.6,0.7] 123154.8 136124.8 12970.01 1.1053% 0.1053%
(1.1,1.2] (-0.9,-0.8] 126400.0 138462.0 12062.03 1.0954% 0.0954%
(0.7,0.8] (0.7,0.8] 278201.2 296874.7 18673.48 1.0671% 0.0671%
(1,1.1] (-1,-0.9] 354514.3 385962.6 31448.23 1.0887% 0.0887%
(0.8,0.9] (0.8,0.9] 460616.2 501271.2 40655.00 1.0883% 0.0883%
(0.9,1] (0.9,1] 496308.3 544973.5 48665.12 1.0981% 0.0981%

table 3.3.1c : 6 x 7 : Price range, stakes and PL sample table.

From above tables, the price range on (0.9,1] are mostly been placed. We try to compare the stakes between 0.70~0.80 and 1.10~1.20, 0.60~0.70 and 1.20~1.30 and the returns/profit, we will know the price is importance on Value Betting.

graph 3.3.1a : Asian Handicap - price range staking graph.

graph 3.3.1b : Goal Line - price range staking graph.

Above graph shows the Stakes and P&L on different price range in MY Odds style. In fact the MY Odds Style will be easier to count and understand in statistics as well as plot graph since the return (both won and lost) will be ONLY from -1 to 1 while HK/Europe Odds Style will count from -1 to Inf. However I keep both HKOdds and MYOdds Please refer to table 2.2.1 for more details.

However, due to consideration of the stakes amount, here I just simply use the HK in order to make the Stakes and Return/PL exactly same with the dataset.

3.4 Summarise the In-Play Staking Timing

table 3.4.1a : 27 x 18 : Asian Handicap - In-Play time range breakdown table.

table 3.4.1b : 23 x 18 : Goal Line - In-Play time range breakdown table.

The table above shows the breakdown stakes on Breaks includes pregames of Extra-Time (started 90 minutes games), Half-Time and Full-Time in both 90 minutes games and also Extra-Time, Injuries-Time, Breaks-Time etc (All stakes after blew game-start whistle and before final result). While No means pre-games stakes and P&L summary.

graph 3.4.1a : Asian Handicap - In-Play time range graph.

graph 3.4.1b : Goal Line - In-Play time range graph.

From the above graph shows the In-Play stakes, the first (0,10] time range placed most stakes while (55,60] start dropping. The <NA> includes all stakes when the soccer players are not playing on the football field. (Pre-games, Half-Time, Full-Time, Extra-Time, Injuries Time, Breaks Time etc.)

3.5 Summarise the In-Play Staking Based on Current Score

table 3.5.1a : 231 x 18 : Asian Handicap - In-Play state-space staking breakdown table.

table 3.5.1b : 341 x 18 : Goal Line - In-Play state-space staking breakdown table.

Above table shows a further details breakdown of In-Play stakes, includes the current scores and also current concedes/given handicap during In-Play while <NA> during Break means Break-Time or pre-Extra-Time etc. The complete data is dim(sample.data) 231 x 18 and 341 x 18 for both AH and OU.

graph 3.5.1a : Asian Handicap - In-Play state-space graph.

graph 3.5.1b : Goal Line - In-Play state-space graph.

Section 3 summarise breakdown tables and also graphs on the investment of firm A. Basically, soccer sports investment need to consider below criteria :

While the further linear model will also take above criteria for investment. You can also refer to my previous research which is Odds Modelling and Testing Inefficiency of Sports-Bookmakers.

4. Staking Model

4.1 Linear Model

Before we start modelling, we look at the summary of investment return rates.

Table 4.1.1 : Annual Return of Investment. (’0,000)
Sess Stakes Return n rRates
2011 352953.2 380126.9 6441 1.076989
2012 425665.4 471305.4 10159 1.107220
2013 491434.3 529818.1 12494 1.078106
2014 464431.5 517768.0 12620 1.114843
2015 247873.0 264508.0 6926 1.067111

table 4.1.1 : 5 x 5 : Return of annually investment summary table.

\[\Re = \sum_{i=1}^{n}\rho_{i}^{EM}/\sum_{i=1}^{n}\rho_{i}^{BK}\] equation 4.1.1

\(\Re\) is the return rates of investment. The \(\rho_i^{EM}\) is the estimated probabilities which is the calculated by firm A from match 1,2… until \(n\) matches while \(\rho_{i}^{BK}\) is the net/pure probability (real odds) offer by bookmakers after we fit the equation 4.1.2 into equation 4.1.1.

\[\rho_i = P_i^{Lay} / (P_i^{Back} + P_i^{Lay})\] equation 4.1.2

\(P_i^{Back}\) and \(P_i^{Lay}\) is the backed and layed fair price offer by bookmakers.

We can simply apply equation above to get the value \(\Re\). From the table above we know that the EMPrice calculated by firm A invested at a threshold edge (price greater) 1.0769894, 1.1072203, 1.0781056, 1.1148426, 1.0671108 than the prices offer by bookmakers. There are some description about \(\Re\) on Dixon & Coles 1996. The optimal value of \(\pho_{i}\) (rEMProbB) will be calculated based on bootstrapping/resampling method in section 4.2 Kelly Model.

Table 4.1.2 : Probabilities Table
No EUPrice HKPrice fHKPriceL fMYPriceB fMYPriceL netProbB netProbL rEMProbB rEMProbL favNetProb undNetProb
5752 2.24 1.24 0.706 -0.806 0.706 0.6374 0.3626 0.705742 0.294258 0.6374 0.3626
5697 1.80 0.80 1.100 0.800 -0.909 0.4211 0.5789 0.453520 0.546480 0.4211 0.5789
11616 2.05 1.05 0.852 -0.952 0.852 0.5521 0.4479 0.615505 0.384495 0.4479 0.5521
6783 2.46 1.46 0.585 -0.685 0.585 0.7139 0.2861 0.769660 0.230340 0.7139 0.2861
9358 2.04 1.04 0.862 -0.962 0.862 0.5468 0.4532 0.609596 0.390404 0.4532 0.5468
5121 2.10 1.10 0.809 -0.909 0.809 0.5762 0.4238 0.642372 0.357628 0.4238 0.5762

table 4.1.2 : 48640 x 43 : Odds price and probabilities sample table.

Above table list a part of sample odds prices and probabilities of soccer match \(i\) while \(n\) indicates the number of soccer matches. We can know the values rEMProbB, netProbB and so forth.

graph 4.1.1 : A sample graph about the relationship between the invvestmental probabilities -vs- bookmakers’ probabilities.

Graph above shows the probabilities calculated by firm A to back against real probabilities offered by bookmakers over 48640 soccer matches.

Now we look at the result of the soccer matches.

Table 4.1.3 : Summary of Betting Results
Result Stakes Return Rates n S.prop R.prop prop
Cancelled 3417 3417 1 122 0.0017 0.0016 0.0025
Half Loss 136834.5 205251.75 1.5 3309 0.069 0.0949 0.068
Half Win 149055.25 215794.3459 1.44774736817388 3590 0.0752 0.0997 0.0738
Loss 688224.84 0 0 17117 0.3472 0 0.3519
Push 204866.5 204866.5 1 4426 0.1033 0.0947 0.091
Win 799959.34 1534196.7576 1.91784342139189 20076 0.4035 0.7091 0.4127
Total 1982357.43 2163526.3535 1.09139064467299 48640 0.9999 1 0.9999

table 4.1.3 : 7 x 8 : Summary of betting results.

The table above summarize the stakes and return on soccer matches result.

[1] -3.50 -3.25 -3.00 -2.75 -2.50 -2.25 -2.00 -1.75 -1.50 -1.25 -1.00 [12] -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 [23] 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 [34] 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 [45] 7.50 7.75 8.00 8.25

## Test
## Choosing the variables of linear models
#'@ summary(lm(Return~HCap, data=dat))
#'@ summary(lm(Return~HKPrice, data=dat))
#'@ summary(lm(Return~HCap+HKPrice, data=dat))
#'@ summary(lm(Return~HCap+pHKRange, data=dat))
#'@ summary(lm(Return~ipRange, data=dat))
#'@ summary(lm(Return~ipHCap, data=dat))
#'@ summary(lm(Return~CurScore+ipHCap, data=dat))
#'@ summary(lm(Return~CurScore+ipRange, data=dat))
#'@ summary(lm(Return~CurScore+ipRange+ipHCap, data=dat))

## Choosing the variables of linear models
#'@ summary(lm(Stakes~HCap, data=dat))
#'@ summary(lm(Stakes~HKPrice, data=dat))
#'@ summary(lm(Stakes~HCap+HKPrice, data=dat))
#'@ summary(lm(Stakes~HCap+pHKRange, data=dat))
#'@ summary(lm(Stakes~ipRange, data=dat))
#'@ summary(lm(Stakes~ipHCap, data=dat))
#'@ summary(lm(Stakes~CurScore+ipHCap, data=dat))
#'@ summary(lm(Stakes~CurScore+ipRange, data=dat))
#'@ summary(lm(Stakes~CurScore+ipRange+ipHCap, data=dat))

4.2 Kelly Model

From the papers Niko Marttinen2001 and Jeffrey Alan Logan Snyder 2013 both applying Full-Kelly,Half-Kelly and also Quarter-Kelly models which similar with my previous Kelly-Criterion model englianhu2014 but enhanced.

To achieve the level of profitable betting, one must develop a correct money management procedure. The aim for a punter is to maximize the winnings and minimize the losses. If the punter is capable of predicting accurate probabilities for each match, the Kelly criterion has proven to work effectively in betting. It was named after an American economist John Kelly (1956) and originally designed for information transmission. The Kelly criterion is described below:

\[S=(\rho*\sigma-1)/(\sigma-1)\] equation-4.2.1

Where S = the stake expressed as a fraction of one’s total bankroll, \(\rho\) = probability of an event to take place, \(\sigma\) = odds for an event offered by the bookmaker. Three important properties, mentioned by Hausch and Ziemba (1994) (Efficiency of Racetrack Betting Markets (2008Edition)), arise when using this criterion to determine a proper stake for each bet:

  • It maximizes the asymptotic growth rate of capital

  • Asymptotically, it minimizes the expected time to reach a specified goal

  • It outperforms in the long run any other essentially different strategy almost surely

The criterion is known to economists and financial theorists by names such as the geometric mean maximizing portfolio strategy, the growth-optimal strategy, the capital growth criterion, etc. We will now show that Kelly betting will maximize the expected log utility for sports-book betting.

[1] 23.71528

\[K = \frac{(B + 1)p - 1} {B}\] equation 4.2.1

\[G: = \mathop {\lim }\limits_{N \to \infty } \frac{1/N}{\log}\left( {\frac{{{BR_N}}}{{{BR_0}}}} \right)\] equation 4.2.2

\[BR_N = (1 + K)^W(1 - K)^L BR_0\] equation 4.2.3

Kelly K-value 凯利模式资金管理

## Bootstrapping to get the optimal value
#'@ llply(rEMProbB)

table 4.2.2

In order to get the optimal value, I apply the bootrapping and resampling method.

\[\L(\rho) = \prod_{i=1}^{n} (x_{i}|\rho)\] equation 4.1.3

Now we look at abpve function from a different perspective by considering the observed values \(x1, x2, …, xn\) to be fixed parameters of this function, whereas \(\rho\) will be the function’s variable and allowed to vary freely; this function will be called the likelihood.

4.3 Poisson Modelling

Here we introduce the Dixon & Coles 1996 Poisson model and its codes. You are freely learning from below links if interest.

Due to the soccer matches randomly getting from different leagues, and also not Bernoulli win-lose result but half win-lose etc as we see from above. Besides, there were mixed Pre-Games and also In-Play soccer matches and I filter-up the sample data to be 20009 x 43. I don’t pretend to know the correct answer or the model from firm A. However I take a sample presentation An introduction to football modelling at Smartodds from one of consultancy firm which is Dixon-Coles model and omitted the scoring process section.

Here I cannot reverse computing from barely \(\rho_i^{EM}\) without know the \(\lambda_{ij}\) and \(\gamma\) values. Therefore I try to using both Home and Away Scores to simulate and test to get the maximum likelihood \(\rho_i^{EM}\).

\[X_{ij} = pois(\gamma \alpha_{ij} \beta_{ij} ); Y_{ij} = pois(\alpha_{ij} \beta_{ij})\] equation 4.1.3

sample…

4.4 Staking Modelling and Money Management

sample… Geometric Mean

4.5 Expectation Maximization and Staking Simulation

sample…

5. Result

5.1 Comparison of the Results

Chapter 4.2 Comparison of Different Feature Sets and Betting Strategies in

Dixon&Pope2003 apply linear model to compare the efficiency of the odds prices offer by first three largest Firm A, B and C in UK.

5.2 Market Basket

Here I apply the arules and arulesViz packages to analyse the market basket of the bets.

6. Conclusion

6.1 Conclusion

Due to the data-sets I collected just one among all agents among couple sports-bookmakers 4lowin. Here I cannot determine if the sample data among the population…

6.2 Future Works

I will be apply Shiny to write a dynamic website to utilise the function as web based apps. You are welcome to refer SHOW ME SHINY.

I will also write as a package to easier load and log.

7. Appendices

7.1 Documenting File Creation

It’s useful to record some information about how your file was created.

  • File creation date: 2015-07-22
  • R version 3.2.3 (2015-12-10)
  • R version (short form): 3.2.3
  • rmarkdown package version: 0.9.2
  • File version: 1.0.0
  • File latest updated date: 2016-02-19
  • Author Profile: ®γσ, Eng Lian Hu
  • GitHub: Source Code
  • Additional session information

[1] “2016-02-19 12:22:53 EST” setting value
version R version 3.2.3 (2015-12-10) system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
tz America/New_York
date 2016-02-19
sysname release “Linux” “3.10.0-229.20.1.el7.x86_64” version nodename “#1 SMP Tue Nov 3 19:10:07 UTC 2015” “rstudio-scibrokes” machine login “x86_64” “unknown” user effective_user “ryoeng” “ryoeng”

7.2 Versions’ Log

  • File pre-release version: 0.9.0
    • file created
    • Applied ggplot2, ggthemes, directlabels packages for ploting. For example, the graphs applied in Section 2. Dataset.
  • File pre-release version: 0.9.1
    • Added Natural Language Analysis which is research for teams’ name filtering purpose.
    • Changed from knitr::kable to use datatble from DT::datatable to make the tables be dynamic.
    • Changed from ggplot2 relevant packages to googleVis package to make graph dynamic.
    • Completed chapter 3. Summarise the Staking Model.
  • File pre-release version: 0.9.2 - “2016-02-20 09:41:49 JST”
  • File version: 1.0.3 - “2016-02-05 05:24:35 EST”
    • Modified datatable to make the documents can be save as xls/csv
    • Added log file for version upgraded

7.3 Speech and Blooper

There are quite some errors when I knit HTML:

  • let say always stuck (which is not response and consider as completed) at 29%. I tried couple times while sometimes prompt me different errors (upgrade Droplet to larger RAM memory space doesn’t helps) and eventually apply rm() and gc() to remove the object after use and also clear the memory space.

  • Need to reload the package suppressAll(library('networkD3')) which in chunk decission-tree-A prior to apply function simpleNetwork while I load it in chunk libs at the beginning of the section 1. Otherwise cannot found that particlar function.