PDA

View Full Version : Monte Carlo beta software - any testers?


highnote
11-06-2006, 12:11 AM
I've written a Monte Carlo simulator and attached it to this post.

It will generate an oddsline from your ratings.

All you do is:

1. Enter the number of trials -- 1000 is probably a good number

2. Enter the Standard Deviation of your numbers. This is up to you to figure out what to use. For Beyer speed figures I might use 30. They key is that you have to make the SD big enough to give every horse a chance because in reality ever horse has some probability of winning before the race.

3. Enter the number of runners. Currently, the maximum is 6. I'll probably expand it to 40 or more later.

4. Enter the ratings for each horse.

5. Click "Go Monte Carlo".

HINT: Use the tab key to jump from box to box

Good luck. Let me know what you think.

John

PS

PA, any chance you can up the file size limit for uploaded files. 30KB is pretty small. I had to use an old DOS version of PKZIP to make this fit. The WinZip would only make it 30.2KB which exceeded the limit by 0.2KB.


Editor's Note:

You can find the newest version of this software at this link:

http://www.paceadvantage.com/forum/showpost.php?p=327839&postcount=8

PaceAdvantage
11-06-2006, 12:22 AM
Sure I can up the limit...however....

What size do you think would be more acceptable, while at the same time, making sure my limited resources aren't pushed to the limit?

I'm open to suggestions....

highnote
11-06-2006, 12:31 AM
Sure I can up the limit...however....

What size do you think would be more acceptable, while at the same time, making sure my limited resources aren't pushed to the limit?

I'm open to suggestions....


Good question. Unzipped this file was 60KB.

I wrote some other ones that zipped to 4KB.

So this one must be bigger because I put my company's jpg logo on it.

Others I've written were only 20KB unzipped. So nevermind.

You've probably got it set right.

Thanks anyway for your quick reply!

John

PaceAdvantage
11-06-2006, 12:33 AM
If you ever need a temporary increase, I'll be more than happy to do it so that you can upload a file......just contact me via PM or email....

csmith
11-06-2006, 02:13 PM
I've written a Monte Carlo simulator and attached it to this post.

It will generate an oddsline from your ratings.

All you do is:

1. Enter the number of trials -- 1000 is probably a good number

2. Enter the Standard Deviation of your numbers. This is up to you to figure out what to use. For Beyer speed figures I might use 30. They key is that you have to make the SD big enough to give every horse a chance because in reality ever horse has some probability of winning before the race.

3. Enter the number of runners. Currently, the maximum is 6. I'll probably expand it to 40 or more later.

4. Enter the ratings for each horse.

5. Click "Go Monte Carlo".

HINT: Use the tab key to jump from box to box

Good luck. Let me know what you think.

John

PS

PA, any chance you can up the file size limit for uploaded files. 30KB is pretty small. I had to use an old DOS version of PKZIP to make this fit. The WinZip would only make it 30.2KB which exceeded the limit by 0.2KB.



I like the program very much but would like to see more places for runners and instead of numbering the runners could you make a fill in box so that we could insert the numbers ourselves ?? The reason being that in some races you have entries such as 1A or 2b etc..I would also like to see a button that clears all the previous info..Even if you don't want to make these changes I like the program and thanks very much for making it available to us

highnote
11-06-2006, 02:38 PM
I like the program very much but would like to see more places for runners and instead of numbering the runners could you make a fill in box so that we could insert the numbers ourselves ?? The reason being that in some races you have entries such as 1A or 2b etc..I would also like to see a button that clears all the previous info..Even if you don't want to make these changes I like the program and thanks very much for making it available to us

Good point. I thought about that. Seeing the question in black and white gave me an idea for the solution.

I'll do that and upload a new version once I get several other recommendations.

csmith
11-06-2006, 02:45 PM
Thanks. I'll be anxiously waiting. I have been using the program this afternoon at Suffolk with great results




Cliff

highnote
11-06-2006, 11:07 PM
Here's a new version that allows you to enter your program numbers.

PA, Do you want to delete the old one to save space?

csmith
11-07-2006, 05:53 AM
thanks for the new update. One thing I noticed is that the numers in the probabilty box and the odds-1 are very light in color, very hard for me to read easily. Could those boxes be a darker print ?? I used the program to play Mountainer last night and made a nice profit. Althoug it is great now, I think when you include more than 6 runners you will have a superior little program. I have been looking for something like this for a long time

Thanks again very much,
Cliff

robert99
11-07-2006, 09:43 AM
Thanks for your kindness.
Simple and very easy to use.
Would need to allow option of individual SDs for each horse?

I have done a blind trial for the 6.20 7f race to be run at Wolverhampton UK on polytrack. The Racing Post provides a morning line, speed ratings and weight ratings. We have a univeral class/weight type handicap for every horse in UK.

I have had to increase the global SD to 100 for the speed ratings (1) and 50 for the weight ratings 92) to get figures anywhere near the morning lines. SD needs to be calibrated to rating source used.

morning line: name: speed rating: class rating: MC odds1: MC odds2

5/1 No Grouse 70 81 6/1 5/1
6/1 Mozakhrof 50 80 19/1, 7/1
6/1 Patavium Prince 71 84 9/2 3/1
6/1 Redwood Rocks 59 82 13/1 5/1
8/1 Cool Sands 74 80 3/1 8/1
8/1 Dudley Docker 81 82 2/1 4/1

The PP and DD seem to be the potential overlays.
Will update with actual starting prices and results once race has been run.

csmith
11-07-2006, 11:35 AM
One more thing I would like to see.. is a way to sort the odds so they will be easier to determine the lowest odd to the highest. I hope I am not pushing the limit asking for things ??


Cliff

highnote
11-07-2006, 11:38 AM
thanks for the new update. One thing I noticed is that the numers in the probabilty box and the odds-1 are very light in color, very hard for me to read easily. Could those boxes be a darker print ?? I used the program to play Mountainer last night and made a nice profit. Althoug it is great now, I think when you include more than 6 runners you will have a superior little program. I have been looking for something like this for a long time

Thanks again very much,
Cliff

Making the fonts darker is easy to do. I disabled those boxes so that the user could not write in them. I thought that would make it easier to use if the user had to focus on keeping the cursor in as few boxes as possible.

The one good thing about using a program like this though is that at least it systematizes part of your handicapping. It should allow the user to figure out over time what works and what doesn't and then be more consistent.

As far as making an SD for every horse, I may do that, but don't know how much work it would be. I did that for a two team monte carlo simulator I wrote, but haven't tried it for more than two. The other problem with SD is that the program assumes a horse is just as likely to run say 30 points faster as 30 points slower. Maybe a horse can improve by 10 points, but it can probably decline by 30. In other words, a horse's performance is not normally distributed.

The efficacy of this program is a function of how good the ratings are and how accurate the SD is.

The other problem with adding an SD for every horse, etc., is that it will take me a lot of time to write the code. I just wanted to write something quick to make a contribution to the PA members. I wonder if this is tax deductible? :D

If this starts to get real fancy then maybe people will be willing to pay for a more powerful commercial version? :ThmbUp: What do you think?

highnote
11-07-2006, 11:51 AM
One more thing I would like to see.. is a way to sort the odds so they will be easier to determine the lowest odd to the highest. I hope I am not pushing the limit asking for things ??


