## Poor Man’s Betting Shop – Using Baysian Inference to setup your own Betting Shop

Further exploration of Bayesian Inference, applied to the upcoming 2018 Ice Hockey World Championships. This time, I’m trying to understand how the professional betting shops set their odds, and how they make a profit. It took some ‘research’ into the gaming/betting vocabulary, for instance, the notion of “odds” is not unique, there are several types, including fractional e.g. 3:1, and decimal, e.g. 2.0.  In this article, I’m going to stick with the decimal form of odds, so below, whenever you see a number like 2.0 or 1.5, those numbers are decimal gambling odds, and the way to read them is that for every dollar you bet against those odds, you will get that number back, if you happen to win. So basically, your ‘return’, if you happen to win the bet, is your stake multiplied by the odds number.  To make it bleeding obvious, let’s take an example:

You decide to bet 1\$ on an outcome with 1.0 in odds. If you win, you’ll get your money back, nothing more. If instead the odds were set to 2.0, you would get 2\$ back for your 1\$ stake, i.e. a nice winning of 1\$ (or 100%).

So, with this now hopefully bleedingly clear and obvious, let’s see what my Bayesian inference engine – which at this point has been fed with nearly 1100 historical game results, as well as the current IIHF Rankings table – thinks about the upcoming World Championship group game outcomes:

Below are two tables, one for group A and one for group B. In each table, each game is listed, with two lines, the first line showing the ‘raw’ odds, based on the actual probabilities for the game, the second line including the ‘markup’ that any professional bookie must make to ensure a healthy business. So, to compare these odds with the one’s from any professional betting shop, you should use line #2 for each game.

I compared the outcomes from my odds compilator, i.e. the Bayesian Inference Engine I’ve written in Python and PYMC, with the odds compiled by a betting brooker on the net, and was pretty surprised to see that in many cases, the odds from my program and the ones on that site are not that far from each other… That’s surprising, because my program – at this point – only uses historical results and the actual rankings to determine the probabilities of the game outcomes, and I’m pretty sure that professional betting shops put much more data into their odds compilation engine, e.g. based on the current team rooster, form, home vs away game, venue, umpire etc etc.

The most obvious differences I’ve been able to notice are two: first, my program appears to place more emphasis on the historical results than the betting shops do. Secondly, for teams with no previous world cup participation, like Korea, my program seems to put less emphasis on the rankings table than the professional shops do.

So, anyways:below the results. Oh, btw, a few games have a right most column in square brackets. Those indicate the odds obtained from the betting brooker mentioned above. The reason there aren’t more of them, is that it appears that the betting folks don’t publish all their odds at once, but ‘piece-by-piece’.

