Welcome Guest
Log In | Register )
You last visited January 21, 2017, 12:28 pm
All times shown are
Eastern Time (GMT-5:00)

Backtesting and Simulating Lottery Systems

Topic closed. 136 replies. Last post 6 years ago by RL-RANDOMLOGIC.

Page 8 of 10
4.73
PrintE-mailLink
RL-RANDOMLOGIC's avatar - usafce

United States
Member #59354
March 13, 2008
4088 Posts
Offline
Posted: April 15, 2011, 6:06 pm - IP Logged

Sounds like we both traveled similar paths but mine started out with a TI computer and then to a Commode 64 before I bought a Tandy1000.  Both the TI and Commode had a console Basic that were similar to Tandy RS Basic which was GWBasic with a few extra features. 

Some of the routines I used on my Tandy computer I still use in my GWBasic programs today.  I fear Window7 will end my use of GWBasic but for right now I still have a couple of computers with WindowXP that still have a few years left so I have time to learn a new version of Basic and rewrite my programs to work with Window7 or higher. 

I'm just lucky that the last XP computer I bought was a HP which has lasted longer than PackardBell and E-machine computers I bought earlier.  After a couple of years their power supplies couldn't support the extras I added and a bigger power supply wouldn't fit in them.  My old 8088 Tandy1000 never did quit, time past it by with VGA and faster processors.  I was sorry to see Radio Shack give up the Tandy brand, they made computers that lasted and didn't over heat after a couple of years and quit.  My old Commode has a similar problem which quicken my purchase of the Tandy1000.

RJOh

My very first computer was not in a case, It was a bunch of parts that took up a table top. My first introduction

to programming was quite by accident.  I was studying analogue electronics taking courses on the side while in

the Air Force.  One of the courses included few chapters on digital electronics theory and programming.  We all had

to write a small program for a ADC project.  We did not have any computers in the lab and so our code was written

on paper.  I had a older friend that had a small repair shop that had worked for bell labs in the late 40's when the first

simi conductors were being invented.  I don't know what if any part he had this project but he knew several of the 

guys that became famous from that time frame.  This guy was ahead of his time and he use to tell me digital was the

way to go but at that time most everything electrionic was still analogue.  I wish I had listened because not long

after everything went digital in the early 80's.  I had another friend that worked for IBM and had his own plane and

would fly around to different places and fix computers.  He had a basement that was stacked to the celling with

computers parts and after he died, "plane crash" his wife let me back my pickup up to the door and take anything

I  wanted,  I almost filled my garage.  Most of the stuff was mainframe related but some were portable units.  I

remember some floppy disk packed in the stuff that were over 8" square, but never seen a drive for them.  Those

were the days.  I am rambling so I will stop.