Cliff

Suggest as many things as you can. That requires a lot of reprogramming to sort everything and then re-display it. I'd have to redo the whole user interface. It can be done, but not easily.

Again, I'm trying to keep it simple, yet help people make a good line.

Sorting would make it more complicated programming-wise and would not make the line any better. However, it would make the overall program more useful, so is something that I would consider later on.

Right now, the priority is to make the software make a good line.

Thanks.

John

Light
11-07-2006, 12:02 PM
SJ

I have 2 major ratings I give a horse. One of those is a 3 digit speed rating ,the other is a decimal number such as 2.86. Is the program able to deal with decimals?

used the program to play Mountainer last night and made a nice profit.

Can you give some insight into that.

csmith
11-07-2006, 12:39 PM
Can you give some insight into that.[/QUOTE]




Yes, I used my top 3 picks in each race. I used the
program to input my rating. I played any and all of
my picks that were overlays


DATE TRK RACE HORSE FAIR post TIME $$$ $$$
# # ODDS ODDS BET RETURN

NOV 6 MNR 1 4 2/1 6/1 $2.00
MNR 1 7 5/2 5/1 $2.00
MNR 1 5 3/1 5/2 $0.00
MNR 2 3 4/5 4/1 $2.00 $10.40
MNR 2 4 6/5 16/1 $2.00
MNR 3 2 4/5 4/5 $2.00 $3.80
MNR 3 5 9/2 3/1 $0.00
MNR 3 7 7/1 5/1 $0.00
MNR 4 8 5/2 3/2 $0.00
MNR 4 2 3/1 6/1 $2.00 $14.60
MNR 4 5 9/2 3/1 $0.00
MNR 5 5 5/2 10/1 $2.00
MNR 5 2 5/2 5/2 $2.00 $7.00
MNR 5 6 3/1 3/1 $2.00
MNR 6 4 9/5 6/5 $0.00
MNR 6 8 7/2 12/1 $2.00
MNR 6 3 5/1 8/1 $2.00
MNR 7 3 3/5 3/1 $2.00
MNR 7 5 7/5 4/1 $2.00 $10.20
MNR 8 3 8/5 6/1 $2.00
MNR 8 1 5/2 8/5 $0.00
MNR 8 4 7/1 11 $2.00
MNR 9 4 6/5 1/1 $0.00
MNR 9 7 5/1 3/1 $0.00
MNR 9 5 7/1 4/1 $0.00
MNR 10 5 9/5 2/1 $2.00 $6.60
MNR 10 6 3/1 3/1 $2.00
10 4 3/1 7/2 $2.00

$36.00 $52.60

highnote
11-07-2006, 12:45 PM
SJ

I have 2 major ratings I give a horse. One of those is a 3 digit speed rating ,the other is a decimal number such as 2.86. Is the program able to deal with decimals?

Just about any number should be OK. Maybe some really large numbers wouldn't work - like 1,000,000,000,000,000. I haven't tried all numbers.

Maybe negative numbers would work. Best I can say is try it. You can't hurt it. It might crash, that's about it.

robert99
11-07-2006, 03:01 PM
Thanks for your kindness.
Simple and very easy to use.
Would need to allow option of individual SDs for each horse?

I have done a blind trial for the 6.20 7f race to be run at Wolverhampton UK on polytrack. The Racing Post provides a morning line, speed ratings and weight ratings. We have a univeral class/weight type handicap for every horse in UK.

I have had to increase the global SD to 100 for the speed ratings (1) and 50 for the weight ratings (2) to get figures anywhere near the morning lines. SD needs to be calibrated to rating source used.

morning line: name: speed rating: class rating: MC odds1: MC odds2

5/1 No Grouse 70 81 6/1 5/1
6/1 Mozakhrof 50 80 19/1, 7/1
6/1 Patavium Prince 71 84 9/2 3/1
6/1 Redwood Rocks 59 82 13/1 5/1
8/1 Cool Sands 74 80 3/1 8/1
8/1 Dudley Docker 81 82 2/1 4/1

The PP and DD seem to be the potential overlays.
Will update with actual starting prices and results once race has been run.

RACE RESULT

SP = official starting price

morning line: name: speed rating: class rating: MC odds1: MC odds2, SP, placing

5/1 No Grouse 70 81 6/1 5/1 5/1 last of 12
6/1 Mozakhrof 50 80 19/1, 7/1 8/1 3rd
6/1 Patavium Prince 71 84 9/2 3/1 11/2 8th
6/1 Redwood Rocks 59 82 13/1 5/1 5/1 Winner
8/1 Cool Sands 74 80 3/1 8/1 16/1 7th
8/1 Dudley Docker 81 82 2/1 4/1 5/1 4th


The class ratings with an SD of 50 worked far better for odds forecasting than speed ratings for this race on polytrack. Speed ratings are not so dominant in UK. The runner up horse was not in first six in betting forecast.

Redwood Rocks was available at a maximum price of 7/1.
Mozakhrof 10/1
Dudley Docker 9/1
Cool Sands 16/1
Patavium Prince 5/1
No Grouse 6/1

Bala
11-07-2006, 04:17 PM
swetyejohn - Excellent work, thank you.

Believe it or not, I use a random numbers generator in specific
situations in my models. Usually what I consider “chaotic” races.
Races with limited data, today the race is on turf when most all
the horses have dirt records only. Another example, where all
the horses are coming back after a long layoff – start of the
Finger Lakes meet.


For those than need a simple primer on Standard Deviation:
http://www.robertniles.com/stats/stdev.shtml
SD does help to explain those obscure 20-1 shots in a six horse field.




_________________
OutSource congress.

PlanB
11-07-2006, 08:29 PM
Okay, dumb question, but HOW, specifically, can these stat routines help handicapping? Like I said, it's a basic question.

Handiman
11-07-2006, 09:20 PM
I've looked up Monte Carlo simulations. Very interesting. I don't quite understand how the simulation corresponds to the odds. Can you explain a bit? I know how to use ratings to develop an odds line, but can't figure how MC sim using random numbers relate to ratings.

Regards,
Handi

highnote
11-07-2006, 10:54 PM
Okay, dumb question, but HOW, specifically, can these stat routines help handicapping? Like I said, it's a basic question.

PlanB and Handi,
I think this might answer both of your questions...

Not sure what you mean by stat routines. So I will try to answer, but I don't know my answer will help you. Pardon me if you already know this answer.

If you mean monte carlo simulation, then the answer is that it probably can't help your handicapping.

The idea is that you handicap the race and come up with a rating for each horse. And then the monte carlo simulation runs the race, say 500 times, and generates an oddsline based on your ratings.

For example, let's say these are your final ratings for each horse based on whatever handicapping method you use.

85, 83, 76, 92, 77

You determine that your ratings are pretty good, but the actual ratings will be plus or minus 10 points for any given horse. So horse 1 could be anywhere from 75 to 95, horse 2 from 73 to 93, etc.

Then you generate a random number from -10 to +10 and add that number to horse 1. Repeat for horse 2 through N. That is race number 1. Maybe the first time through you get something like this:

87, 92, 83, 89, 75. Horse 2 wins this race.

Repeat the process for race number 2 through N.