```BETTING ODDS PER GAME, GROUP B:
AUT-BLR  : HOME WIN: 545.45 DRAW: 130.43 AWAY WIN: 1.01
: HOME    : 495.87 DRAW: 118.58 AWAY    : 0.92

AUT-CZE  : HOME WIN: 7500.00 DRAW: 2142.86 AWAY WIN: 1.00
: HOME    : 6818.18 DRAW: 1948.05 AWAY    : 0.91

AUT-FRA  : HOME WIN: 5.02 DRAW: 5.95 AWAY WIN: 1.58
: HOME    : 4.56 DRAW: 5.41 AWAY    : 1.44

AUT-RUS  : HOME WIN: 188.68 DRAW: 60.85 AWAY WIN: 1.02
: HOME    : 171.53 DRAW: 55.32 AWAY    : 0.93

AUT-SUI  : HOME WIN: 9.25 DRAW: 10.31 AWAY WIN: 1.26
: HOME    : 8.41 DRAW: 9.38 AWAY    : 1.14	[7.20 6.30 1.39]

AUT-SVK  : HOME WIN: 3000.00 DRAW: 389.61 AWAY WIN: 1.00
: HOME    : 2727.27 DRAW: 354.19 AWAY    : 0.91

AUT-SWE  : HOME WIN: inf DRAW: 3750.00 AWAY WIN: 1.00
: HOME    : inf DRAW: 3409.09 AWAY    : 0.91

BLR-CZE  : HOME WIN: 267.86 DRAW: 50.85 AWAY WIN: 1.02
: HOME    : 243.51 DRAW: 46.22 AWAY    : 0.93

BLR-FRA  : HOME WIN: 1.80 DRAW: 5.90 AWAY WIN: 3.63
: HOME    : 1.64 DRAW: 5.36 AWAY    : 3.30	[2.10 4.34 3.16]

BLR-RUS  : HOME WIN: 17.03 DRAW: 8.90 AWAY WIN: 1.21
: HOME    : 15.48 DRAW: 8.09 AWAY    : 1.10

BLR-SUI  : HOME WIN: 9.57 DRAW: 5.16 AWAY WIN: 1.43
: HOME    : 8.70 DRAW: 4.69 AWAY    : 1.30

BLR-SVK  : HOME WIN: 5.44 DRAW: 4.92 AWAY WIN: 1.63
: HOME    : 4.95 DRAW: 4.48 AWAY    : 1.48

BLR-SWE  : HOME WIN: 24.15 DRAW: 12.18 AWAY WIN: 1.14
: HOME    : 21.96 DRAW: 11.07 AWAY    : 1.04	[14.25,9.20,1.19]

CZE-FRA  : HOME WIN: 1.13 DRAW: 15.93 AWAY WIN: 19.96
: HOME    : 1.02 DRAW: 14.48 AWAY    : 18.15

CZE-RUS  : HOME WIN: 3.54 DRAW: 3.46 AWAY WIN: 2.34
: HOME    : 3.21 DRAW: 3.14 AWAY    : 2.12

CZE-SUI  : HOME WIN: 1.34 DRAW: 5.71 AWAY WIN: 12.85
: HOME    : 1.22 DRAW: 5.19 AWAY    : 11.68

CZE-SVK  : HOME WIN: 1.27 DRAW: 6.89 AWAY WIN: 14.61
: HOME    : 1.16 DRAW: 6.27 AWAY    : 13.28	[1.47 6.00 6.70]

CZE-SWE  : HOME WIN: 7.53 DRAW: 3.78 AWAY WIN: 1.66
: HOME    : 6.85 DRAW: 3.44 AWAY    : 1.51

FRA-RUS  : HOME WIN: 63.56 DRAW: 28.01 AWAY WIN: 1.05
: HOME    : 57.78 DRAW: 25.46 AWAY    : 0.96	[21.25 13.00 1.12]

FRA-SUI  : HOME WIN: 6.32 DRAW: 5.42 AWAY WIN: 1.52
: HOME    : 5.75 DRAW: 4.93 AWAY    : 1.38

FRA-SVK  : HOME WIN: 7.36 DRAW: 7.70 AWAY WIN: 1.36
: HOME    : 6.69 DRAW: 7.00 AWAY    : 1.24

FRA-SWE  : HOME WIN: 123.97 DRAW: 36.36 AWAY WIN: 1.04
: HOME    : 112.70 DRAW: 33.06 AWAY    : 0.94

RUS-SUI  : HOME WIN: 1.07 DRAW: 18.82 AWAY WIN: 76.73
: HOME    : 0.97 DRAW: 17.11 AWAY    : 69.75

RUS-SVK  : HOME WIN: 1.42 DRAW: 5.21 AWAY WIN: 9.55
: HOME    : 1.29 DRAW: 4.74 AWAY    : 8.68

RUS-SWE  : HOME WIN: 1.59 DRAW: 3.89 AWAY WIN: 8.75
: HOME    : 1.45 DRAW: 3.53 AWAY    : 7.95

SUI-SVK  : HOME WIN: 5.31 DRAW: 5.83 AWAY WIN: 1.56
: HOME    : 4.83 DRAW: 5.30 AWAY    : 1.42

SUI-SWE  : HOME WIN: 37.59 DRAW: 9.00 AWAY WIN: 1.16
: HOME    : 34.18 DRAW: 8.19 AWAY    : 1.05

SVK-SWE  : HOME WIN: 6.89 DRAW: 4.91 AWAY WIN: 1.54
: HOME    : 6.26 DRAW: 4.46 AWAY    : 1.40

```
```BETTING ODDS PER GAME, GROUP B:
CAN-DEN  : HOME WIN: 1.14 DRAW: 14.73 AWAY WIN: 18.69
: HOME    : 1.03 DRAW: 13.39 AWAY    : 16.99

CAN-FIN  : HOME WIN: 1.97 DRAW: 3.50 AWAY WIN: 4.83
: HOME    : 1.79 DRAW: 3.18 AWAY    : 4.40

CAN-GER  : HOME WIN: 1.03 DRAW: 40.65 AWAY WIN: 157.89
: HOME    : 0.94 DRAW: 36.95 AWAY    : 143.54

CAN-KOR  : HOME WIN: 1.21 DRAW: 7.08 AWAY WIN: 28.25
: HOME    : 1.10 DRAW: 6.43 AWAY    : 25.68

CAN-LAT  : HOME WIN: 1.00 DRAW: 750.00 AWAY WIN: 6000.00
: HOME    : 0.91 DRAW: 681.82 AWAY    : 5454.55

CAN-NOR  : HOME WIN: 1.01 DRAW: 150.00 AWAY WIN: 681.82
: HOME    : 0.92 DRAW: 136.36 AWAY    : 619.83

CAN-USA  : HOME WIN: 1.45 DRAW: 5.37 AWAY WIN: 8.08
: HOME    : 1.32 DRAW: 4.88 AWAY    : 7.35	[1.55 5.50 5.80]

DEN-FIN  : HOME WIN: 184.05 DRAW: 32.64 AWAY WIN: 1.04
: HOME    : 167.32 DRAW: 29.68 AWAY    : 0.94

DEN-GER  : HOME WIN: 2.98 DRAW: 4.63 AWAY WIN: 2.23
: HOME    : 2.71 DRAW: 4.21 AWAY    : 2.03	[3.50 4.40 2.05]

DEN-KOR  : HOME WIN: 1.82 DRAW: 2.81 AWAY WIN: 10.41
: HOME    : 1.66 DRAW: 2.56 AWAY    : 9.46

DEN-LAT  : HOME WIN: 3.05 DRAW: 4.83 AWAY WIN: 2.15
: HOME    : 2.78 DRAW: 4.39 AWAY    : 1.95

DEN-NOR  : HOME WIN: 6.55 DRAW: 5.03 AWAY WIN: 1.54
: HOME    : 5.95 DRAW: 4.57 AWAY    : 1.40

DEN-USA  : HOME WIN: 15.22 DRAW: 9.29 AWAY WIN: 1.21
: HOME    : 13.84 DRAW: 8.45 AWAY    : 1.10	[9.00 7.70 1.35]

FIN-GER  : HOME WIN: 1.17 DRAW: 10.22 AWAY WIN: 20.98
: HOME    : 1.06 DRAW: 9.29 AWAY    : 19.07

FIN-KOR  : HOME WIN: 1.28 DRAW: 5.87 AWAY WIN: 21.69
: HOME    : 1.16 DRAW: 5.34 AWAY    : 19.72	[1.04 21.00 42.50]

FIN-LAT  : HOME WIN: 1.38 DRAW: 6.78 AWAY WIN: 7.82
: HOME    : 1.25 DRAW: 6.16 AWAY    : 7.11

FIN-NOR  : HOME WIN: 1.08 DRAW: 18.58 AWAY WIN: 48.15
: HOME    : 0.98 DRAW: 16.89 AWAY    : 43.78

FIN-USA  : HOME WIN: 3.28 DRAW: 2.75 AWAY WIN: 3.02
: HOME    : 2.98 DRAW: 2.50 AWAY    : 2.75

GER-KOR  : HOME WIN: 1.34 DRAW: 4.94 AWAY WIN: 19.60
: HOME    : 1.22 DRAW: 4.49 AWAY    : 17.81

GER-LAT  : HOME WIN: 1.52 DRAW: 5.32 AWAY WIN: 6.52
: HOME    : 1.38 DRAW: 4.84 AWAY    : 5.93

GER-NOR  : HOME WIN: 6.90 DRAW: 8.60 AWAY WIN: 1.35
: HOME    : 6.27 DRAW: 7.81 AWAY    : 1.23

GER-USA  : HOME WIN: 4.73 DRAW: 4.58 AWAY WIN: 1.75
: HOME    : 4.30 DRAW: 4.17 AWAY    : 1.59

KOR-LAT  : HOME WIN: 12.10 DRAW: 3.15 AWAY WIN: 1.67
: HOME    : 11.00 DRAW: 2.86 AWAY    : 1.52

KOR-NOR  : HOME WIN: 15.13 DRAW: 4.45 AWAY WIN: 1.41
: HOME    : 13.75 DRAW: 4.04 AWAY    : 1.28

KOR-USA  : HOME WIN: 21.57 DRAW: 5.47 AWAY WIN: 1.30
: HOME    : 19.61 DRAW: 4.97 AWAY    : 1.18

LAT-NOR  : HOME WIN: 2.10 DRAW: 4.50 AWAY WIN: 3.31
: HOME    : 1.91 DRAW: 4.09 AWAY    : 3.01	[2.81 4.40 2.25]

LAT-USA  : HOME WIN: 15.29 DRAW: 5.96 AWAY WIN: 1.30
: HOME    : 13.90 DRAW: 5.42 AWAY    : 1.19

NOR-USA  : HOME WIN: 30.58 DRAW: 17.50 AWAY WIN: 1.10
: HOME    : 27.80 DRAW: 15.91 AWAY    : 1.00

```

Below the prediction graphs for the expected goal spread for the two groups: