SBR Forum - Free Picks & Sports Handicapping Legendz The PIG WSEX
BetJamaica Matchbook BetOnline
SBR - SportsBookReview.com 5Dimes The Greek Intertops
SBR Recommended Sportsbooks
1. Pinnacle Sports ... SBR Rating A+ ... Pinnacle Sports Review
2. The Greek Sports Book ... SBR Rating A+ ... The Greek Review
3. BookMaker ... SBR Rating A+ ... BookMaker Review
4. BetJamaica ... SBR Rating A+ ... BetJamaica Review
5. Legendz Sports ... SBR Rating A+ ... Legendz Review
Posters' Top Rated Sportsbooks
1. Matchbook ... 195 total points ... Matchbook Review
2. BetJamaica ... 182 total points ... BetJamaica Review
3. The Greek Sports Book ... 160 total points ... The Greek Review
4. Pinnacle Sports ... 130 total points ... Pinnacle Sports Review
5. 5Dimes ... 125 total points ... 5Dimes Review
Go Back   Sports Handicapping - Sports Betting - Sports Picks - SBR Forum > Sports Betting, Sportsbooks & General Discussion > Handicapper Think Tank

Reply
 
Thread Tools Display Modes
Old 03-01-2008, 01:28 AM   #36 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

As far as this goes:
Quote:
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 prompt:
ppm install http://bettingtools.sbrforum.com/etc...-Random-MT.ppd
__________________
Reply With Quote
Old 03-03-2008, 04:30 PM   #37 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default

Quote:
Originally Posted by Ganchrow View Post
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 http://www.activeperl.com/.) 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.
Reply With Quote
Old 03-03-2008, 05:05 PM   #38 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

Quote:
Originally Posted by VideoReview View Post
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: ganchrow@sbrforum.com
# 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.
__________________
Reply With Quote
Old 03-03-2008, 06:01 PM   #39 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default

Quote:
Originally Posted by Ganchrow View Post
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?
Reply With Quote
Old 03-03-2008, 06:10 PM   #40 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

Quote:
Originally Posted by VideoReview View Post
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.

Quote:
Originally Posted by VideoReview View Post
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

Quote:
Originally Posted by VideoReview View Post
For example, If I have +200 and edge of .05
win prob = 1.05/ = 35%.

Quote:
Originally Posted by VideoReview View Post
-150 and edge of .02
win prob = 1.02/ = 61.2%
__________________
Reply With Quote
Old 03-03-2008, 06:59 PM   #41 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default

Quote:
Originally Posted by Ganchrow View Post
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 VideoReview : 03-03-2008 at 07:04 PM. Reason: Missed answering a question.
Reply With Quote
Old 03-03-2008, 07:14 PM   #42 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

Quote:
Originally Posted by VideoReview View Post
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?
Quote:
Originally Posted by VideoReview View Post
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%
__________________
Reply With Quote
Old 03-03-2008, 08:36 PM   #43 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default

Quote:
Originally Posted by Ganchrow View Post
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%
Reply With Quote
Old 03-03-2008, 08:56 PM   #44 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

Quote:
Originally Posted by VideoReview View Post
-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%

You got it.
__________________
Reply With Quote
Old 05-15-2008, 03:26 PM   #45 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default

Quote:
Originally Posted by Ganchrow View Post
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?
Reply With Quote
Old 05-15-2008, 03:42 PM   #46 (permalink)
Ganchrow
Moderator
 
Ganchrow's Avatar
 
Join Date: 08-28-05
Location: Forest Hills, NY, Home of the Blitzkrieg Bop
Posts: 4,587
Ganchrow is offline
Default

Is this what you're looking for? A Question About Probability
__________________
Reply With Quote
Old 05-15-2008, 04:25 PM   #47 (permalink)
VideoReview
SBR High Roller
 
Join Date: 12-14-07
Location: Canada
Posts: 105
VideoReview is offline
Default