Tally the results for say 1000 races. Then divide the number of wins for a given horse by 1000. That is the horse's probability of winning.

It's pretty simple, really.

There are probably more complex ways to do this that give better results, but what do you want for free. :D

Handiman
11-08-2006, 05:42 AM
Listen you big sweaty guy.....I thank you very much for the explanation. You answered my question, exactly like I needed you to, for my level of understanding.

So the +10 -10 is essentially the standard dev, albeit an arbitrary figure, say such as your suggestion to use 30 with the beyer numbers? Is that right in this situation?

Thanks again for the great work!

Handi :jump:

Handiman
11-08-2006, 05:50 AM
One more thing my friend. If I understand things right, with a large enough sample of say, 1000 horse ratings, you could actually figure out what your system's STD is for your ratings range...yes?


Handi

K9Pup
11-08-2006, 08:07 AM
One more thing my friend. If I understand things right, with a large enough sample of say, 1000 horse ratings, you could actually figure out what your system's STD is for your ratings range...yes?


Handi

MC Simulation is nothing more than a method to "run" a fairly large sample of simulated races and gather the results. The process takes a base number and the SD of that base number. The idea is to create a "performance envelope" for each entry. The base number can be times, scores, speed ratings, etc. etc., any numeric value you want to use. USUALLY you calculate/estimate the SD for each entry instead of one SD for all. The process accumulates the results of these simulations and can assign percentage for each entry, each finish.

You are right in this case you could probably take 1000 PREDICTED ratings and compare those to ACTUAL results. You could probably use the average of the absolute differences as the SD.

The "advantage" of MC SIMs is that it randomly selects a value from each entry's performance envelope repeatedly. So instead of using a fix value to compare each entry, you use MANY values.

If your original base numbers are completely accurate (ie your predicted speed ratings are exactly right) then MC SIMs will do nothing for you. If on the other hand your predicted values are within a range of actual then MC SIMs MIGHT be benefical.

For greyhounds I use MC SIMs to assign probabilites to each entry. For the base numbers I use an adjusted/filter finish time. The SD is then calculated for each entry's individual times. So one dog may have an average time of 31.00 seconds and a SD of .25 seconds. Another dog may have an average time of 31.00 but a SD of only .10 seconds. So the two dogs have the same average, but their performance windows will be different based on the SDs.

Just like any other handicapping process, output from MC SIMs is only as good as the input used.

highnote
11-08-2006, 10:38 AM
I couldn't have said it better. Thanks.

That should answer your question, Handi -- right?

kroebuck67
11-08-2006, 04:58 PM
Nice program John!

I would suggest (I'm sure you thought of it, but I'll mention anyway) a "clear entrys" control... if nothing else for the "peace of mind" of the user that they're making a new run with a "clean slate".

highnote
11-08-2006, 05:00 PM
Nice program John!

I would suggest (I'm sure you thought of it, but I'll mention anyway) a "clear entrys" control... if nothing else for the "peace of mind" of the user that they're making a new run with a "clean slate".


Good idea.

By the way, everytime you run it with the same data, it generates a whole new set of probabilities from scratch. It is interesting to note how much a longshot's odds can change from one simulation to the next.

highnote
11-08-2006, 05:20 PM
Here is a new version with some of the recommendations.

I'm going to try to add code for SD for each horse.

DJofSD
11-08-2006, 05:24 PM
I have some numbers -- 3 sets actually -- that I'd like to put into the MC program. They're from a RYO program. They are values that happen to include SD values, so, I think I'd just need to plug and chug.

However, the data sets I'm toying around with are from the BC races. I'd like to see the program expanded so I enter my numbers for races with larger number of runners.

highnote
11-09-2006, 08:02 AM
I have some numbers -- 3 sets actually -- that I'd like to put into the MC program. They're from a RYO program. They are values that happen to include SD values, so, I think I'd just need to plug and chug.

However, the data sets I'm toying around with are from the BC races. I'd like to see the program expanded so I enter my numbers for races with larger number of runners.


I've written a new version that will take as many horses as will fit on a screen -- probably 50 or so. That should cover most situations. :)

It's still got some bugs. The probabilities are fine. The bugs are cosmetic. Plus I want to make it easier to get from cell to cell to enter data. The fonts and column headings aren't quite right. Just minor stuff.

The current version you're using was easier for me to write, but it's time consuming to add more horses. The new version uses a spreadsheet type format to enter the data. I'm going to add a sort routine.

I also added the ability to make a Standard Deviation for each horse.

I'll send it to a few of you guys to test. And I'll make sure you get a final copy of it, too!

Originally I was going to give away the simple for free because it was quick to write once I had the concept figured out. Now it's getting more complex. So I'll probably stick it on my website and slap a price tag on it and see what happens. But at least you beta testers can have it for free. I appreciate your help.

Cesario!
11-09-2006, 08:48 AM
This is a great program. I routinely make a projected range, along with a most likely speed figure. Once I figure out how to convert that to SD, it should cover my needs.

Thanks!

csmith
11-09-2006, 09:22 AM
I've written a new version that will take as many horses as will fit on a screen -- probably 50 or so. That should cover most situations. :)

It's still got some bugs. The probabilities are fine. The bugs are cosmetic. Plus I want to make it easier to get from cell to cell to enter data. The fonts and column headings aren't quite right. Just minor stuff.

The current version you're using was easier for me to write, but it's time consuming to add more horses. The new version uses a spreadsheet type format to enter the data. I'm going to add a sort routine.

I also added the ability to make a Standard Deviation for each horse.

I'll send it to a few of you guys to test. And I'll make sure you get a final copy of it, too!

Originally I was going to give away the simple for free because it was quick to write once I had the concept figured out. Now it's getting more complex. So I'll probably stick it on my website and slap a price tag on it and see what happens. But at least you beta testers can have it for free. I appreciate your help.

Sign me up as a tester please>>
Thanks

highnote
11-09-2006, 09:34 AM
Sign me up as a tester please>>
Thanks


I thought you already were? But, no matter, you're signed up!

Nets
11-09-2006, 10:30 AM
I'd like to give this a test as well. Looks promising.

Thanks

highnote
11-09-2006, 10:43 AM
I'd like to give this a test as well. Looks promising.

Thanks


There is no place to sign up. Just download the second version that appears in this thread and give some suggestions. For all those who make suggestions I will give you a copy of the final version.

If I get really motivated I might sell it on my website. Or if it doesn't take too much more time, I'll may give it away for free.

I don't want to upload any more versions here because it will take up too much space -- unless PA will erase some of the earlier versions.

tahoesid
11-09-2006, 11:20 AM
Not really all that up on statistics but if I had the last 20 starts of horses in a race, would I get the SD of their starts(using speed, whatever) and then put it into the MC simulation to get some sort of line?

highnote
11-09-2006, 11:50 AM
Not really all that up on statistics but if I had the last 20 starts of horses in a race, would I get the SD of their starts(using speed, whatever) and then put it into the MC simulation to get some sort of line?


That's the million dollar question. I don't know whether you do it horse by horse or on a population of horses.

This is the reason I like to use one SD for the whole race rather than an SD for an individual horse.

I think what you have to do is make up a table of expected versus actual probabilities. Then see how well your probability estimates compare with the actuals.

John

