Or, here's a more scientific way of showing it. https://gist.github.com/4349974
% of time door change resulted in a win: 33%
% of time first choice resulted in a win: 17%
% of time the player didnt wint at all: 50%
Those are strange numbers though. The code is doing exactly what it's supposed to, but it's not really doing something terribly useful. Since it's randomly determining whether you switch or stay, the output is misleading. A better way would have run X iterations in which the player always switches and X iterations in which the player always stays.
If you always stay, you will win 33% of the time. If you always switch, you will win 66% of the time. Obviously, if you stay half the time and switch half the time, you'll win about half the time. Just want to make it clear that this doesn't mean that your odds are even between the two choices. It's just that the data output is presented strangely. At no point are you "odds of winning" a round of this game 50%.
Leave it to you to misinterpret completely valid numbers.
I'm not misinterpreting the numbers. And they are "valid" in that they generate exactly what the script intends. My point is that what the script is doing isn't really what most people want to know when running it. See. I read the script and know exactly what it's doing. It runs a million iterations. Each time through it randomly assigns the prize to the door, randomly determines your starting pick, excludes the first non prize containing door not picked, and then randomly picks between the remaining two doors.
It's giving you the breakdown of what happens if you change your pick half the time and don't change your pick the other half. Which is *not* what you just wrote:
If you pick the first door and never change your mind, your odds of winning are 17%.
If you pick the first door and change your mind, your odds of winning double (~33%).
See how you are misinterpreting the data? The script does not tell you your odds of winning based on a given selection. It tells you how often out of a set in which you randomly change or don't change your mind various outcomes will occur. That is not remotely the same.
If you change your mind, you will win 66% of the time. If you don't change you mind, you will win 33% of the time. Those are your "odds of winning".
The fact that you misunderstood the results is because of precisely that poor output I talked about. I saw it, you didn't.
In either single case, your odds of not winning at all are at least 66% (83% if you pick door 1 and never change).
This is completely wrong. You've failed to understand what the data means. Seriously. Go back. Look at what the script is doing. And then think about it for about an hour or so. It might just come to you what you're doing wrong here.
The winning scenarios are mutually exclusive, since one cannot win by sticking with their original pick AND changing their pick. The 50% non-winning attempts is an artifact of the test, and does not imply that your actual odds of winning are 50%. The point of the test is to illustrate that your chances of winning do in fact double by changing your pick when given the opportunity.
This part you got right, which is why I'm scratching my head that you don't understand what's wrong with the first part. Since the test data basically includes half cases where you change your pick, and half where you don't. The actual odds on each pick
are twice as high as those presented in the output (which is what caught my eye as being odd about it). You're correct that the point of this script is to show that your odds double if you switch versus if you stay, but the way the output is formatted makes it seem like the base odds aren't nearly as good as they actually are.
A better way to have tested this (and how I would have written the script) would be to run a large sample of tests in which the initial pick and placement of the prize are random each round and the script always change your pick, and a second set where you always keep your pick. Output the win percentage for each of those two and you'll get 66% and 33% respectively. The third line of output is completely meaningless and should not even be there. What it tells us isn't relevant outside of the methodology of the test itself.
Your overall odds of winning if you do this many times and change half the time and don't change half the time
is 50%. Your overall odds of losing therefore are also 50%. But this is meaningless because the question isn't "what are my odds if I do this a million times and randomly decide to change or not change my initial pick?". The question is "what are my odds in this round, right now, if I change my pick versus if I don't?".