A Question About Probability

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ganchrow
    SBR Hall of Famer
    • 08-28-05
    • 5011

    #36
    As far as this goes:
    Originally posted by VideoReview
    I am having a compile error when I ran the PRNG script so I am still running the original Monte Carlo script.
    it sounds to me like you might not have properly installed the Mersenne Twister PRNG module.

    Assuming you're using using ActiveState Perl on Windows you can install it with the following line from a command
    Last edited by SBRAdmin3; 07-03-14, 06:08 PM.
    Comment
    • VideoReview
      SBR High Roller
      • 12-14-07
      • 107

      #37
      Originally posted by Ganchrow
      There's nothing wrong with estimating p-values using Monte Carlo simulations. There is, however, something wrong with estimating p-values using Monte Carlo simulations in Excel. It's hard on the soul.

      Here's a very simple Monte Carlo script coded in Perl. (You can download a free copy of Perl from On a decent machine you should easily be able to run 2,000,000 55-bet trials in a minute or less. You should modify the EDGE, TRIALS, and BOGEY constants to suit your needs.
      Do you have any code you would be willing to part with that permits weights? For example, I currently generate a positive edge prediction for each of the decimal odds.

      +120 .0645544
      -110 .0323433
      etc.

      These would be my full edge expectations at 95% confidence level. I would then bet the percentage required to win that edge. In practice, I bet 1/4 Kelly (i.e. .065544 / 4). So, I know what the total Bogey results are for the sample assuming 1 /4 Kelly (or whatever percentage I like) and would like to calculate the probability that the Bogey result I obtained from the weighted bets was by chance.

      Thanks Ganchrow.
      Last edited by SBRAdmin3; 07-03-14, 06:08 PM.
      Comment
      • Ganchrow
        SBR Hall of Famer
        • 08-28-05
        • 5011

        #38
        Originally posted by VideoReview
        Do you have any code you would be willing to part with that permits weights? For example, I currently generate a positive edge prediction for each of the decimal odds.

        +120 .0645544
        -110 .0323433
        etc.

        These would be my full edge expectations at 95% confidence level. I would then bet the percentage required to win that edge. In practice, I bet 1/4 Kelly (i.e. .065544 / 4). So, I know what the total Bogey results are for the sample assuming 1 /4 Kelly (or whatever percentage I like) and would like to calculate the probability that the Bogey result I obtained from the weighted bets was by chance.

        Thanks Ganchrow.
        First off and for whatever it's worth, while betting to win 1/4 edge is typically a very accurate approximation to quarter-Kelly it isn't really quarter-Kelly. The exact formula for single-bet quarter-Kelly would be:
        K¼ = ( (wp)0.25 - (1 - p)0.25 ) / ((wp)0.25 + w * (1 - p)0.25) if > 0

        And for n-Kelly:
        Kn = ( (wp)n - (1 - p)n ) / ((wp)n + w * (1 - p)n) if > 0

        I have to say that you're probably best off learning a bit of a Perl so you can tailor the above program to your own personal needs (or redoing the entire program in a language with which you already comfortable. As I'm sure you can understand I don't rea;ly want to get into the habit of programming-on-demand for every poster that asks.

        Now that said, because I've been so remiss in getting back to you on your other questions that I feel kind oif guilty. So here's how I'd modify the montecarlo.pl script to permit bet sizing specifications in your input file.

        Code:
        #!perl
        
        # Author: [email]ganchrow@sbrforum.com[/email]
        # a very simple implementation of the
        # Monte Carlo method in fixed odds
        # sports betting
        # input: whitespace delimited list of US-style
        # odds and bet sizes.
        # if bet size is omitted from the input
        # then a bet size to win 1 unit is assumed
        use strict;
        use warnings;
        
        ### edit from here ###
        use constant EDGE	=>	0;
        use constant TRIALS	=>	3_000_000;
        use constant BOGEY	=>	0.1572035;	# as % of risk amount
        ### don't edit below this line unless you know what you're doing ###
        
        my @odds_ra = ();
        my $total_risk = 0;
        
        while(<>) {
        	chomp;
        	my ($us, $bet_size) = split;
        	next unless $us;
        	my $dec = &us2dec($us);
        	my $prob = (1+EDGE)/$dec;
        	my $risk = defined $bet_size ? $bet_size : 1/($dec-1);
        	my $win = $risk * ($dec - 1);
        	push @odds_ra, [$prob, $dec, $risk, $win];
        	$total_risk += $risk;
        }
        
        my ($sum,$sumsq,$qualifiers,) = (0.0, 0.0, 0,);
        my $pct_bogey = BOGEY * $total_risk ;
        foreach my $i ( 1 .. TRIALS) {
        	my $this_trial_result = 0;
        	print STDERR "Trial $i\n" if $i%10_000 == 0;
        	foreach my $j (0 .. $#odds_ra) {
        		my ($prob, $dec, $risk, $win,) = @{$odds_ra[$j]};
        		my $r = rand();
        		my $this_bet_result;
        		if ($r < $prob) {
        			# win
        			$this_bet_result = $win;
        		} else {
        			$this_bet_result = -$risk;
        		}
        		$this_trial_result += $this_bet_result;
        	}
        	print "$this_trial_result\n";
        	$qualifiers++ if $this_trial_result >= $pct_bogey;
        	$sum += $this_trial_result;
        	$sumsq += $this_trial_result*$this_trial_result;
        }
        my $mean = $sum / TRIALS;
        my $stddev = sqrt($sumsq / TRIALS - $mean*$mean);
        my $frequency = $qualifiers / TRIALS;
        print STDERR "Mean     \t$mean\n";
        print STDERR "Std. Dev.\t$stddev\n";
        print STDERR "Qual     \t$frequency\n";
        
        sub us2dec {
        	my $us = shift;
        	return (
        		$us >= 0 ? 1+$us/100 : 1-100/$us
        	);
        }
        The input should should contain a list of US-style odds and bet sizes separated by a tab or a space. Each new bet should (as before) be on a its own line. For backwards compatability if no bet size is given the script still assumes betting to win a single unit.

        Modifying the code to accept edges rather than bet sizes and then calculate n-Kelly from there should be trivial.
        Comment
        • VideoReview
          SBR High Roller
          • 12-14-07
          • 107

          #39
          Originally posted by Ganchrow
          First off and for whatever it's worth, while betting to win 1/4 edge is typically a very accurate approximation to quarter-Kelly it isn't really quarter-Kelly. The exact formula for single-bet quarter-Kelly would be:
          K¼ = ( (wp)0.25 - (1 - p)0.25 ) / ((wp)0.25 + w * (1 - p)0.25) if > 0

          And for n-Kelly:
          Kn = ( (wp)n - (1 - p)n ) / ((wp)n + w * (1 - p)n) if > 0

          I have to say that you're probably best off learning a bit of a Perl so you can tailor the above program to your own personal needs (or redoing the entire program in a language with which you already comfortable. As I'm sure you can understand I don't really want to get into the habit of programming-on-demand for every poster that asks.
          Yeah, I would have to agree that you providing this code-on-demand service for SBR is really very convenient and I could see how it could get out of hand quickly. Thanks for everything you've done.

          Regarding the correct n-Kelly amounts, I have played with your online Kelly calculator to figure out how to convert edge and odds to win percentage but have not been able to come up with the formula.

          For example, If I have +200 and edge of .05 and -150 and edge of .02, how do I calculate win %'s so I can put it into the Kelly equation you have given?
          Comment
          • Ganchrow
            SBR Hall of Famer
            • 08-28-05
            • 5011

            #40
            Originally posted by VideoReview
            Yeah, I would have to agree that you providing this code-on-demand service for SBR is really very convenient and I could see how it could get out of hand quickly. Thanks for everything you've done.
            I hope you noticed that I modified the code in this post to do what you had wanted.

            Originally posted by VideoReview
            Regarding the correct n-Kelly amounts, I have played with your online Kelly calculator to figure out how to convert edge and odds to win percentage but have not been able to come up with the formula.

            Let E = edge
            Let d = decimal odds

            then win probability = (1+E)/d

            Originally posted by VideoReview
            For example, If I have +200 and edge of .05
            win prob = 1.05/ = 35%.

            Originally posted by VideoReview
            -150 and edge of .02
            win prob = 1.02/ = 61.2%
            Last edited by SBR Jonelyn; 04-16-15, 01:58 PM. Reason: link does not work
            Comment
            • VideoReview
              SBR High Roller
              • 12-14-07
              • 107

              #41
              Originally posted by Ganchrow
              I hope you noticed that I modified the code in this post to do what you had wanted.

              Let E = edge
              Let d = decimal odds

              then win probability = (1+E)/d

              win prob = 1.05/ = 35%.

              win prob = 1.02/ = 61.2%

              I did notice that they were much the same code. Thanks.


              So, a 1/4 Kelly for +200 odds with a 5% edge becomes:

              ((2*0.35)^0.25-(1-0.35)^0.25)/((2*0.35)^0.25+0.35*(1-0.35)^0.25) = .013662371

              1/4 Kelly=.013662371
              1/2 Kelly=.027201635
              3/4 Kelly=.040617158
              Full Kelly=.053908356

              For 1/4 Kelly, I would bet .013662371 * (100 / 200) or 0.68311% of my bankroll.

              Have I applied all of this correctly?
              Last edited by SBR Jonelyn; 04-16-15, 01:59 PM. Reason: link does not work
              Comment
              • Ganchrow
                SBR Hall of Famer
                • 08-28-05
                • 5011

                #42
                Originally posted by VideoReview
                So, a 1/4 Kelly for +200 odds with a 5% edge becomes:

                ((2*0.35)^0.25-(1-0.35)^0.25)/((2*0.35)^0.25+0.35*(1-0.35)^0.25) = .013662371
                Actually it should be:

                ((2*0.35)^0.25-(1-0.35)^0.25)/((2*0.35)^0.25+2*(1-0.35)^0.25) = 0.6195%

                Can you tell the difference?
                Originally posted by VideoReview
                1/4 Kelly=.013662371
                1/2 Kelly=.027201635
                3/4 Kelly=.040617158
                Full Kelly=.053908356
                1/4 Kelly=0.6195%
                1/2 Kelly=1.2427%
                3/4 Kelly=1.8695%
                Full Kelly=2.5000%
                Comment
                • VideoReview
                  SBR High Roller
                  • 12-14-07
                  • 107

                  #43
                  Originally posted by Ganchrow
                  Actually it should be:

                  ((2*0.35)^0.25-(1-0.35)^0.25)/((2*0.35)^0.25+2*(1-0.35)^0.25) = 0.6195%

                  Can you tell the difference?

                  1/4 Kelly=0.6195%
                  1/2 Kelly=1.2427%
                  3/4 Kelly=1.8695%
                  Full Kelly=2.5000%

                  Yes, that is a pretty big mistake and deserves a big flashing green number 2 for sure.

                  I would like to double check with you the -150 with 2% edge as well just in case there is some nuance for minus odds that I may miss (I take -150 as 100/150 or .6666666). I am really hoping I do not get a big blinking number again.

                  1/4 Kelly=0.7530%
                  1/2 Kelly=1.5040%
                  3/4 Kelly=2.2530%
                  Full Kelly=3.0000%
                  Comment
                  • Ganchrow
                    SBR Hall of Famer
                    • 08-28-05
                    • 5011

                    #44
                    <marquee>
                    Originally posted by VideoReview
                    -150 with 2% edge as well just in case there is some nuance<br>for minus odds that I may miss (I take -150 as 100/150 or .6666666). I am really hoping I do not get a<br>big blinking number again.
                    <br>
                    <br>1/4 Kelly=0.7530%
                    <br>1/2 Kelly=1.5040%
                    <br>3/4 Kelly=2.2530%
                    <br>Full Kelly=3.0000%
                    </marquee>
                    You got it.
                    Comment
                    • VideoReview
                      SBR High Roller
                      • 12-14-07
                      • 107

                      #45
                      Originally posted by Ganchrow
                      The input should contain a list of US-style odds and bet sizes separated by a tab or a space. Each new bet should (as before) be on a its own line. For backwards compatibility if no bet size is given the script still assumes betting to win a single unit.

                      Modifying the code to accept edges rather than bet sizes and then calculate n-Kelly from there should be trivial.
                      Ganch, I would like to use the Perl code with weights to determine my p value based on how much I bet on various odds. I believe when you wrote the code it was with the intention that I would enter a percentage edge that I figured I had for each bet as the weight (i.e. -120 .05 would represent -120 odds with an expected +EV of 5 percent). Is there anything I could put in the second column that would weight the odds by how much I bet assuming that I perceived the edge to be the same for all bets (or did not know the number)? For example, if I had the following bets:

                      -120 120.00
                      150 80.00
                      1200 1.00
                      -110 70.00

                      The second column is how much I have bet. I was thinking of making the weight column the amount of money that would have been won if the bet did win.

                      Basically, getting rid of bets that were cancelled or a push, my final numbers for the last quarter were:
                      Win=47.42176
                      Bet=42.90906
                      # Of Bets (excluding push and cancel)=602

                      My bets, for the most part, were fairly close to even odds for the most part but the dollar values increased by about 5 times over the course of the quarter. I am trying to determine the probability that the results were random. Using the CLT, I get 1-NORMSDIST((47.42176-42.90906)/sqrt(42.90906)=0. The inside of part of the NORMSDIST equation evaluates to 21.78522 which I understand to mean that the results were 21.78522 standard deviations away from the mean, which is essentially zero. The only concern I have is that my bet sizes may not be normally distrubuted which is why I would like to do a Monte Carlo run.

                      Any suggestions?
                      Comment
                      • Ganchrow
                        SBR Hall of Famer
                        • 08-28-05
                        • 5011

                        #46
                        Is this what you're looking for?
                        Last edited by SBRAdmin3; 07-03-14, 06:08 PM.
                        Comment
                        • VideoReview
                          SBR High Roller
                          • 12-14-07
                          • 107

                          #47
                          [QUOTE=Ganchrow;749592]Is this what you're looking for? OTE]

                          I did go throught the whole post again before my last post and we only discussed the weighting briefly (after you posted the revised code). So I was wondering, what should I put in the weight column for the various bet sizes I made? Is it the actual dollars bet, the amount that could be won with those dollars (my guess), or something else?
                          Last edited by SBRAdmin3; 07-03-14, 06:08 PM.
                          Comment
                          • Ganchrow
                            SBR Hall of Famer
                            • 08-28-05
                            • 5011

                            #48
                            Originally posted by VideoReview
                            I did go throught the whole post again before my last post and we only discussed the weighting briefly (after you posted the revised code). So I was wondering, what should I put in the weight column for the various bet sizes I made? Is it the actual dollars bet, the amount that could be won with those dollars (my guess), or something else?
                            Risk amount, i.e., units bet.
                            Comment
                            • VideoReview
                              SBR High Roller
                              • 12-14-07
                              • 107

                              #49
                              Originally posted by Ganchrow
                              Risk amount, i.e., units bet.
                              Thanks. Both the program and results worked great. After a 10 million run simulation on every single one of my 582 actual bets over the last 3 months weighted to the actual amount that I bet, my p-value came in at .0328267. I interpret this to mean that if my edge was zero (that I had developed a methodology that gave me an edge equal to the vig), I should only win as much as I did 1 out of 30.46 times or once in 7.62 years. I am now certain (well, at least 96.72% certain anyways ) that I am playing with an advantage. Does this assumption seem reasonable to you given the information above? (I am really hoping that you say as I consider you my final authority on this subject)
                              Comment
                              • Ganchrow
                                SBR Hall of Famer
                                • 08-28-05
                                • 5011

                                #50
                                Originally posted by VideoReview
                                After a 10 million run simulation on every single one of my 582 actual bets over the last 3 months weighted to the actual amount that I bet, my p-value came in at .0328267. I interpret this to mean that if my edge was zero (that I had developed a methodology that gave me an edge equal to the vig), I should only win as much as I did 1 out of 30.46 times
                                Assuming your data's clean (mean that you're looking at all the bets you've placed and not some cherry-picked sample) then yeah, you got it. Congratulations.
                                Comment
                                • VideoReview
                                  SBR High Roller
                                  • 12-14-07
                                  • 107

                                  #51
                                  Originally posted by Ganchrow
                                  Assuming your data's clean (mean that you're looking at all the bets you've placed and not some cherry-picked sample) then yeah, you got it. Congratulations.
                                  It seemed obvious to me but because of the gravity of the situation and its long term implications, I needed to hear it from you.

                                  The data sample includes every bet starting from the first day I made my initial large deposit on 02/14/2008. This deposit was larger than all previous deposits combined for the previous 15 months (from the first day I ever placed an online sports bet) during my experimentation period which I would hope would seem a logical break from experimentation to implementation to an unbiased outsider. Not to say that I am not experimenting still but those numbers are definitely included in the sample I ran. The only bets that were not included were cancelled games (i.e. rain etc.) or pushes. In all of the several current (from about the mid 90's) Journal papers I have been reading, this was the preferred way to handle pushes. Older papers (i.e. 1980's etc. often, but not always, include pushes in their calculations).

                                  My bookkeeping is pretty simple since I only operate at one book, Pinnacle, (sure sign of a square to only have one out I know but that will be addressed down the road) and they clearly list every bet on a month by month basis which is where I got the information from (as opposed to my own hand written and computer records) for the Perl run. Also, I checked their monthly bet and won totals as well as the number of bets with my totals to reconcile any errors or typing mistakes and made everything balance to the penny.

                                  Well, I will be working hard to continue to improve my methodology but feel I have crossed a major personal milestone here (which is why I am rambling).

                                  I am not sure how many people you have assisted in becoming an advantage player but you can add one more. I have been lurking on a few different forums and have not come across anyone as knowledgeable and helpful as yourself. Thanks again.
                                  Last edited by VideoReview; 05-19-08, 07:57 PM.
                                  Comment
                                  • Ganchrow
                                    SBR Hall of Famer
                                    • 08-28-05
                                    • 5011

                                    #52
                                    Excellent.

                                    I'm glad it's working out and I'm glad I could help in getting you there. I appreciate the kind words.

                                    Just keep doing what you're doing and remember that strategy development only stops when you're dead.

                                    The way you're handling pushes, btw, is (generally speaking) perfectly acceptable.
                                    Comment
                                    SBR Contests
                                    Collapse
                                    Top-Rated US Sportsbooks
                                    Collapse
                                    Working...