K9Pup
11-09-2006, 12:24 PM
Not really all that up on statistics but if I had the last 20 starts of horses in a race, would I get the SD of their starts(using speed, whatever) and then put it into the MC simulation to get some sort of line?
This isn't my software, but I DO have some experience with MC SIMs.

The idea behind using MC SIMs is to simulate REAL races. So ideally you want to create performance windows that match reality. In theory horses that run consistently from race to race should have a tighter window for "today's race" than horse that go up and down.

Using past races for each horse to calculate that horse's SD seems to be the most approriate to me. But you may not want to blindly use those past races. It may be that you should only use races that are valid for today's distance, track, etc. etc. Problem is with horses you narrow down the amount of data pretty quickly.

On the other hand if you want to use one SD for ALL horses then I would suggest do a study on how well your predicted values (speed rating, etc) do to predict actual results. Measure how far you miss the actual results and create a SD from that. Bottomline I think a lot more studies need to be used to determine the best way to use his software.

I might also suggest to John that at some point you add place and show columns to your probability matrix. These will come into play more so if you use different SDs for each horse.

tahoesid
11-09-2006, 12:48 PM
That's what I was thinking. Since each horse has his own range of the way he can run a race, it would be better to get the individual sd as well and then throw the data into the Sim instead of using just the same SD for all the horses?

I suppose it starts getting more complicated the more factors get thrown into the pot but should be more accurate.

Cesario!
11-09-2006, 01:10 PM
This is a great program. I routinely make a projected range, along with a most likely speed figure. Once I figure out how to convert that to SD, it should cover my needs.

Thanks!

One comment: How hard would it be to have the program figure out a standard deviation from an input of the above information?

traveler
11-09-2006, 01:34 PM
I've been playing around with this and have been trying to get my head around MC SIM's for a while before this freebie. It does seem an individual SD for each horse might be a good idea as the performance range can be quite different per horse. Also, if you use 2 factors, say a SR and a Pace number for a runner, I guess you would have to do 2 runs for each horse and combine the 2 outputs and avg. them or weight them accordingly? More of a question for somebody that understands MC I guess. The ability to print the screen would be nice, at least I think so. Again, nice work. :jump:

PaceAdvantage
11-09-2006, 05:16 PM
I don't want to upload any more versions here because it will take up too much space -- unless PA will erase some of the earlier versions.

Feel free to upload as you wish in this thread. The program is small enough that it won't eat up any noticable space.

highnote
11-09-2006, 06:58 PM
Feel free to upload as you wish in this thread. The program is small enough that it won't eat up any noticable space.


Great! I should have something later tonight. Big improvement. Still need to add a print function.

highnote
11-09-2006, 08:59 PM
Here's the latest and greatest. It's still limited to 6 horses until I get all the bugs worked out, then I'll email all you helpful beta testers the full version.

This one uses an Excel style input for the ratings.

1. Input Number of Runners -- the data grid will open up automatically
2. Input Number of Trials
3. Input Race Number -- optional -- this is helpful if you want to print
multiple races to the same file.
4. File Name -- enter a short description like "aqu1121" for aqueduct november 21st. Do not use quotes.
a. A ".txt" ending will be added to your file name. It will open in just about any text editor.
5. Enter your data in the grid.
a. The Pgm# column is optional. It is not needed to run the simulation.
It is useful for printouts.
b. You can enter a Standard Deviation for each horse.
c. Click on a cell to enter data. The hit "enter" and the cursor will jump down one cell. You can use up and down arrow keys, too.
d. You have to click on a cell in an adjacent column to get to the next column.
6. Click "Go Monte Carlo" to run the simulation.
7. Click "Print to File" to print.
8. To sort: Click any column heading to highlight that column and then click "Sort by Column" to sort the entire grid using that column as the key.
9. Click "Clear" to clear the contents.

That's it. Enjoy.

John

PS
Let me know if you find any bugs. I know they're in there. The calculations are correct although I'm sure the method can be improved. The bugs are little things like the way the cells are highlighted when you're jumping around the grid.

csmith
11-09-2006, 11:27 PM
Thanks John, Everything that I tried is working fine. Nice job

highnote
11-09-2006, 11:35 PM
Thanks, check your rr mailbox to see the new file I sent you.

Thanks for your help.

