Share

Markov Chains in Lottery Games

stoopendaal's avatar - archer

Hi,

Here a brief explanation about markov chains (source: http://techeffigy.wordpress.com/2014/06/30/markov-chains-explained)

"Markov Chains is a probabilistic process, that relies on the current state to predict the next state. For Markov chains to be effective the current state has to be dependent on the previous state in some way; For instance, from experience we know that if it looks cloudy outside, the next state we expect is rain. We can also say that when the rain starts to subside into cloudiness, the next state will most likely be sunny. Not every process has the Markov Property, such as the Lottery, this weeks winning numbers have no dependence to the previous weeks winning numbers."

I wrote an application to generate Markov chains for lottery games and tested some lottery games using this Markov algorithm.

Here some Markov chain statistics generated from Wisconsin Pick 3 game data ( input data: September 2011 - October 2014, 1131 draw results, latest draw result has index number 1131):

Number(Digit) 7 followed by number (digit)

NumberOccurrence (%)Occurrence (#)Draw #
812.43%421123
511.24%381127
110.65%361131
010.06%341105
99.76%331130
69.47%321069
79.47%321095
29.47%321091
39.17%311113
48.28%281120

As you can see here, digit 7 is more likely followed by digit 8 than for example digit 4 ( and 2,3,7, etc.) for the 1131 tested pick 3 draw results.

---------------------------------------------------------------------------------

Number(Digit) 3 followed by 
NumberOccurrence (%)Occurrence (#)Draw #
611.98%431075
911.7%421071
311.42%411060
010.58%381118
810.58%381116
710.58%381130
58.91%321121
18.91%321122
48.36%301084
26.96%25994

As you can see here, digit 3 is more likely followed by digit 6 than for example digit 2 ( and 4,1,5, etc.) for the 1131 tested pick 3 draw results.

Number 2 followed by 

NumberOccurrence (%)Occurrence (#)Draw #
313.66%441130
111.49%371120
011.18%361117
210.87%351072
610.56%341124
59.94%321106
99.01%291092
78.7%281123
47.45%24971
87.14%231099

As you can see here, digit 2 is more likely followed by digits 3  and 1 than for example digit 2 ( and 8,4,7, etc.) for the 1131 tested pick 3 draw results.

So, can the Markov chains algorithm be useful for lottery games predicting lottery numbers or be used to generate picks with a higher probability of having more winning numbers?

You can generate the Markov Chains (statistics) for your lottery game(s) here:  http://www.intelbet.somee.com/Default.aspx

Also, I included the the draw results of Wisconsin Pick 3 and New Jersey pick 6 lotto to generate the Markov chains (statistics).

Good luck!

 

Cheers,

 

Harmen

stoopendaal's avatar - archer

As early stated, Markov chains don't depend on past history  (for random process a lottery unless it's flawed Wink )other than the current state of the system. For example, Markov modelling of a lottery would predict (with a certain probability) the next number based on the current number, but not looking any further back than that.

However I believe the Markov model can be used for analyzing a lottery game in which there is some dependence of a number and the the next number following this number in a combination.

 

Example Pick 6, New Jersey (input 1024 draw results).

Here you see (see table) the probabilities (in %) of the next (adjacent) numbers to 17.

The numbers 20,22,18,23,19 have a (much) higher probability to be the next number compared to the other numbers (24,28,25, etc.)

This can mainly be explained by the structure of the lottery game but it's always nice to have this information :)

Number 17 followed by 

NumberOccurrence (%)Occurrence (#)Draw #
2011.29%141018
229.68%121004
189.68%12997
238.87%11983
198.06%101015
216.45%8858
245.65%7966
304.84%6762
284.84%6996
314.03%5979
254.03%51008
263.23%4831
383.23%41009
342.42%3658
272.42%3799
321.61%2477
291.61%2411
441.61%2810
391.61%2884
450.81%186
330.81%1187
350.81%1286
420.81%1307
400.81%1807
410.81%1901

 

Example for number 47:

Here the highest probability number 47 is followed by number 48 and next by the numbers 3, 1, 5 ???

Number 47 followed by 

NumberOccurrence (%)Occurrence (#)Draw #
4816.98%181012
313.21%141015
111.32%12951
510.38%11827
68.49%9950
106.6%7971
45.66%6998
25.66%61019
84.72%5961
493.77%4877
112.83%3800
72.83%3461
92.83%3904
190.94%182
130.94%191
210.94%1182
160.94%1326
120.94%1670

The input (so called corpus) for the Markov algorithm is generated as follows:

  1. Oldest draw result on top --->  latest on bottom
  2. structure of the input: 1    4    12    29    30    31 | 6    9    30    31    32    34 | 3    16    25    26    28    32 | 3    5    18    36    38    49 |
    5    7    9    22    44    45 | etc., etc.,   5    10    30    31    40    49 (latest (most recent) draw result is at the end of the corpus (string of numbers))
  3. For each unique number in the lottery game (in this lottery example 49 numbers), the adjacent (the number it follows) number is counted and so the probability is calculated.
  4.  So first the algorithm starts with number 1 (see input example at point 2) to count the next numbers to it in the string of numbers(corpus); For every occurrence of number 1 in the number string, the adjacent number is counterd.
  5. When finished it takes the next unique number, here number 4, to do the same calculations...etc. This explains why a number like 47 has a high probability to be followed by a number like 1,3,5 etc...the first numbers of the next draw result.

 

With this information a specific lottery number generator can be developed for your game using the number probabilities to create picks.

For example we start with number 8. Next randomly a number is picked from the list of numbers connected to 8; the number with a higher probability (e.g. number 10, 11.38%) has higher probability to be selected than a number with a lower probability like 11 (5.69%)

If for example number 12 is selected the same process is executed for this number. And so on...till a (hopefully a valid :) ) lottery combination is generated.

Number 8 followed by 

NumberOccurrence (%)Occurrence (#)Draw #
1011.38%14964
911.38%14893
129.76%12928
206.5%81000
115.69%7854
154.88%6841
194.88%6962
174.88%6966
144.88%6937
ALX's avatar - Lottery-050.jpg

Wow. I really like this idea and the generator. Thank you. How do I input my state lottery game please?

stoopendaal's avatar - archer

Hi ALX,

"How do I input my state lottery game please?":

I copied the lottery results (raw data) from the website of the lottery to notepad and saved it as a text file.

First I imported the text file with the lottery results into Excel and removed the dates and other data from the draw results. Secondly  I copied the results to a tool (topdown) to revert the results to get the oldest drawings at top and the most recent at the bottom of the list. Finally I saved the results to a text file and use this as input for the Markov Chains tool (copy & paste the results from this file into the tools input textbox).

I noticed you've got the Platinum membership so you've access  viewing the games past drawings of your state without limitation Smile

ALX's avatar - Lottery-050.jpg

Thank you very much for your help.......I'll try it.

Avatar
In response to stoopendaal

Is it really necessary to make Pick 3 thisCOMPLEX, in order to Win ??? People Win Pick 3, with much Simpler systems.  If you are going to put this much effort into making the game MORE COMPLEX than it needs to be,you should put this effort into the Pick 4 game instead, b/c the payout is higher, and therefore more worth this amount of effort.

Tialuvslotto's avatar - Jailin

Hi Stoopendaal,

Interesting post.

I have tried Markov Chains in a jackpot lottery game.  They turned out to be quite good at predicting a range (e.g. 37 followed by 42-49), but not so good on pinpointing a following number.  Also, on many draws the Markov predictions would be very good for 2 or 3 of the numbers, fairly close for another 2 and wildly inaccurate for one number.  Unfortunately, one could never tell which predictions would be good.

 

Still, any information is useful, and this is one tool to help dial in good numbers to play.

stoopendaal's avatar - archer

Hi Tialuvslotto,

 

Thanks for the information about Markov predictions for jackpot games.  I like your idea to create chains for a range of numbers and I tested it for a pick 6 lottery game (New Jersey).

First I created the range data for this game. In this example I created groups each having 3 numbers.

49 numbers has 16 groups of 3 number and 1 group with one number (49). So there is a total of 17 groups to analyse.

Group 1: {1,2,3}

Group 2: {4,5,6}

Group 3: {7,8,9}

.etc. etct.

Group 16: {46,47,48}

Group 17: {49}

Example: a combination like 5,10,30,31,40,49 translated to the group index numbers has as result 2,4,10,11,14,17.

Here some Markov statistics for this jackpot game using the number groups as input (1031 draw results tested, checked: ):

(Chain A) Number Group 2 followed by

Number GroupOccurrence (%)Occurrence (#)Draw #Skip #
327.02%10710231
420.2%8010240
514.39%57101311
69.85%3910213
78.33%3394777
27.58%3097450
94.55%1898935
83.03%12888136
102.78%11850174
112.02%8811213
120.25%1366658

As you can see a number from group 2 (numbers 4,5,6)  is 27% of the time followed by a number from group 3 (numbers 7,8,9).

And 20% of the time this group is followed by a number from group 4 (the numbers 10,11,12).

(Chain A) Number Group 6 followed by 

NumberOccurrence (%)Occurrence (#)Draw #Skip #
724.66%91100618
819.78%7310177
913.28%4910222
1010.57%39101212
69.76%3699727
117.59%2899034
126.5%2410213
134.88%1898341
141.9%797450
151.08%493985

Here a number from group 6 (numbers 16,17,18) is almost 25% of the time followed by a number from group 7 (numbers 19,20,21) ....

etc.

 

Another Markov analysis for this game but now for number groups each with 7 numbers (49/7 = 7 number groups):

number group 1: {1,2,3,4,5,6,7}

number group 2: {8,9,10,11,12,13,14}

number group 3: {15,16,17,18,19,20,21}

....

number group 7: {43,44,45,46,47,48,49}

 

(Chain A) Number Group 1 followed by 

Number GroupOccurrence (%)Occurrence (#)Draw #Skip #
242.17%40110240
128.71%27310240
318.93%18010222
47.15%6810195
52.94%2898737
60.11%1748276

 

(Chain A) Number Group 3 followed by 
Number GroupOccurrence (%)Occurrence (#)Draw #Skip #
444.02%37210222
324.97%211101410
521.42%181100321
68.05%6810213
71.54%1393985

 

I think this information in combination with the skip value can be a helpful tool for (better?) predicting numbers (number groups)....but still I have to do some tests using this information for my lottery game (6/45) if I can make better predictions than other methods I'm using now.

Soon I'll add the feature to tool to convert the draw results to number groups (groups of 2,3,4, etc, 10 numbers each).

Tialuvslotto's avatar - Jailin
In response to stoopendaal

I used numbers by position.

For example, for the digit 3 in the first position, my spreadsheet tells me that there is:

  • 0.1 probability of a repeat in position
  • 0.7 probability of a higher number in this position
  • 0.44 probability of a number between 1-4, 0.27 between 5-9
  • 2 & 4 are good next draw numbers, happening about 0.15 each

For the digit 3 in the second position, I get different results:

  • 0.00 probability of repeat in position
  • probability near 1.0 of a higher number in this position
  • 0.35 probability of a number between 10-14, 0.2 prob. of a number from 15-19
  • 18 and 11 are the most common following numbers with 0.13 and 0.1 prob., respectively.

So, you can see that the position in which the number appears makes a difference in the following result.

SergeM's avatar - slow icon.png

As you can see here, digit 7 is more likely followed by digit 8 than for example digit 4 ( and 2,3,7, etc.) for the 1131 tested pick 3 draw results.

You are referring to the past situation, where 8 followed 7 more often. Your statement that it is more likely that 8 follows 7 is incorrect. You mix up sample and population.

For pick 3 a balance is faster restored than for a lottery game like Power Ball. I posted followers for pick 3 several times and proved it. The difference for catching up with the average chance is mostly not leading to a net win, as the payout is made low, so that you loose, or risk a lot of money when betting, and eventually get a payback, instead of a big payout.

stoopendaal's avatar - archer

Yes, you're right I made an incorrect statement about the likelihood of followers. I Googled on 'sample and population'...it's now more clear  to me Smile

"For pick 3 a balance is faster restored than for a lottery game like Power Ball" ==> In another post you stated it's all about timing. How many pick3 results did you test to calculate the followers probabilities and were you able to track the increase/decrease (differences) of the probabilities of the digits?

For example you have 10.000 pick 3 results to test. Each time you calculate the followers probabilities of 200 pick 3 result starting with draw result 1 up to draw result 200 (store the probabilities for this set). Next you do the same calculations but now for draw result 2 up to  draw result 201 (store the probabilities for this set) and so on till the last set of 200 draw result is tested; draw result 9.801 up to draw result 10.000.  Now compare the probabilities of all these sets and track their decreases/increases (and the fastness of the differences). So, the next question is, is it worth for me to build a tool doing such tests (referring to your experience of pick 3 fast balancing)?

SergeM's avatar - slow icon.png

I generally don't mix the subjects. You didn't mention the balancing, you stated that it stays unbalanced! Now you mix probabilities with counts. - I did such tests using Excel. What came out, like I posted it, in other threads, is that it is close to probability for the pick 3 that I searched in. P(STRAIGHT)=.001 AND PAYOUT(STRAIGHT)=500. If you double your chance with a condition that you stated, you might get: (CONDITIONAL)P(STRAIGHT)=.002.

Seeing the problem with lottery playing is a budget problem, you should look for predicting one straight P3 within less than 400 drawings.
The player mostly cannot raise the bets in a daily game, as regular and poor people don't have that kind of money.

Answer:

The bigger your researches become, the more events you have, the closer the result is likely to equal the expectancy. Just like as flipping a coin, you get closer to 50% head or tail, by flipping more often. You based your thinking on 8 times tail while that is 80% tail for ten flips but not for hundred, thousand or a million. Do the random tests with your random function. Run a loop for 10 power ( i ) events.

Possible count of outcomes for straight Pick 3 for ten drawings is: 100010. That is a one with thirty zeros. Your chance to get all ten right is 10 out of 100010.

SergeM's avatar - slow icon.png

To me, you are already successful if you loose half of your budget consistently!

SergeM's avatar - slow icon.png

Let's be real for a minute. State that lottery is having pick 3 outcomes like following:

  1. 000
  2. 000
  3. 000
  4. 000
  5. 000
  6. 000

What do you think will be the reaction of the lottery, the players, the press, the mathematicians and others?
Would the lottery close the game for investigation? Are you supposing that there is collusion? ...

SergeM's avatar - slow icon.png

I took the time to split 0 to 999 in four groups.

My trailer function fails with VBA for bigger data, so I had to do this differently.
Unfortunately Excel VBA isn't the best solution for methods.

Using a sub on four groups:

!32507
!31426
!23385
!43358
!13322
!33322
!22234
!21227
!12225
!11217
!34132
!44129
!24119
!14106

I cannot take the time to do more of this. Checking by games out for the groups, the maximum skips turn around 25 games for a probability of 25%.
That means you would have waited up to 29 bets to get a payout. 29*-250 +1*500 for the case you stuck on that group at the worst moment.

You did with VB or C#, that surely won't make mistakes.

Welcome Guest

Your last visit: Mon, Sep 20, 2021, 3:16 pm

Log In

Log InCancel

Forgot your username?

Forgot your password?