Wednesday, 18 January 2012

Poisson For Dummies

There has seemingly been quite a lot of discussion of Poisson on various threads recently, and I've seen more than one person state that they find it too complicated to use or that it's too opaque to understand. This may well be true, but Poisson offers a lot of benefits and so, in my view, is worth making an effort to understand. Not only can you calculate your own percentage probabilities for each scoreline, but you can then go on to group all the home win, away win and draw scorelines to provide you with percentage probabilities for the match odds also. Unders and Overs calculations can also be made based on the raw information.

So, as you can see, Poisson can be a good little fishy and one well worth feeding. So, with that in mind, I thought I'd try and give a numpty's overview, a dummy's guide to calculating your own Poisson values. I'll take things slowly and explain as much as I can, assuming that you know absolutely nothing. If this feels too condescending then that’s just tough titty. Go and read something else instead.

First, let’s face up to the full horror of the Poisson equation. Here it is:

                                                      µx  X  e
      P(Man City scoring x goals) =      --------------
                                                                      x!

Urgh! What’s all that? Looks evil. I can’t understand any of that. I was always shit at maths.

There there. Calm down. Take a deep breath and we’ll go through it all steadily. It’s not as hard as it looks if we break it down. First of all, you’ll notice that I’ve used Man City as the example in the above difficult-looking Poisson equation. No particular reason for this other than the fact that they tend to score lots of goals. Let’s suppose they are playing at home against Wigan and we want to work out the probability of each scoreline occurring. Well, in order to do that we initially have to determine the probability of Man City scoring x number of goals in the match.

Aha! So that little "x" symbol in your horrible Poisson equation can be replaced with the number of goals we’re interested in?

That’s right. For example, say we’re interested in working out the probability of City scoring two goals, then the equation becomes:


                                                      µ2 X e
     P( Man City scoring 2 goals) =      ------------
                                                                      2!


Hmm, it’s looking at bit better already. Carry on. I’m getting interested now.

Okay, I will. You see that funny µ symbol? Well that’s a placeholder, in this case for the goal expectancy for Man City. So how do we derive the goal expectancy? Well, this is important but we’ll have to talk about that later. For now let’s plug in a random value of say 2.59. This means our equation looks even more simple:

                                                         2.592  X  e-2.59
     P( Man City scoring 2 goals) =      ------------------
                                                                   2!

Holy cow Batman, this is starting to make a little bit of sense. Would you like to explain more?

Well alrighty then. Looking at the equation again, we can easily split what we have into three parts: the top two are multiplied together and then divided by the bottom one. The three little components individually are:

1.       2.592
2.       e -2.59
3.       2!


So let’s attack each one in turn to make it easy-peasy-lemon-squeezy. In the first item, the small figure 2 above the 2.59 means “raised to the power of 2”. So for this case we take 2.59 and times it by 2.59. We wouldn't do this in every case however; it depends on the power that you're using. If you use Microsoft Windows, then the calculator will have these symbols on it (ensure you select “view/scientific” from the calculator drop-down menu):

  • x^y
  • x^3
  • x^2

Did you find them on your calculator? In the order given, these mean “any number raised to the power of any other number”, then “any number raised to the power of 3” and finally “any number raised to the power of 2”. Using the Windows calculator, we can use the last of these (on this occasion) and derive the answer of 6.7081. If the number of goals we’re interested in was four, then we’d have to use the first of these (x^y).

1.       2.592 = (2.59 X 2.59) = 6.7081
2.       e -2.59
3.       2!

Okay, onto the second items now. The e symbol is a mathematical constant (for reasons that you don’t need to trouble your pretty little head about). We can simply swap it for the value of 2.718281828459 so that makes our little mini-equation: “2.718281828459 raised to the power of -2.59”. The answer to this is 0.07502. Okay, let’s pop that in:

1.       2.592 = (2.59 X 2.59) = 6.7081
2.       e -2.59 = (2.718281828459 X -2.59) = 0.07502
3.       2!