DJofSD
11-10-2006, 12:20 AM
If MSflxgrd.ocx is not registered (missing), use this link for a D/L -- follow the instructions. (http://members.aol.com/rabbitcrackers/bugs.htm)

highnote
11-10-2006, 12:26 AM
If MSflxgrd.ocx is not registered (missing), use this link for a D/L -- follow the instructions. (http://members.aol.com/rabbitcrackers/bugs.htm)


I think if I make a setup file, it will include the missing ocx file. When you run the setup it will place the setup file in the correct directory. I was hoping to avoid having to make a setup file. Looks like I'm going to have to. Or maybe I can upload the ocx?

Not sure. The setup file tends to big and bloated - like a lot of Microsoft stuff.

highnote
11-10-2006, 12:35 AM
Try this link:

http://www.hypernormal.com/html/PA/

you can download the file from here. This saves space on PA's server, too. :)

You'll need to unzip it and then run the setup program.

K9Pup
11-10-2006, 07:56 AM
Also, if you use 2 factors, say a SR and a Pace number for a runner, I guess you would have to do 2 runs for each horse and combine the 2 outputs and avg. them or weight them accordingly? More of a question for somebody that understands MC I guess. The ability to print the screen would be nice, at least I think so. Again, nice work. :jump:

The MC SIM process has no idea WHAT the data really is. It just requires a base number and a SD to generate the trials. If you have 2 "factors" you want to use then you CAN just add them together first and then input the total. I think it would be best if both factors are scaled the same. If you SR goes from 90-100 but your Pace number goes from 1-10 and you add them together then the SR will make up more of the total than the pace. Otherwise you might give more weight to one factor over the other. But again, the MC SIM process doesn't care, you might, depending on the results.

csmith
11-10-2006, 10:01 AM
Thanks, check your rr mailbox to see the new file I sent you.

Thanks for your help.


Thanks John,

Everything is working fine. Thank you very much for your hard work. I really do appreciate it


Cliff

kroebuck67
11-10-2006, 12:59 PM
John, the pgm doesn't appear to want to run trials on entries with a SD less than 1.... is this a legitimate prob or am I doing something wrong?

robert99
11-10-2006, 01:17 PM
John, the pgm doesn't appear to want to run trials on entries with a SD less than 1.... is this a legitimate prob or am I doing something wrong?

In the earlier explanation a value of one or higher was added/ subtracted to the original rating in each trial. So perhaps an "SD" of less than one won't go anywhere.

Is SD actually the +/- range of rating values and not the mathematical type of SD based on square root of variance?

kroebuck67
11-10-2006, 01:32 PM
They were provided by Acess StDev command, so my guess is they were of the mathematical variety... I admitted in an earlier post on this thread... I'm not a math guy. :blush:

Thanks, Robert... I think you've cleared up the way I need to be projecting my numbers.

kroebuck67
11-10-2006, 01:38 PM
I'm pretty sure you've been made aware, but just in case....

You can't enter more than 6 runners... If you key "7" or "8", etc., a "6" appears.

Also, if you key less than 4 runners, the window doesn't expand for viewing correctly.

We all appreciate your generosity on this, John.... keep up the good work!

highnote
11-10-2006, 07:16 PM
In the earlier explanation a value of one or higher was added/ subtracted to the original rating in each trial. So perhaps an "SD" of less than one won't go anywhere.

Correct. If the SD is too small it won't affect the rating. So the horse with the highest rating essentially has a probability of 1 of winning.

Is SD actually the +/- range of rating values and not the mathematical type of SD based on square root of variance?

Correct. This is really not a sophisticated Monte Carlo simulator. Unintentionally, I may have misled you. It's more of a Monte Carlo / Bernoulli trial simulator where the horse with the highest rating on any given trial is tallied. At the end of the simulation the winning tallies of each horse are divided by the number of trials.

If your number of trials are too small, a horse might not have won enough races and his odds could be way off. Unless of course, he is a true long, longshot. Trial and error is required to figure out what works.

I've been trying various SDs in my software and comparing my simulator probabilities with a friends stronger Monte Carlo simulator. I have found that if I triple my SD then I get within 2/100ths of his probabilities.

So if my ratings for 5 horses are 99, 98, 97, 96 and 95 with a SD of 20 and 10,000 trials, his program gives probs of:
.2298
.2141
.1992
.1851
.1718

I can approximate his good probabilities with my software by tripling my SD from 20 to 60 and also using 10,000 trials:
.242
.22
.197
.186
.1565

His program uses calculus and derivatives and some kind of numerical integration. I'm not knowledgeable enough to program it.

But my program seems to do a good enough job for horse racing. It's hard to know what the exact probabilities are anyway. So at least my method systematizes (is that a word?) the odds making process. With practice, the user should be able to figure out how to make a good oddsline.

Here is another sample test...

My friends software used a SD of 20 and 10,000 trials

Ratings
51
53
55
59
61
65

Probs
.0948
.1120
.1316
.1792
.2075
.2748

My software using SD 60 and only 2000 trials and the same ratings:

Probs
.072
.1007
.1096
.1871
.2321
.302

I am confident enough in these approximations to use this software myself.

So my recommendation is to use an SD 3 times as large as you think it should be.

PS

I also did the test with ratings in the 30s and using an SD of 5 on his software and an SD of 15 on mine and was within 3 percentage points.

So larger ratings may be more forgiving or if you want to use smaller ratings then bump up the SD by 3.3 or maybe 3.5 times.

Sorry I can't make it better. But the price is right -- I can guarantee that!

PPS

Even if I wrote a full-blown super sophisticated Monte Carlo simulator, you'd still have to figure out on your own if your probabilities were any good.

highnote
11-10-2006, 08:19 PM
I've uploaded a new MC Sim. It now supports a lot of horses -- as many as will fit on your screen in one column -- up to 100.

You can download from the URL that I posted in a previous thread.

While you're looking for that URL, please take time to read the previous postings on how to use this software. PLEASE -- NO PRIVATE MESSAGES. I don't have time to answer them. Ask your questions in this thread. If no one can answer them, then I'll give it a shot.

This is "FREE" software. No warranties. Because it is free, I can offer little or no support. Just about everything you need to know can be found in this thread.

This "FREE" software will only be free until I take it down off of my website. I'm just about out of space.

I may start charging for it. I'm posting it for free because of all the help the beta testers gave.

This software is not as sophisticated as I'd like, but it is better than nothing. Use at risk of losing your bankroll. NEVER OVERBET!!!!!

Good luck and good betting.

John

highnote
11-11-2006, 03:16 AM
I uploaded a new version to my website. It is a little more accurate and a little more like real life.

On any given trial the SD of a performance will be within 1 SD from the mean 68% of the time, 2 SD from the mean 95% of the time, 3 SD from the mean 99.7% of the time or 4 SD from the mean 100% of the time. Before I had every trial within 1 SD.

So now, my probabilities are within 4 one thousandths of my friends more sophisticated monte carlo software. His software does 10,000 simulations in less than a second. Since I use a brute force method, mine is a lot slower, but the results are nearly identical and certainly close enough for betting horses. I mean really, is your rating system accurate enough that a horse you give a .2357 probability of winning will actually win more than a horse you give a .2368 probability?

I tested my software using ratings in the normal range of Beyer figures. If your ratings are larger than this, I don't know how well it will work. Should be OK, though.

Good luck!

John

PS

This software can be downloaded for about one week from my website. After that I will probably put it up for sale on my website.

Any donations by beta testers will be put to good use! ;)

robert99
11-11-2006, 08:41 AM
Correct. If the SD is too small it won't affect the rating. So the horse with the highest rating essentially has a probability of 1 of winning.



Correct. This is really not a sophisticated Monte Carlo simulator. Unintentionally, I may have misled you. It's more of a Monte Carlo / Bernoulli trial simulator where the horse with the highest rating on any given trial is tallied. At the end of the simulation the winning tallies of each horse are divided by the number of trials.

If your number of trials are too small, a horse might not have won enough races and his odds could be way off. Unless of course, he is a true long, longshot. Trial and error is required to figure out what works.

I've been trying various SDs in my software and comparing my simulator probabilities with a friends stronger Monte Carlo simulator. I have found that if I triple my SD then I get within 2/100ths of his probabilities.

So if my ratings for 5 horses are 99, 98, 97, 96 and 95 with a SD of 20 and 10,000 trials, his program gives probs of:
.2298
.2141
.1992
.1851
.1718

I can approximate his good probabilities with my software by tripling my SD from 20 to 60 and also using 10,000 trials:
.242
.22
.197
.186
.1565

His program uses calculus and derivatives and some kind of numerical integration. I'm not knowledgeable enough to program it.

But my program seems to do a good enough job for horse racing. It's hard to know what the exact probabilities are anyway. So at least my method systematizes (is that a word?) the odds making process. With practice, the user should be able to figure out how to make a good oddsline.

Here is another sample test...

My friends software used a SD of 20 and 10,000 trials

Ratings
51
53
55
59
61
65

Probs
.0948
.1120
.1316
.1792
.2075
.2748

My software using SD 60 and only 2000 trials and the same ratings:

Probs
.072
.1007
.1096
.1871
.2321
.302

I am confident enough in these approximations to use this software myself.

So my recommendation is to use an SD 3 times as large as you think it should be.

PS

I also did the test with ratings in the 30s and using an SD of 5 on his software and an SD of 15 on mine and was within 3 percentage points.

So larger ratings may be more forgiving or if you want to use smaller ratings then bump up the SD by 3.3 or maybe 3.5 times.

Sorry I can't make it better. But the price is right -- I can guarantee that!

PPS

Even if I wrote a full-blown super sophisticated Monte Carlo simulator, you'd still have to figure out on your own if your probabilities were any good.

S,

Thanks for reply and further info.
I like the way you are changing ratings by units as this seems to be how horse's performance changes and may in fact be more "accurate" for horses than your friend's software. We will have to calibrate our own way but you have made it so easy to do the harder part. :jump:

Sabe
11-12-2006, 06:01 PM
swetyejohn,
Excellent program! Your efforts are much appreciated!! I'm sure the program will be an asset to many as there have been several requests for help with regards to making a "morning line" and this obviously applies to any system that generates figures or ratings.
Sabe

highnote
11-13-2006, 04:59 PM
Here is a question that was email to me. Hopefully, the answer will help someone else with the same question.

1. why would you need to enter more than 12 horses to your # of runners?? and 2. the SD isn't that a made up number ??? how do you use it ???

1. Some races, like the KY Derby, have more than 12 runners.

2. For Beyer figures I use an SD of 20. You need to do research on your own to find out what the SD should be. Maybe someone here can explain how to do that. EXCEL has that feature, I believe.

3. I use the same SD for all horses. Even a slightly higher or lower SD can have a major impact on the odds.

John

PlanB
11-13-2006, 07:30 PM
YES, A very fine proggy.

highnote
11-13-2006, 11:59 PM
YES, A very fine proggy.


THX!

highnote
11-18-2006, 11:56 PM
Anyone getting any experience using the oddsline software?

cccorona
11-19-2006, 05:41 PM
Hey John - I have been messing around with the odds line and with some good results. I have been using the Bris Prime Power numbers to generate one line of
odds. The SD I use is 40. I then use the Bris Speed Rating, looking at the last
three lines for each horse ( dirt and distance sensitive) and only if within 4 points of the par number supplied by Bris. The SD I use is 30. I then blend the
two odds lines to come up with my contender list.
I throw out any horse with a blended odds line over 6-1. I bet any overlay for the top two rated horses (lowest odds) and if no overlay found then I bet the
top rated horse forward in the pick 3's or 4's to all other horses 6-1 or under.
I also go forward with daily doubles to complement the 3's and 4's.
Thanks for all the work and time you spent developing the program!
CC

highnote
11-19-2006, 05:58 PM
Hey John - I have been messing around with the odds line and with some good results. I have been using the Bris Prime Power numbers to generate one line of
odds. The SD I use is 40. I then use the Bris Speed Rating, looking at the last
three lines for each horse ( dirt and distance sensitive) and only if within 4 points of the par number supplied by Bris. The SD I use is 30. I then blend the
two odds lines to come up with my contender list.
I throw out any horse with a blended odds line over 6-1. I bet any overlay for the top two rated horses (lowest odds) and if no overlay found then I bet the
top rated horse forward in the pick 3's or 4's to all other horses 6-1 or under.
I also go forward with daily doubles to complement the 3's and 4's.
Thanks for all the work and time you spent developing the program!
CC

Cool idea. What's interesting is that you're probably doing something in a way that no one else is, so hopefully you should get good results.

Handiman
11-19-2006, 08:03 PM
As I posted earlier, I found your idea on making an odds line interesting. So I did a little research on the MC sim and then adapted your approach to my personal program.
I'm doing Mountaineer right now. I'm betting the overlays in my top 4. There was no bet in the first and then I hit the 2nd and just hit an $18 winner in the 3rd.

I'll be interested in seeing how this works out.

Handi:jump:

highnote
11-19-2006, 08:33 PM
So I did a little research on the MC sim and then adapted your approach to my personal program.


Just curious... how did you incorporate the approach into your personal program? Do you mean you have some number that you use in my program? Or did you use the MC concept and write code for your personal program?

Handiman
11-19-2006, 08:53 PM
I have my own program that gives each horse a rating. So I went ahead and wrote more code to do the MC sim and added it to my program, so it would give me odds. I am now running at 5,000 iterations.


No bet for MNR 4th and missed the 5th. 6th coming up next.

Hope that answers your question.

Handi

highnote
11-19-2006, 08:56 PM
Great. Good luck! Hope it works!!
:ThmbUp:

Handiman
11-19-2006, 10:07 PM
Thanks. No bet in the 6th, Hit a small show bet in 7th, then just hit winner in the 8th. This is only one day. One day no make a career for sure. But with this new twist, maybe I'll become a winning player.


Thanks for getting the ole juices running and inspire me to do more with my program.


From one Kool guy to another Kool guy...:)

