We want to share an important update with our Betfair Community users.
Over the coming months, the Betfair Community platform will be winding down. The final active day for the platform will be December 21st. From December 22nd, users will no longer be able to access the platform.
Your discussions, insights, engagement, and, most importantly, feedback have helped shape the platform and guided innovation. Your feedback continues to be important to us, and we will continue to listen via our dedicated feedback channels, as well as through product testing and innovations.
To share your feedback and experience, visit: https://support.betfair.com/app/home
|
By:
normally this is a vba task, however I have found an easy way without using the vba of you want to avoid it.
basically you create a circular function in one of the cells, goto the settings tab and change the no of iterations to the number of simulations you want to do. how it works is that, if you rand in a cell, because its a volatile function everytime excel does an iteration it will create a new number in the cell with rand. the most important thing to remember if you monte carlo this way, is that excel does it calculations from left to right, then top to bottom. so its important you have the calculations on the spreadsheet in the rright order. |
|
By:
Betting quant, can you explain how that works?
I think this is definitely a VBA task. I'll get this done within the next month or so. I've used the following very crude method. Let's say that in cells A1 to A100 you have 100 random results. You want to generate and store/compare these results 10,000 times. If you have used the rand() functions the value changes every time you change something. 1) Record a macro with shortcut key ('g' for example) 2) copy column A 3) In column B do paste special -> values 4) Insert a column between A and C 5) stop recording start recording a new macro Press CTRL+g and keep them pressed. Stop recording. Assign a shortcut key. now you can quickly execute 1000s of simulation outcomes. It's still going to be woefully slow compared to doing this properly, but better than nothing. |
|
By:
I suppose it really depends on how complicated your data set is. The advantage VBA has is that it is completely automated and you need only record the results. However googling 'multiple monte carlo simulations in excel' generates quite a few useful pages that might be able to point you in the right direction (depending on what you're looking to do) if you wanted to avoid scripting the process. Feel free to email if you wanted any further help down the line.
|
|
By:
I actually did this (being of limited programming etc ability) by using the sheet as normal. It's kludgy, but so is everything I do.
Put your variables into columns/tables as usual, then have a series of columns for random numbers. Calculate one case and return the result in a final column. Copy/Paste this for 10000 lines, prepare for your computer to cry for a minute or two and then hit refresh :) (There's also an option that stops it refreshing every time you change one parameter, can't remember where that is offhand, but it's better to set to manual refresh or it gets a bit silly) After doing that, use the likes of countif to tabulate your results. |
|
By:
investor, heres monte carlo simulation without VBA to prove the mean of the random number generator in excel has a mean of 0.5
office button->excel options-> formulas: tick iterations and make it 16000 (this is the max you can do) then put these formulas in the spreadsheet in B5: =RAND()+B5-B5 in D5: =(D5+B5)*J5 in F5: =(F5+1)*J5 in H5: =D5/F5 in J1: either a 1 or a 0 B5 is the random number generator D5 totals up the results F5 counts the number of simulations H5 calculates the result J5 acts as a reset button. word of warning, if using this method, make sure you switch off or turn down the number of iterations when you reset the spreadsheet, or otherwise it will go through all the ierations again. obvious what i've got above is very simple, but the principles can be extended to more complicated models. |
|
By:
i know that Monte Carlo has been used for a long time in 3D rendering to create realistic lighting and it was one of the most advanced algorithms
|
|
By:
Monte Carlo or Bust? I think the latter...
|
|
By:
I do, i think, the same as Lori. But I find I need more than 10,000 lines to get consistent results.
Does anyone know if the Random number generator in Excel is actually truly 100% random? For some reason I have my doubts. |
|
By:
I've just returned to see all the replies.
I'm pleasantly surprised by the responses. There is something to play with here, thanks. |
|
By:
the silverback
I've noticed that in my Excel version (2003) a bug sometimes manifests itself with RAND(), it works most of the time, but every now and again it starts generating numbers on the low side, which a reboot of Excel fixes. I know this for certain because of my column of say 10,000 random numbers, the average should always be very close to 0.5. When the bug appears, the average drops significantly, sometimes well below 0.4 and remains there for every iteration until a restart of Excel. |
|
By:
I can see how using such simulations on events with pure odds makes sense, eg roulette or X games on here, but in sports betting ? Random ?
|
|
By:
Frog ~ good to see you back on an even keel (hope you like the nautical reference).
with reference to your question, the way to think about it is the outcome of say a football match is random weighted by the starting odds. i can go into more detail if you wish. |
|
By:
Tks loser.
Yes I would be interested to hear more about that theory. But not if you feel I'm asking for any secrets. |
|
By:
FINE AS FROG HAIR Joined: 12 Mar 07
Replies: 1146 02 Nov 10 16:41 I can see how using such simulations on events with pure odds makes sense, eg roulette or X games on here, but in sports betting ? Random ? Here are a couple of examples of how this could be useful. Example 1: Take your daily PnL figures, let's say there are 300. Assign each one a probability of 1/300. Then run simulations of what future returns could look like based on similar results. If your returns are growing along with your balance, you could take daily percentage gains instead of absolute returns. You could also adjust risk by increasing the value of your largest losses, and play around with it in other ways. It's not going to be a precise tool, but it will be better than nothing. Doing this could show the falsehood of the assumption many people have 'luck is not important in the long term for a successful gambler'. For some successful gamblers luck will be more important than others (this depends on volatility of returns). If over a lifetime you have 4 massive losses, your overall returns will be significantly worse than if you only have 3 massive losses, and this could be purely down to luck. Example 2: Take a large series of bets (let's say 10,000) that have been matched and settled. Using your PnL on these bets (ignoring commission and other charges) you can work out expected return (based on the assumption odds are fair) versus actual returns. This gives you your average edge per bet. You can then work out the range in which your returns could have fallen with confidence intervals etc. You need to factor in (negative) correlations, this is where it gets much more complicated. |
|
By:
no secret at all. as a relevant aside , are you familiar eith the idea of alternative histories ? Fooled by Randomness by Taleb discusses these . Monte Carlo simulations can be used to give you a large set of alternative histories. These are useful if you want to avoid deluding yourself with the results of a backtest. Irrespective of what actually happened historically, it may be interesting to see what COULD have happened .
Specifically , as far as this thread goes, the RAND function in excel generates a number between 0 and 1. If the starting odds of the home team are H, then one could say if the random number generated is less than 1/H then the result is a home win. Using this idea for several hundred matches, one can build up an alternative history to what actually happened. caveat : you buy into this idea or you don't . please ignore if you wish. |
|
By:
Sounds interesting.
I think I'll pass. I'm more of the type who concentrates on what did happen, rather than what didn't happen. Too many alternative theoretical " what if " scenarios generally create more confusion rather than clarity. Raise more doubt than confidence. Make for more missed opportunities than gained ones. But this is personal, I understand that perfectly. |
|
By:
no problem ~ although actually the very purpose of it is to raise confidence !.
|
|
By:
FAFH, you could do a test that tells you if your edge was 0%, what are the chances of generating these returns. This chance can never be 0 (although it can approach 0 over a long timeframe).
As far as I know this is the closest you can get to proving whether what you are doing is actually working based on the numbers or whether you are just lucky. |
|
By:
Investor
If you have a sound mathematical reason for doing whatever you do, the luck factor will diminish over time by natural causes. The important thing is not to overstake at the beginning and run out of capital before that happens. |
|
By:
agree 100% FAFH
the bigger the sample the less luck becomes a major factor, but these simulations can give you exactly that |
|
By:
And doing simulations will provide evidence that your mathematical reasoning is indeed sound.
|
|
By:
Investor
All the great mathematical minds in the past, before the computer, didn't need to do endless simulations to prove that their maths was sound. Not arguing here, just saying that it is not mandatory, but I most certainly agree it can't do any harm as long as you don't let it raise doubts, where there shouldn't be any. In my particular case, ignorance is best I'm sure my detractors will say. |
|
By:
FAFH is right, if you can prove what your doing is right mathematically, you dont need to do simulations. You only need to do simulations if you cant prove what your doing explicitly.
|
|
By:
And ALL the mathematical minds in the past combined could not work out that blackjack could be favourable to the player and create a strategy to exploit this before computers.
|
|
By:
It's not possible to prove mathematically that what you're doing is right without underlying assumptions.
Ever heard of LTCM? Your name suggests you should be familiar with this betting quant [;)] |
|
By:
The Investor Joined: 05 Jun 06
Replies: 3078 02 Nov 10 21:53 And ALL the mathematical minds in the past combined could not work out that blackjack could be favourable to the player and create a strategy to exploit this before computers. exactly investors, because BJ cant be solved explicitly. but say you had a biased coin and the odds of getting head was 0.6, you dont need simulations to tell you that a) you have an edge, b) what that edge is c) variance of that edge |
|
By:
Investor
I don't think computers were the genesis for the sound mathematical idea of how to exploit blackjack. They might help in the practical application of the idea I agree. I also agree that I find it totally amazing that nobody apparently even thoight of the idea until the last half of the 20 th century. Absolutely amazing. Btw wer're not arguing here about the usefulness of simulations. They have their place in the scheme of things, particularly now that they are relatively easy to do with modern computers. |
|
By:
If you had a biased coin where the chance of heads was 0.505, you could be behind after 10,000 tosses quite easily.
Doing a simulation will show you the chance of a certain outcome, and the probability of it being due to luck etc. You don't 'need' to do simulations, you can just work out the math, but simulation makes it easier to alter key variables and quickly see how it affects results. It's much more intuitive I find. If I have a coin, and I assume the chance of heads is 0.505, how many tosses do I have to do before I have proved whether this is correct? My view on this is that you simply can't prove it. You can just 'approach' certainty as you go from 10,000 to 100,000 to 1,000,000 to the point where it would be ridiculous to assume otherwise. You have to factor in that you'll probably never get the chance to place a million bets. If you can place various bets with returns that are negatively correlated you can smooth out returns, and proceed with a much higher degree of certainty. |
|
By:
FAFH, I agree that you don't strictly 'need' this to be successful, in the same way that I don't need to have the math skills of a PhD. If I did have that along with my current skills, I'm pretty sure I'd make more money though...
|
|
By:
betting_quant Joined: 08 Jun 10
Replies: 95 02 Nov 10 21:57 The Investor Joined: 05 Jun 06 Replies: 3078 02 Nov 10 21:53 And ALL the mathematical minds in the past combined could not work out that blackjack could be favourable to the player and create a strategy to exploit this before computers. exactly investors, because BJ cant be solved explicitly. but say you had a biased coin and the odds of getting head was 0.6, you dont need simulations to tell you that a) you have an edge, b) what that edge is c) variance of that edge How do you know the chance of getting heads is 0.6 though? In the real world playing with a real coin this would be an imperfect approximation. Monte Carlo Simulation would help you analyse scenario's, how will it affect my returns if the bias lower or higher etc. |
|
By:
By the way, it's my understanding that Blackjack has been solved explicitly. Is that not correct?
![]() |
|
By:
And thanks for the formulas betting quant.
|
|
By:
dunno about BJ, it's not my bag, last thing i knew about it was that thorpe had run millions of simulations on a university computer to work out the edge, but that was back in the 60's or 70's so wouldn't suprise me if someone had gone beyond that. wasn't there some MIT people who took thorpes work to another stage ?
regarding the biased coin example, you could do all need to algebraicly. eg. your expected returns would be np. and you would have a 95% chance of being between np +/- 1.96*sqrt(npq). you could simulate it, but you would only end up with the same answer. likewise you could work out the optimal staking, and you would find the optimal fraction to stake. However if you did mathematically you find the answer is the same as the kelly criterion when your edge is precisely known. did you manage to get my formulas working in excel ? |
|
By:
Isn't the biased coin a bad example. You know you have an edge there, so there is no need to do simulations. Simple maths shows you will make money over time. Similarly , if you know for certain that you have a betting edge in sports you don't need to run simulations. However, for mere mortals like me who only THINK we have an edge, then we can run simulations to see what confidence we can have in the perceived edge. I would be amazed if anyone has a mathematical formulation which they know for certain gives them an edge.
|
|
By:
Investor
Is simulation a form of mental masturbation perhaps ? Just joking. I also want to see if this phrase slips by the censor. |
|
By:
My God, it did.
|
|
By:
No I think it's a useful technique that you can use to distance yourself from what you are doing and make an attempt to see if what you are doing is really working as well as you think it is.
I did a coin toss simulation of 2,000 tosses. Probability heads 0.51, staking 2% of bankroll per bet with an initial starting capital of 100,000 units. After only 20 such simulations, it threw up the following two charts: http://oi54.tinypic.com/24dlkdf.jpg After 2,000 bets the guy with the returns in chart one might believe he has an amazing sustainable edge, whereas the guy with the returns in chart two might believe he has no edge and might as well give up. Ok in this case it's a coin toss and the probabilties are known, but you could treat the problem differently. If I showed you a couple of dozen of these charts, with no further information, how would you go about determining what the coin bias is? Working out what the probability is of achieving results by luck alone can be useful. |
|
By:
I agree with a lot you are saying.
But I factor the whole element of good luck out, or if you prefer the other way, I factor what I think will be the worst case bad luck into everything I do. |
|
By:
LOL, all this talk of "mental masturbation" and "tosses", I thought I'd logged on to the wrong forum for a moment
![]() Great link there Investor, which means a lot to me as I'm currently pondering whether or not to give up on one of my strategies that showed amazing results for 6 months, but has been totally flat for the last couple of months (approx 1000 bets per month). I guess I'd like to continue with it, but when you get nothing back it becomes soul destroying. |