Play the Monty Hall game
25 points by cyberia
25 points by cyberia
Since the idea is to see (experimentally) that switching doors has a more winning result, it might be nice to see an automatically calculated win percentage for each strategy (sticking vs switching)
(Btw, I quite like the ascii-art style)
it was so overwhelmingly aligned to the "switching door" hypothesis that I thought about asking to see some evidence on-screen that it wasn't rigged, but index.js does in fact contain two const prizeDoorIdx = Math.floor(Math.random() * 3); and const toOpenIdx = Math.floor(Math.random() * availableLosingDoors.length);
I did 100 runs, where I always started by clicking 1, and then switching. I ended up with 71 wins and 29 losses, so slightly above the expected 66-67 wins, but probably within the margin of error? Would need more data to see if it's biased or not.
A single trial with a 2/3 success chance has a variance of 2/3 × 1/3 = 2/9. A hundred such trials have a variance of 100 times that, i.e. 200/9. The standard deviation is the square root of that, or approximately 4.7.
Since 71 is less than a standard deviation away from 66.7, it's fully ordinary to get it. I usually start investigating single results like these only when the result is more than 1.645 standard deviations away. For ongoing processes, I'm often willing to accept deviations nearly three standard deviations away before suspecting error.
The key assumption is that Monty randomly decides whether to reveal a losing door. If Monty's choice depends on whether your first choice door is a winner, then the odds go out the window. If he shows another door iff your first choice is a winner, then switching will lose every time; if he shows another door iff your first choice is a loser, then switching will win every time.
Isn't the assumption that Monty always reveals a losing door? That's what's happens in this app and in the YouTube video I watched about it.
In an interview with The New York Times reporter John Tierney in 1991, Hall confirmed that when the host behaves strictly according to the problem description, it is advantageous for the trader to take the trade. Yet as host on the show, he could decide which trades to offer based on the traders' prior choices, which allowed him to play on them psychologically and control the number of wins.
https://en.wikipedia.org/wiki/Let%27s_Make_a_Deal#Monty_Hall_problem
Randomly choosing a winning door and requiring the contestant to chose one of the other doors would seem mean though :)