Handi

Handiman
11-19-2006, 10:41 PM
Skipped the 9th and skipping the 10th. Overall good day for me. I'll post some more results as time goes by.


Handi

nomadpat
11-20-2006, 12:25 AM
Hey John - I have been messing around with the odds line and with some good results. I have been using the Bris Prime Power numbers to generate one line of
odds. The SD I use is 40. I then use the Bris Speed Rating, looking at the last
three lines for each horse ( dirt and distance sensitive) and only if within 4 points of the par number supplied by Bris. The SD I use is 30. I then blend the
two odds lines to come up with my contender list.
I throw out any horse with a blended odds line over 6-1. I bet any overlay for the top two rated horses (lowest odds) and if no overlay found then I bet the
top rated horse forward in the pick 3's or 4's to all other horses 6-1 or under.
I also go forward with daily doubles to complement the 3's and 4's.
Thanks for all the work and time you spent developing the program!
CC

Hi CC,

Could you elaborate on how you "blend" the two lines? Is it just a mathematical relationship between the two lines?
Your process sounds very intriguing.

Thanks!

K9Pup
11-20-2006, 09:04 AM
I have my own program that gives each horse a rating. So I went ahead and wrote more code to do the MC sim and added it to my program, so it would give me odds. I am now running at 5,000 iterations.


No bet for MNR 4th and missed the 5th. 6th coming up next.

Hope that answers your question.

Handi

What are you using for the SD in your SIM process? Do you give each horse a rating on each past race and then calculate the SD from that?

andicap
11-20-2006, 09:44 AM
OK, forgive a basic question from an idiot math person. But if you want to do a +-/10 pts for your figures, that's an SD of 20?

Worth a look with CJ's figures.

Thanks for sharing John!!

highnote
11-20-2006, 10:13 AM
Yes +/-10 would be an SD of 20 -- at least as far as I know. I'm not exactly a stats person. It's been almost 20 years since I studied it. I have to refer to the book "Statistics for Utterly Confused" now whenever I have a question.

cccorona
11-20-2006, 11:08 AM
Hi CC,

Could you elaborate on how you "blend" the two lines? Is it just a mathematical relationship between the two lines?
Your process sounds very intriguing.

Thanks!


I add the two odds line together and divide by 2. I then round down to the nearest odd. Below is the 7th race from Hollywood last Thursday.


Race Number = 7 Speed Rating par 96
Pgm# Ratings StdDev Prob Odds
1 92 30 .177371 4.64
2 98 30 .248849 3.02
6 96 30 .2156 3.64
7 92 30 .168417 4.94
8 93 30 .190195 4.26

Race Number = 7 Prime Power
Pgm# Ratings StdDev Prob Odds Blended Odds
1 132 40 .113711 7.79 6-1
2 144.5 40 .20194 3.95 4-1
3 128.5 40 .095448 9.48
4 136 40 .140927 6.1
5 124 40 .076815 12.02
6 134.5 40 .133453 6.49 5-1
7 134 40 .129291 6.73 9/2
8 131 40 .1089 8.18 7-1


The 6 horse won and paid $16.80
Hope that helps!
CC

K9Pup
11-20-2006, 03:20 PM
OK, forgive a basic question from an idiot math person. But if you want to do a +-/10 pts for your figures, that's an SD of 20?

Worth a look with CJ's figures.

Thanks for sharing John!!
Yes +/-10 would be an SD of 20 -- at least as far as I know. I'm not exactly a stats person. It's been almost 20 years since I studied it. I have to refer to the book "Statistics for Utterly Confused" now whenever I have a question.