Wow, we’re nearly there! I’m getting excited.

Yeah, alright, calm down you wanker - they’re only numbers. We're now left with item number three above, and this is the mini-equation “2!”

Yes, alright, you rude bastard. What does 2! mean then?

It means 2 factorial. Many people get their knickers in a twist about factorials but they’re not difficult.

0 factorial is: 0       = 1 (Note, 0 factorial equates to 1)
1 factorial is: 1 X 1 = 1
2 factorial is: 2 X 1 = 2
3 factorial is: 3 X 2 X 1 = 6
4 factorial is: 4 X 3 X 2 X 1 = 24

...and so on and so forth. Not difficult at all. So our factorial is the third example I’ve given here, giving us the answer of 2.

1.       2.592 = (2.59 X 2.59) = 6.7081
2.       e -2.59 = (2.718281828459 X -2.59) = 0.07502
3.       2!      = (2 X 1) = 2

Okay, if you're still with me then we are ready to re-assemble our Poission equation with all the symbols replaced by actual numbers:


                                                                               6.7081 X 0.07502
      P( Man City scoring 2 goals) =       ------------------
                                                                             2

So, the probability (P) of Man City scoring 2 goals is: (6.7081 X 0.07502) / 2 = 0.2516.

Hurrah! We’ve done it

Well, actually all you did was sit on the sidelines and make stupid noises. However, using this same system, we can now calculate the likelihood of Man City scoring any number of goals. Here is the table of the results using the same method:

   Man City

Number Of Goals
µx
e
x!
Probability
0
1
0.07502
1
0.0750
1
2.59
0.07502
1
0.1943
2
6.7081
0.07502
2
0.2516
3
17.3739
0.07502
6
0.2172
4
44.99860
0.07502
24
0.14065
5
116.5463
0.07502
120
0.07286
6 or more
0.04839
Total:
1.00

Okay, there’s lots of numbers here, so I hope I haven’t lost you. If you are confused, go back through what has been covered so far and try and understand each step. Don’t move on until you have grasped each bit. If you take it slowly, then it should make sense.

Whoohoo! We’re finished!

Erm, no we’re not I’m afraid. From the table above we now have the percentage probability of Man City scoring any number of goals. Unfortunately we also need to do this for Wigan. For the away side, much like the home side, we also face the problem of how to know their goal expectancy (µ) but for now let’s say it’s 0.52. I’m getting tired now, so I’ll just reproduce the table above for Wigan based on 0.52:

   Wigan

Number Of Goals
µx
e
x!
Probability
0
1
0.594521
1
0.5945
1
0.52
0.594521
1
0.3091
2
0.2704
0.594521
2
0.0804
3
0.140608
0.594521
6
0.0139
4
0.07311616
0.594521
24
0.0018
5
0.0380204032
0.594521
120
0.00001
6 or more
0.00029
Total:
1.00

Tada! Now it gets interesting, because we can reference these two tables to work-out any scoreline that we like.

Okay, Johnny Big-Bollocks. so what are the chances of Man City winning 2-0?

Easy. Look at the number of goals column in the Man City table, find the value of 2, and then look across at the probability column. Do the same for the Wigan table. If your brain isn't the size of a pea then you should get: 0.2516 (Man City) X 0.5945 (Wigan), giving us an answer of 0.1495762. This is the percentage chance of that scoreline occurring. Finally we just need to use this figure to divide 1 to get our calculated odds (1 / 0.1495762) = 6.68.

Okay, so using a raw Poisson calculation we’ve come up with odds of 6.68 for a 2-0 scoreline, so we could rush along to Betfair and see how our calculation compares with what is on offer in the Correct Score market.

Of course, you’ll want to automate this all as much as possible. If you have any knowledge of Excel then this is the perfect platform for automatically generating all these calculations and providing you with ready-to-eat odds. If you don't have any experience of Excel then, well... you're a bit shagged. Either way, you’ll have to work out for yourself the best way of automating all this. Just bear in mind that Excel has done all these nasty calculations for you and has wrapped it up in a nice little formula called POISSON(). I have shown you all this so that you know what it's doing.