RL

    RL-RANDOMLOGIC's avatar - usafce

    United States
    Member #59354
    March 13, 2008
    4088 Posts
    Offline
    Posted: April 15, 2011, 6:35 pm - IP Logged

    Thank you for the explanation RL. It's tidbits like these that help others figure out the "mind" of a lottery player. :)

     

    And this is exactly why I posed the question. I was wondering if it was a complex algorithm or the human element that was taking the time.

    mayhem

    Although everything can be coded I still perfer to include a (hands on) analysis of the data.  I find that the 

    more I leave things to the program the worse I do.  Many times I like to write information down using a pen

    and paper.  The process of doing this will often cause me to see things that were missed when just looking

    at the data.  I often tell people that the subconscious mind is a very powerful tool and when you rob it of 

    any inputs then it does not function at it's full potential.  I feel this part of the mind can process things that

    the natural thought process cannot.  Think of the natural logical thought process that needs to figure things

    out in a systematic way where 2 + 2 = 4 and the subconscious works in the quantum realm which takes many

    seemingly unrelated bits of information to produce order.  Some people don't want or need software and insist

    on writting down their workouts.  I know this is a very good method, the main problem is that you must be able

    to keep the logical side from using it's logic to override what the subconscious is trying to say.

    RL

      truecritic's avatar - PirateTreasure
      Michigan
      United States
      Member #22395
      September 24, 2005
      1583 Posts
      Offline
      Posted: April 15, 2011, 11:42 pm - IP Logged

      truecritic

      I hear what your saying.  I remember doing a video upgrade and the kit came as a handful of 16 or 18 pin

      IC's. You had to plug each one in a empty socket on the motherboard.  I think it was a 32KB upgrade.  I

      loved the sounds those old PC made, sounded like a airplane starting up.  zipping, buzzing, beeping, aaanttt,

      clicking. Cooooool. Did yours come with the little book/folder for your OS floppies.

      RL

      "Did yours come with the little book/folder for your OS floppies."

      Not positive...I've had more of those book/folder things than I can remember.

      My original computer(s) was a Timex 2KB with the 14KB module.  I had to buy more than one.  It had a membrane keyboard and I kept wearing them out.  I believe I still have a working one somewhere.  The monitor was any TV that was handy and you did use cassette tapes for the storage device. 

       

      RJOH

      GW BASIC was what I used as well.  I compiled one of two ways: IBM Compiler.  Or Quick Basic.  The version I had of QB did not let me save a stand-alone program while the IBM Compiler did.

        RJOh's avatar - chipmunk
        mid-Ohio
        United States
        Member #9
        March 24, 2001
        19901 Posts
        Offline
        Posted: April 16, 2011, 12:05 am - IP Logged

        "Did yours come with the little book/folder for your OS floppies."

        Not positive...I've had more of those book/folder things than I can remember.

        My original computer(s) was a Timex 2KB with the 14KB module.  I had to buy more than one.  It had a membrane keyboard and I kept wearing them out.  I believe I still have a working one somewhere.  The monitor was any TV that was handy and you did use cassette tapes for the storage device. 

         

        RJOH

        GW BASIC was what I used as well.  I compiled one of two ways: IBM Compiler.  Or Quick Basic.  The version I had of QB did not let me save a stand-alone program while the IBM Compiler did.

        GW BASIC was what I used as well.  I compiled one of two ways: IBM Compiler.  Or Quick Basic.  The version I had of QB did not let me save a stand-alone program while the IBM Compiler did.

        Programs complied with the QB compiler requires the run time file BRUN20.EXE be in the same directory to run.

         * you don't need to buy more tickets, just buy a winning ticket * 
           
                     Evil Looking       

          truecritic's avatar - PirateTreasure
          Michigan
          United States
          Member #22395
          September 24, 2005
          1583 Posts
          Offline
          Posted: April 16, 2011, 8:08 am - IP Logged

          GW BASIC was what I used as well.  I compiled one of two ways: IBM Compiler.  Or Quick Basic.  The version I had of QB did not let me save a stand-alone program while the IBM Compiler did.

          Programs complied with the QB compiler requires the run time file BRUN20.EXE be in the same directory to run.

          Yes.

          The IBM compiler can work either way.

          A) Leave the BRUN file separate from the program and compile a smaller program. 

          OR

          B) Compile the BRUN file into the program and it comes out to a slightly larger filesize.  Then it is completely stand alone and anyone can run it.

            Ramijami's avatar - wired shell.jpg
            Cape Town
            South Africa
            Member #66343
            October 23, 2008
            115 Posts
            Offline
            Posted: April 17, 2011, 7:26 am - IP Logged

            ...when you pick your numbers does your software generate and filter at the same time or do you generate the sets first and then apply the filters after the fact. 

            It kinda does both. I usually pick combinations within parameters that cover 95% of previous winners in their categories so when combinations are generated that don't fit within all those parameters, they are rejected until one that fits is found and then I have the choice of accepting or rejecting it. 

            The program will continue picking combinations as long as numbers are left in the number pool.  For a 649 game I usually start out with 49 numbers (1-49).  After 6 combinations have been accepted, I know there are only 13 numbers left in the pool so if the program is having a hard time coming up new combinations, I can wait or add more numbers to the pool.  I also could have started out with more numbers in the pool, for example I could have started our with 245 numbers(1-49)x5.  I usually start out with just one of each numbers since that's the easiest way to be sure I come close to using all the possible numbers at least once.

            RJOh,

            For a run like this where I know the last 13 numbers might not meet the filter criteria I set, I have a "Wildcard" feature that makes combinations from the left over 13 numbers. So out of the 8 combinations in a 6/49 game I will then have 6 that meet the filter criteria and 2 that don't, or I can have the 2 meet at least one filter criteria that I set (which is matching no more than 4 from the previous draws).

              RJOh's avatar - chipmunk
              mid-Ohio
              United States
              Member #9
              March 24, 2001
              19901 Posts
              Offline
              Posted: April 17, 2011, 7:47 am - IP Logged

              RJOh,

              For a run like this where I know the last 13 numbers might not meet the filter criteria I set, I have a "Wildcard" feature that makes combinations from the left over 13 numbers. So out of the 8 combinations in a 6/49 game I will then have 6 that meet the filter criteria and 2 that don't, or I can have the 2 meet at least one filter criteria that I set (which is matching no more than 4 from the previous draws).

              Usually some of the 13 numbers could be part of a combination that could meet the filter criteria but there's not six of them together that can.  That when you have to decide to keep all 13 or add more numbers and just keep the ones that meet the filter criteria, it all depends on the number of lines you're planning to play.

               * you don't need to buy more tickets, just buy a winning ticket * 
                 
                           Evil Looking       


                United States
                Member #93947
                July 10, 2010
                2180 Posts
                Offline
                Posted: April 17, 2011, 2:02 pm - IP Logged

                Most active posters on topics related to systems tend to reject rigorous computer backtesting of lottery systems, for the most part, because they think the "human element" is too complex to be modeled in a computer program.  Likewise, suggestions of using computer simulations to augment backtesting efforts tend to be rejected for the same reasons.  In addition, there is significant suspicion among system proponents around the concept of randomness in general, and Random Number Generators in particular.  For this reason, I suggest the following two recently initiated Topics for anyone who shares the skepticism described here.  They are taking a different approach to systems in these threads, one which you might be more comfortable with.

                http://www.lotterypost.com/thread/229928

                http://www.lotterypost.com/thread/229672

                ==========================

                Here are two articles that illustrate how RNGs have been invaluable in solving some of the worlds toughest problems in Mathematics, Physics, Operations Research, etc.  Based on your responses to these, we can decide where to go from here.

                --Jimmy4164

                ==========================

                "Monte Carlo methods are especially useful for simulating systems with many coupled degrees of freedom, such as fluids, disordered materials, strongly coupled solids, and cellular structures (see cellular Potts model). They are used to model phenomena with significant uncertainty in inputs, such as the calculation of risk in business. They are widely used in mathematics, for example to evaluate multidimensional definite integrals with complicated boundary conditions. When Monte Carlo simulations have been applied in space exploration and oil exploration, their predictions of failures, cost overruns and schedule overruns are routinely better than human intuition or alternative "soft" methods.[2]"
                 
                "You can develop models that capture detailed information about unlikely or worst-case scenarios or obtain approximate solutions to problems that are otherwise intractable or time-consuming to analyze with traditional analytical techniques. Supported capabilities include a wide range of random and quasi-random number generators, parallel computing enabled random number generators, Markov Chain Monte Carlo simulation, and simulation of stochastic differential equations. Financial engineers and actuarial scientists use these capabilities for:
                • Incorporating uncertainty into existing models
                • Modeling interest rates
                • Pricing and valuation of stocks, bonds, options, and derivatives
                • Quantifying operational, market, or credit risk
                • Valuing financial projects, structured products, and real options
                • Assessing insurance and re-insurance risks and value
                • Evaluating financial plans and perform what-if studies"
                -------------------------

                Looks like a good time to "Reboot!"

                Since I'm not an Excel fan, I won't be downloading this FREE trial of Monte Carlo software.  I'm posting it here for anyone seriously interested in these methods who also likes Excel.

                http://www.palisade.com/risk/?gclid=CNvBlNiOpKgCFUpN4Aod8H1GHQ

                If you try it, please let us know here what you think.

                --Jimmy4164


                  garyo1954's avatar - garyo
                  Dallas, Texas
                  United States
                  Member #4549
                  May 2, 2004
                  1839 Posts
                  Offline
                  Posted: April 17, 2011, 6:16 pm - IP Logged

                  Looks like a good time to "Reboot!"

                  Since I'm not an Excel fan, I won't be downloading this FREE trial of Monte Carlo software.  I'm posting it here for anyone seriously interested in these methods who also likes Excel.

                  http://www.palisade.com/risk/?gclid=CNvBlNiOpKgCFUpN4Aod8H1GHQ

                  If you try it, please let us know here what you think.

                  --Jimmy4164


                  Jimbooble!!!!!!

                  Will wonders never cease? Here you are moaning, complaining, and crying about having to pay for lottery software and won't try a FREE Monte Carlo simulation.


                    United States
                    Member #93947
                    July 10, 2010
                    2180 Posts
                    Offline
                    Posted: April 17, 2011, 8:26 pm - IP Logged

                    Jimbooble!!!!!!

                    Will wonders never cease? Here you are moaning, complaining, and crying about having to pay for lottery software and won't try a FREE Monte Carlo simulation.

                    I've never paid for lottery software and I write my own Monte Carlo simulations in C.

                    Was there a glitch in your post?  It looks like your comments on experiences with Monte Carlo methods in Excel must have been truncated. (?)

                    I also haven't been able to locate any of your comments on JADELottery's simulation runs in the Lottery Discussion Forum.  Read Doug's latest post; the simulator will cease to function soon.

                    http://www.lotterypost.com/thread/229884/2025692

                    --Jimmy4164

                      garyo1954's avatar - garyo
                      Dallas, Texas
                      United States
                      Member #4549
                      May 2, 2004
                      1839 Posts
                      Offline
                      Posted: April 17, 2011, 9:41 pm - IP Logged

                      I've never paid for lottery software and I write my own Monte Carlo simulations in C.

                      Was there a glitch in your post?  It looks like your comments on experiences with Monte Carlo methods in Excel must have been truncated. (?)

                      I also haven't been able to locate any of your comments on JADELottery's simulation runs in the Lottery Discussion Forum.  Read Doug's latest post; the simulator will cease to function soon.

                      http://www.lotterypost.com/thread/229884/2025692

                      --Jimmy4164

                      Jimbooble!!!!

                      There's a revelation for everybody! You never buy lottery software but your Magic Ju-Ju tells you it's all bad. Maybe you should put that Magic Ju-Ju to work, win the lottery, and buy all the software you want.

                      I'm not terribly impressed you can write C. Most people your age have already mastered D, E, F, G, H, .......all the way to Z! 

                      My comments on JADELottery? He's one of the very creative and 'think outside the box' people I come here to find. Haven't read the post you are talking about yet. Super secret lottery work is keeping me busy.

                        Avatar
                        Kentucky
                        United States
                        Member #32652
                        February 14, 2006
                        7344 Posts
                        Offline
                        Posted: April 17, 2011, 10:25 pm - IP Logged

                        Jimbooble!!!!

                        There's a revelation for everybody! You never buy lottery software but your Magic Ju-Ju tells you it's all bad. Maybe you should put that Magic Ju-Ju to work, win the lottery, and buy all the software you want.

                        I'm not terribly impressed you can write C. Most people your age have already mastered D, E, F, G, H, .......all the way to Z! 

                        My comments on JADELottery? He's one of the very creative and 'think outside the box' people I come here to find. Haven't read the post you are talking about yet. Super secret lottery work is keeping me busy.

                        "I'm not terribly impressed you can write C. Most people your age have already mastered D, E, F, G, H, .......all the way to Z!"

                        Did anybody else snort their soft drink through their nose after reading this?

                        ROFL ROFL

                          Avatar
                          Kentucky
                          United States
                          Member #32652
                          February 14, 2006
                          7344 Posts
                          Offline
                          Posted: April 17, 2011, 11:40 pm - IP Logged

                          Jimbooble!!!!

                          There's a revelation for everybody! You never buy lottery software but your Magic Ju-Ju tells you it's all bad. Maybe you should put that Magic Ju-Ju to work, win the lottery, and buy all the software you want.

                          I'm not terribly impressed you can write C. Most people your age have already mastered D, E, F, G, H, .......all the way to Z! 

                          My comments on JADELottery? He's one of the very creative and 'think outside the box' people I come here to find. Haven't read the post you are talking about yet. Super secret lottery work is keeping me busy.

                          Now that I composed myself.

                          "Haven't read the post you are talking about yet."

                          Maybe it's just me, but before I make a bet, I want know what I'm betting on.

                          Would I bet $1 on the next 10 pick-5 games trying to match 2 or 3 numbers? Nope.

                          Would I bet $10 on the next drawing trying to match 2 or 3 numbers? Nope

                          Would I make either bet in the next 15,000,000 drawings for the same reasons? You got to be kidding me.

                          A true test would calulate how many jackpots were won by betting $1 in 15 million drawings and how many jackpots were won by betting $10 in 1.5 million drawings. Do we really need computer simulations when we have fingers and toes?

                          Would I make one $10 bet trying to win $5000 in pick-3 game? Done it many times.

                          Would I make a $1 bet on the next 10 drawings trying to win $5000? Huh?

                          It may be an interesting discussion for anyone throwing out any reasons for making those bets. But since Jade mentioned something about how the average Bob & Carol & Ted & Alice would bet and I'm pretty sure they would go for a multi-million dollar jackpot and certainly not try to match 2 or 3 numbers that pay $1 and $10 or even go for $500 or $5000 playing pick-3 and pick-4.

                          For those who like the drama waiting for the results promised on Thursday, bet they chose $1 for the next 10 drawings for any bet.


                            United States
                            Member #93947
                            July 10, 2010
                            2180 Posts
                            Offline
                            Posted: April 21, 2011, 7:43 pm - IP Logged

                            Since Basic is the most mentioned computer language here, I adapted the Roulette Simulation from TASC magazine to simulate a Pick3 Game.  You should be able to use the source code below to experiment with other simulations.  The code is simple because it merely outputs one number for each Trial (Person), leaving the graphics, if wanted, to Excel, or any other program you might prefer.  I loaded it into Excel and produced a Histogram similar to those I scanned from the magazine above.  The first picture is a pure bar chart based on the frequencies of Equity segments in the data.

                            If you're smiling at the crudeness and lack of good formatting and labels in this chart, then you are one of the people I'm hoping will give us some tips on how to better utilize Excel for charting!

                            This second graph is a screen capture describing the same data, but is using mean and standard calculations of the descriptive statistics module I have installed im my Excel.  It's called Analyze-It.  I've been told that newer versions of Excel can accomplish a lot of what it does, so this is just FWIW.

                             

                            In this run, among other things, I found the following:

                            Of the 50,000 "People" who played for 13.7 years...

                              1012  Broke even (Ended up with their original $5000)

                                539  were ahead $500

                                240  were ahead $1000

                                  37  were ahead $1500

                                    6  were ahead $2000

                                    4  were ahead $2500

                            I'll leave it up to you to calculate the fate of the rest! Smile

                            The source code below tells you what this data means.

                            I don't have time now to discuss this, so I'll leave it for you to mull over for a while.  What I'm hoping you will eventually be convinced that fair and purely random lotteries can result in people winning far above average expectations, even in Pick3s, WITH NO MORE THAN CHANCE to assist them!

                            Here's a link to the output of a run of the program below:

                            http://www.box.net/shared/sign4r88k3

                            Here's the source code of the Basic code.  Basic is not my "Native" language, so please check it carefully.

                            '
                            ' Simulation of a Pick-3 Lottery Game
                            '
                            '     Adapted by Jimmy4164 from Phil Abel's
                            '     Roulette Simulation in Casino Trading,
                            '     TASC Magazine, November, 2003
                            '
                            '     Assumes that 50,000 People each buy one $1 Straight
                            '     ticket per day for 5000 Days, or about 13.7 Years.
                            '     A Win pays $500.

                                  DIM Equity AS LONG
                                  DIM Person AS LONG
                                  DIM DDraw AS INTEGER
                                  DIM LP AS INTEGER             ' Lottery's Pick
                                  DIM QP AS INTEGER             ' Player's QP

                            '     Print results to an Excel file for further analysis

                                  OPEN "PICK3.CSV" FOR OUTPUT AS #3

                                  PRINT #3, "Equity"

                                  RANDOMIZE 11  ' Try different seeds and observe results

                                  FOR Person = 1 TO 50000       ' 50,000 "People"

                                     Equity = 5000              ' $5000 Starting Equity

                                     FOR DDraw = 1 TO 5000      ' Cycle through the Draws

                            '           Buy a Ticket
                                        QP = 100 * INT(RND * 10) + 10 * INT(RND * 10) + INT(RND * 10)

                            '           Pay the Clerk!
                                        Equity = Equity - 1

                            '           Let the Balls Fly!
                                        LP = 100 * INT(RND * 10) + 10 * INT(RND * 10) + INT(RND * 10)

                                        IF QP = LP THEN Equity = Equity + 500

                                     NEXT DDraw

                            '        Write each Person's Equity to the file
                                     PRINT #3, Equity           ' $5000 - Costs + Winnings

                                     IF Person MOD 500 = 0 THEN PRINT Person, Equity, QP, LP 'Halo?

                                  NEXT Person

                                  CLOSE #3  ' Close the file

                                  END


                              United States
                              Member #93947
                              July 10, 2010
                              2180 Posts
                              Offline
                              Posted: April 21, 2011, 7:49 pm - IP Logged

                              P.S.  In Excel, after loading the data file, go to

                              tools/Data Analysis/Histogram and go from there.

                                 
                                Page 8 of 10