It really depends on what formula is used for the "normal" distribution in the MC SIM. In general about 70% of the values generated by the MC SIM process should be within the range of (base - 1SD) to (base + 1SD). The rest of the values should fall within +/- 2SDs.

If you captured the values generated by the MC SIM process and did a histogram chart of them you should see a bell curve. The value occuring most frequently would be the base number (top of the bell).

If you want MOST of the generated values to be +/- 10 of the base then you would use a SD of 10.

formula_2002
11-20-2006, 05:29 PM
Here's a new version that allows you to enter your program numbers.

PA, Do you want to delete the old one to save space?
Very nice product that clearly demonstrates the need for large sample sizes and incremental odds analysis.
For ratings, just enter probabilities percentages.
Vary the number of trials and standard deviation.
I used .33,.33 and .33 and watch the variation in odds..

Handiman
11-20-2006, 11:18 PM
Hey Swetty,


I played Mountaineer last night. 1st time I used my program with the MC sim I added in based on your inspiration. I looked for one horse from my top 4 rated horses that was an overlay. Now I know it was just one day, but the results were pretty cool.

10 races
bet 7 skipped 3 due to no overlay

show bets....hit 5 out of 7 for a return of +24%
win bets.......hit 3 out of 7 for a return of + 157% ($14 out $36 back)..based on $2 bet.

I will be doing some more races and will post my results....good or bad.

Handi :jump:

highnote
11-20-2006, 11:32 PM
show bets....hit 5 out of 7 for a return of +24%
win bets.......hit 3 out of 7 for a return of + 157% ($14 out $36 back)..based on $2 bet.

I will be doing some more races and will post my results....good or bad.

Handi :jump:

Awesome!!! I'd love to see your results as they come in. Hopefully, it's not just beginner's luck. Not that you're a beginner, but that you're just beginning to use the MC software.

I have a theory that goes -- anytime you try something new in gambling you usually win. Then you think you have a good system. Then you lose money and try something else. That has been my experience. I call it the "Beginner's Luck Theory". It rarely lets me down. :D

yak merchant
11-26-2006, 05:11 AM
Are you using a normally distributed random number?

highnote
11-26-2006, 11:54 AM
Are you using a normally distributed random number?

Yes. To the best of my knowledge. This may not be the way the number that you use is distributed, but this is the way I wrote the code. I thought about writing code to have the software distribute the numbers how they are actually distributed, but don't have time right now.

yak merchant
11-26-2006, 04:41 PM
I thought about writing code to have the software distribute the numbers how they are actually distributed, but don't have time right now.

I don't exactly know what you mean by this, but I have the code to generate a random number that follows the normal distribution. I believe it uses the Box-Muller Transform method. It's pretty simple, but I found that it's an integral part of doing MC sims properly. If not your tails will be way too fat. Let me know if you want a copy of it.

Regards,

YM

K9Pup
11-26-2006, 07:55 PM
Let me know if you want a copy of it.

Regards,

YM

I would like to see it.

Thanks!!

Handiman
11-26-2006, 09:27 PM
Swetty,


Here's Aquaduct for Friday...