Okay, well, there are outstanding issues that I haven’t talked about, and they are non-trivial issues too. These are:
  • How to calculate the actual goal expectancy values for each team.
  • How to adjust the Poisson calculations for the increased accuracy. As mentioned in my overview of the Correct Score market a few posts back, Poisson under forecasts 0-0 and 1-1 draws and over forecasts 1-0 and 0-1 wins.
Unfortunately these are large subjects in their own right and there’s no way I’m going to start banging on about them now (although I may do so at a later date). In the meantime you might want to Google them.

Hopefully, however, this step-by-step first introduction to Poisson has helped you to start thinking about generating your own stats. Poisson is well-known and heavily used in football betting and, whilst not the most supremely accurate forecasting method, is certainly accurate enough to help raise your win rate above most general punters out there. Using it may help also to get you interested in stats in general, which can only aide you in your betting activities.

Cheers
Eddie.
 
 
______________________________
 
Update:
An explanation of goal expectancy can be found here in my post imaginatively called Calculating Goal Expectancy. This is not the ideal solution, but may give you a starting point.
 
 

28 comments:

  1. Yeah, mine too. But that may be down to my missus giving it a large whack for being online too long.

    ReplyDelete
  2. Thanks for taking us through that Eddie - I knew all along it was something simple :-)

    But I've got to say they must have changed maths quite a lot since I was at school because I'm sure I was told 0 squared is 0 and 1/0 is 0, and, to top it all ANYTHING multiplied by 0 is ..... also .... 0!

    It was thirty plus years ago, and I appreciate science has evolved enormously. But although I follow your two goal calculation I still can't get p(0) to come out as anything other than 0!

    Must be fick :-(

    ReplyDelete
    Replies
    1. Thought I'd explain.

      n! = n.(n-1).(n-2)....3.2.1
      hence
      n! = n.(n-1)!

      n!/n = n.(n-1)!/n

      n!/n = (n-1)!

      Now lets say n=1.

      1!/1 = (1-1)!
      1 = (0)!
      Proof complete

      Cheers
      Matt

      Delete
    2. Thought I'd lend a hand too on the prob side, in lehmans terms.

      Q - Whats the likelihood of being hit by lighting?
      A - Small
      Q - Whats the likelihood of being hit twice?
      A - Much Smaller
      Q - Q - Whats the likelihood of being hit three times?
      A - Much Much Smaller.

      and so on, you get the drift. Hence the p(0) is anything but zero. This should explain it.

      Cheers again,
      Matt

      Delete
  3. Sorry Dave. I've just updated the posting to mention 0! (factorial) is defined as 1 and not zero.

    Hopefully this should make your answers now come up with something sensible.

    ReplyDelete
  4. Prior to this poisson was a perfume that women used to wear in the 80's and a band that sang "Every rose has it's thorn" which was also in the 80's

    Many thanks for posting Eddie, it certainly is written in such a way that a mathmatically challenged imbecile such as myself can understand...............my IQ???? In the 80's :-)

    ReplyDelete
  5. Poisson doesn't actually work very well for forecasting. So thanks for adding more value to the market. Crunch away guys.

    ReplyDelete
  6. Hi,

    just spent many hours reading your blog. Its a really enjoyable read.Keep it up !

    Eddy

    ReplyDelete
  7. To Peter, thanks for the encouragement. Much appreciated.

    To first anon, if you read my post on Poisson, at the end I say roughly that. It will however point you in the right direction and is better than nothing. Also, allied with other factors, it can be a good aide.

    To second anon. Thanks for the compliment. It's nice to know someone is enjoying all my ramblings!

    ReplyDelete
  8. Please, please, please do a post on goal expectancy, or is it a simple as average goals scorer over a certain number of games either home or away in the league for example.

    ReplyDelete
  9. Hi Average Guy

    I do hope to post on the subject you've mentioned, but perhaps don't be too eager. First-off, it's a very dry subject which is rather dull to write and probably, for many, dull to read. It also takes quite a long time to gather all my thoughts on such a subject.

    As I say, I will endeavour to continue the post, as I did rather leave it hanging in the air. I just can't tell you when I'll do it.

    Cheers

    ReplyDelete
    Replies
    1. Hi SoccerDude,

      I have just come across this gorgeous article, and I wonder how you would feel if we re-published your article on our blog, Soccerwidow.com. Of course, we would name you as the author and provide a back link to your blog.

      Soccerwidow has some 500 readers daily and hould you be interested please kindly get back via email: admin[at]soccerwidow[dot]com

      Cheers!
      Soccerwidow

      Delete
  10. Thanks for the write up, do you have any reliable maths to predict goal expectancy over time in order to calculate half time scores in running scores etc.

    Good to see people posting up theories behind betting rather than straightforward I backed this etc

    ReplyDelete
  11. Hi Lazy Trader

    I don't have what you're asking for, I'm afraind.

    Coincidentally, I am in the process of modelling the odds decay for the Over/Unders market, which I suppose won't be a million miles away. I still don't have this complete though and, with my time getting squeezed recently, I'm not sure when I'll have it finished.

    Thanks for reading.

    ReplyDelete
  12. No problem, I've been thinking about getting into football trading for a while so your blog is a breath of fresh air.

    I used to play around with a version of Poisson weighted for certain scorelines and my spreads and odds would be pretty much mid spread of the firms prices. Always thought the real value lies within the in play prices rather than pre off as there's a tendency for people to overreact once the events underway. Plus once you have total goals and supremacy the related markets are pretty easy to calculate and more likely to be out of line than maybe the main win market.

    ReplyDelete
  13. Over reaction, particularly in the Correct Score market, offers massive opportunities in play.

    ReplyDelete
  14. Dave, you're absolutely right. This is one aspect of the CS market that I like. Plenty of opportunities after a goal is scored.

    ReplyDelete
  15. Hi,

    You mention that 'you can ...group all the home win, away win and draw scorelines to provide you with percentage probabilities for the match odds...'
    Thats a lot of work, and I'm quite lazy ! Is there any other way to use poisson to calculate match-odds and short-cut calculating all the different score outcomes ?

    ReplyDelete
  16. Hi Mr. Lazy. With your attitude, you're a man after my own heart. I quite understand what you're saying.

    Unfortunately this blasted Poisson does insist that you calculate all the scores before you can determine the match odds.

    However, don't be dismayed as I will endeavour to put together a post in the near future on other "simple" methods of compiling match odds. There is more than one way to skin a cat, and we don't always have to use a fish to do so.

    Eddie.

    ReplyDelete
    Replies
    1. Great. I look forward to it.
      Thanks anyway for a clear explanation of Poisson.
      Now I'm off to bed...

      Delete
  17. This is my new favourite blogger. Very informative, easy to read and funny to boot. Superb.

    ReplyDelete
  18. Hi Wellstorm

    Thanks for the compliment and for the encouragement. It's always nice to get good feedback. Appreciated.

    ReplyDelete
  19. Hi Eddie,
    Did you finally write the post about the calculation of goal expectancy values? I couldn't find it. Thanks

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete
  21. Goal expectancy - you can make this pretty simple, just do the reverse of this article. Take all the result from man city season i.e. (made up) all games where man city have scored once... say this is 10 times. then for 10/38 games there 1 goal. use this as your expectancy as a basic perception.

    The interest point here i think is calculating the margin of the win. i.e. mancity to win by a goal, using this likelihood, will be much more telling. as the futher distrubtion will be sign they win by more than one goal.

    Hope that makes sense.

    ReplyDelete
  22. Hi Matt

    Thanks for taking the time to add in some additional help for everyone. Much appreciated.

    Cheers
    Eddie.

    ReplyDelete
  23. Thanks for this and the linked post - really helpful

    ReplyDelete