1st skip
2nd 5.30
3rd skip
4th missed
5th skip
6th skip
7th two overlays..bet both 5 & 8 9.30...(should have bet exacta...pd 75.00
8th 10.20
9th missed

$12.00 out...$24.80 back

Have a bad cold so not doing much. But will continue slowly.

Handi

Handiman
11-26-2006, 11:27 PM
Swetty,

Just finished mountaineer, Here is results...for win bets only

1. missed
2. skip
3. skip
4. missed
5. skip
6. missed
7. skip
8. 31.20
9. missed
10. missed

Very ugly night. I had the winner in my top 2 5 out of the 10 races tonight, but the MC sim odds made them underlays. I made a profit but only by luck. I think the thing that this exercise has done for me, is to promote most of all, the value in skipping races.

Handi

highnote
11-27-2006, 12:07 AM
Very ugly night. I had the winner in my top 2 5 out of the 10 races tonight, but the MC sim odds made them underlays. I made a profit but only by luck. I think the thing that this exercise has done for me, is to promote most of all, the value in skipping races.

Handi

The key is to get the standard deviation right. Maybe your SD was too high giving all the horses too much of a chance. If the SD is too low the favs have too big of a chance and the longshots don't have enough of a chance.

highnote
11-27-2006, 12:10 AM
I don't exactly know what you mean by this, but I have the code to generate a random number that follows the normal distribution. I believe it uses the Box-Muller Transform method. It's pretty simple, but I found that it's an integral part of doing MC sims properly. If not your tails will be way too fat. Let me know if you want a copy of it.

Regards,

YM

Yak,
I simply meant that maybe a given person's numbers are skewed rather than normally distributed.

I would love to see your code. It's probably better than mine. Mine is ad hoc. Not even sure it is correct -- except that it matches very closely my friends MC which I know is correct. His is written in C and I can't decipher it. So I wrote mine in VB and kept fudging it until the two MCs gave nearly identical odds across different samples.

Even using my friend's better MC will not guarantee winners -- you know the old saying... "Garbage in. Garbage out." :D

John

Handiman
11-27-2006, 01:53 AM
Swetty,


I wasn't sure what to do with the SD. So for now, I figure the std Dev for each race based on variance if I remember right. I'm sure I'm not adhearing to correct statistics, but so far it's working for me, at least in the realm of returns. Also I don't use negatives, just positives in my numbers.

Handi

yak merchant
11-27-2006, 02:06 AM
SJ,

Below are two functions. The first is the one I use, where you pass in the Mean and the Stdev and it calculates the result for you and returns it. I have added a cap at 2.5 standard deviations for the upside (you can set this at what you want). Even though rare, events further than that into the tail on the upside don't really make sense to me in the horseracing application. The second one is just another version that is the Random Number generator by itself (mean 0, stdev 1). Let me know if you have any problems.


Regards,

YM


''-----------------------------------------------
''Random function1
''-------------------------------------------------


Public Function rndNormal(mean, stdev)
'The Polar Method to create Random standardized normal


'Insure at least one loop
L = 0

Do

'Step 1: Generate random numbers, U1 and U2
Randomize
U1 = Rnd
U2 = Rnd

'Step 2: Calculate V1, V2, and S
v1 = 2 * U1 - 1
v2 = 2 * U2 - 1
S = (v1 ^ 2) + (v2 ^ 2)

'Step 3: If S=>1 get new values for U1 and U2
If S < 1 Then L = 1

Loop Until L = 1

'Step 4: Calculate normal- could create 2
Z = (((-2 * Log(S)) / S) ^ (1 / 2)) * v1


''cap upside

If z > 2.5 Then
z = 2.5
End If

rndNormal = (Z * Stdev) + mean



End Function

''-----------------------------------------------
''Random function2
''-------------------------------------------------

Function NormRand() As Double
' NormRand returns a randomly distributed drawing from a
' standard normal distribution i.e. one with:
' Average = 0 and Standard Deviation = 1.0
Dim fac As Double, rsq As Double, v1 As Double, v2 As Double
Static flag As Boolean, gset As Double

' Each pass through the calculation of the routine produces
' two normally-distributed deviates, so we only need to do
' the calculations every other call. So we set the flag
' variable (to true) if gset contains a spare NormRand value.
If flag Then
NormRand = gset
' Force calculation next time.
flag = False
Else
' Don't have anything saved so need to find a pair of values
' First generate a co-ordinate pair within the unit circle:
Do
v1 = 2 * Rnd - 1#
v2 = 2 * Rnd - 1#
rsq = v1 * v1 + v2 * v2
Loop Until rsq <= 1#

' Do the Math:
fac = Sqr(-2# * Log(rsq) / rsq)

' Return one of the values and save the other (gset) for next time:
NormRand = v2 * fac
gset = v1 * fac
flag = True
End If

End Function

highnote
11-27-2006, 02:21 AM
By the way, I was at MNR Friday night.

Baird had a horse in one of the later races that went off at 16-1 and won -- it was number 4. I went to the paddock for every race. The 4 horse was coming off of a layoff and must have been bought by Baird in California -- I think this might have been it's first MNR start.

Anyway, I knew immediately it was a Baird horse when I saw it. He never grooms his horses. They always look scruffy. He keeps nearly 200 head so that accounts for the lack of grooming. The man is a racing machine.

His horse was really acting up in the paddock. He was either nervous coming off of a layoff, or really fit and ready to run or was on drugs. He looked scared to me. And the whites of his eyes also looked bloodshot. No other horse in the race was acting like him. And he was 20-1 morning line.

Anytime you can get 16-1 on a Baird horse you have to bet it. Did I bet it? No. I used it in the exotics. I should have had the exacta at least. I box/keyed some other horse on top of Baird's horse and the runner up, so I lost even though I had all the horses.

I did the same thing on that 40-1 shot. He looked great in the paddock, so I used him in the exotics, but didn't have him with the runner up.

I'm ahead lifetime at MNR, but lost Friday night. I had the winner in 4 of 6 races and still lost money. I played too many losing exotics and also had a favorite run out that I had a big show bet on.

Lots of fun though. MNR is my favorite track. Lots of value and a paddock handicapper has a big edge -- assuming he knows how to use the information! :D

highnote
12-04-2006, 02:30 AM
SJ,

Below are two functions. The first is the one I use, where you pass in the Mean and the Stdev and it calculates the result for you and returns it.


Yak,

Sorry I have been slow getting back to you. Been very busy at work.

I haven't looked at my code for awhile, but your code looks more sophisticated than mine.

I'll try to incorporate your code into some software and then compare my old software output against your code's output and against my friend's known to be correct software output. Should be interesting.

The results of my old code approximate my friend's. But I had to use a fudge factor to make them work. Mine are probably close enough for horse racing, but it never hurts to do things better.

Thanks for so kindly posting your code. Very impressive.

John

highnote
12-04-2006, 03:19 AM
Yak,

I incorporated your code into my software and compared your code, my old code and my friend's software's output.

Here are the results:

Data:

Means = 80, 81 and 82

SD = 5,5,5

YAK prob = .2688, .3719, .3996

SJ prob = .251, .325, .424

Friend prob = .252, .3279, .4199


This is very interesting. My friend is a world class statistician at a major university. He knows his math. He designed this for me with horse racing in mind and calibrated it to my various power ratings.

Unfortunately for me, he wrote it in C and I can't decipher it. I can call it from VB, so it is still useful.

However, I wanted something that would suit my needs even more, so I wrote a MC Sim that would approximate his output. I'm close -- within 2/1000 oftentimes and never so far away that it actually matters in horse racing.

Your code, which I also found a copy of on the net by the way, looks good, but seems to compress the extremes. I didn't limit the SD to 2.5. Mine allows for a little wider spread.

Which is better? Who the hell knows? All I can say is that they both look good. I could use either method. Having a one or two percent difference between methods does not seem like a big deal in a horse racing context.

Can anyone really develop a system that can distinguish between a 25% horse and a 27% horse? Maybe.

John

yak merchant
12-04-2006, 04:14 AM
SJ,

I'm no statistician, I definitely found the code on the internet, I just did it along time ago, when things were alot harder to find. As far as the results, How many iterations did you run? I'd have to look at his code and a graph of the outputs, to even have a clue. Due to the 82 horse winning more than my code, his distribution definitely looks to be leptokurtic, or if not then skewed to the downside. This makes logical sense in a horseracing application, as a horse often runs 3 sigmas to the downside, but rarely runs 3 sigmas to the upside. But when you say mine compresses the extremes, I don't know what you mean by compress but from the data my code has fatter tails (80 mean horse won the most) which means the extreme happened more often.

While the differences are small they will make a difference in the very long run, but you'll just have to test the different predictions against historical results to see which performs better. Either way both are 1000 times better than just using a random number between -1 and 1. Good luck and I'd be interested in seeing his function if he doesn't mind.

YM

highnote
12-04-2006, 11:08 AM
How many iterations did you run?

10,000 iterations. I forgot to put that in the specs.


But when you say mine compresses the extremes, I don't know what you mean by compress but from the data my code has fatter tails (80 mean horse won the most) which means the extreme happened more often.

I just meant that your longshot has a higher prob of winning than mine. And your favorite has less of a chance of winning than mine. Your odds at the extremes are not as high or low as mine. But this is a small sample. I don't know what would happen in the long run or with more horses.

Either way both are 1000 times better than just using a random number between -1 and 1

Definately.

Good luck and I'd be interested in seeing his function if he doesn't mind.

YM

His code looks an awfully lot like yours!


#include <math.h>
/* generate random standard normal deviates */
double rnorm(double mu, double s) /* random normal */
{ double x,y,z,randm(void);
do
{ x=randm()*2.0-1.0;
y=randm()*2.0-1.0;
z=x*x+y*y;
}
while(z>=1.);
z=x*sqrt(-2.0*log(z)/z);
return(z*s+mu);
}

yak merchant
12-06-2006, 12:24 AM
SJ,

Yeah same function as mine. Any differences in the long run would be due to 1 of 3 things. The way C and VB generate psuedo-random numbers Rndm() and Rnd() functions. I call the Randomize function every call to get the best psuedo number possible, I don't know how C handles this.

Or the fact he uses Void when calling Rndm(). I'm not 100% sure what this does, but I believe it excludes 1 and 0 from the allowable values it returns. Which I think VB does automatically.

Or three, some rounding differences in the math. I'm sure mine would be the one that is wrong as he declared all his variables as double and I didn't. Who knows what VB is doing with converting to Variant and back. You may want to declare all the variables in my code as Doubles before executing it, and see if that changes my output. Thanks for posting his code. Good luck with your project.

YM

BillW
12-06-2006, 01:03 AM
Or the fact he uses Void when calling Rndm(). I'm not 100% sure what this does, but I believe it excludes 1 and 0 from the allowable values it returns. Which I think VB does automatically.

YM

The void is at the declaration point and tells the compiler that the function being declared accepts an argument of type "void" i.e. none - any call to the function randm with a real argument would be considered a syntax error. This does not affect the return values of the function that is called below as "randm()"

DaveP
12-23-2006, 07:00 AM
I know this thread is ancient history, but as a new member I would just like to say what a great read it is.

I have written my own MCS in Excel and they are a built in part of my handicapping software, if I had come across this thread sooner I could have saved myself a lot of time.