Show HN: The Monty Hall Problem in JavaScript(github.com)
github.com
Show HN: The Monty Hall Problem in JavaScript
https://github.com/victorqribeiro/montyhall
25 comments
Most people mistakenly think Monty chooses randomly. He doesn't.
It's a common error, but I don't know if it's most in my experience. I've seen plenty of people fully understand the problem (for some value of fully understand) and insist it doesn't matter whether or not you switch.
Some constructive feedback:
- The language randomly seems to switch to something else ("porta")
- Even if you're faintly familiar with the problem (like me), it's hard to gauge the actual goal of the game. For example I didn't recall if a door being empty is good or not.
- The coloring seems not very helpful. Red for the chosen door? Red is usually associated with something bad. And the colors for opened and still closed doors are not easily associated with their state. A simple bitmap or even a text would say much more than those colors.
- The statistics give a lot of numbers that aren't meaningful, and don't show the meaningful ones. In particular the absolute counts of how often was switched are hardly of importance. It's about the ratio of correct decisions - in particular that number should be split into switching and not switching decisions.
- The language randomly seems to switch to something else ("porta")
- Even if you're faintly familiar with the problem (like me), it's hard to gauge the actual goal of the game. For example I didn't recall if a door being empty is good or not.
- The coloring seems not very helpful. Red for the chosen door? Red is usually associated with something bad. And the colors for opened and still closed doors are not easily associated with their state. A simple bitmap or even a text would say much more than those colors.
- The statistics give a lot of numbers that aren't meaningful, and don't show the meaningful ones. In particular the absolute counts of how often was switched are hardly of importance. It's about the ratio of correct decisions - in particular that number should be split into switching and not switching decisions.
Ah, the good ol' Monty Hall problem...this problem (and .999...=1) have caused a ton of arguments between me and my not-quite-as-mathematical friends.
I guess the fact that it's statically better to switch is definitely a tough pill to swallow.
I guess the fact that it's statically better to switch is definitely a tough pill to swallow.
I remember reading this in Parade Magazine when Marilyn Vos Savant published her column. And then was completely blown away by the landslide of scathing letters written by adult professors at colleges belittling her for being so dumb. And they were wrong. Truly amazing demonstration of how bias (and the limbic system) work against rational thought.
Here is a link with some hilarious quotes from livid professors saying dumb shit:
https://priceonomics.com/the-time-everyone-corrected-the-wor...
Here is a link with some hilarious quotes from livid professors saying dumb shit:
https://priceonomics.com/the-time-everyone-corrected-the-wor...
This letter explains why we are in trouble:
You made a mistake, but look at the positive side.
If all those Ph.D.’s were wrong, the country would
be in some very serious trouble.
Everett Harman, Ph.D.
U.S. Army Research Instituteyeas, I wrote this code at least 10 years ago because I didn't believed statistics. I had to see for my self. It was a great exercise for both areas, code and probability.
When I got my statistics degree, a significant amount of time was spent in early classes demonstrating how non-intuitive statistical thinking can be. This, of course, is probably the most memorable example. Another fun one was a TED talk about Peter Donnelly on how juries get fooled that included a bunch of similar examples: https://www.ted.com/talks/peter_donnelly_how_juries_are_fool...
well, I made this experiment cause I didn't believed that you would have more chance switching doors. Couldn't wrap my head around the idea...
Totally! Simulation is a great way of learning this stuff. I spent a lot of time in R doing similar things over the years.
The Monty Hall problem supposedly even confused Paul Erdos (famous mathematician) who even rejected it after given a statistical proof.
He didn't accept the answer until stepping through a computer simulation so if it seems unintuitive, you're in good company. This problem is, in lore, claimed to trip up more nobel laureates then most problems because it's so counter intuitive to not notice the conditional probability and injected information from Monty.
He didn't accept the answer until stepping through a computer simulation so if it seems unintuitive, you're in good company. This problem is, in lore, claimed to trip up more nobel laureates then most problems because it's so counter intuitive to not notice the conditional probability and injected information from Monty.
that's really interesting
Try increasing the number of doors and your brain will (slowly) accept it. "One million doors" as described in another comment [1] is a good way to visualise it.
[1] https://news.ycombinator.com/item?id=23161993
[1] https://news.ycombinator.com/item?id=23161993
More information about the project here https://github.com/victorqribeiro/montyhall
[deleted]
I've won 100% of the time by switching and then not switching doors, surely that can't be right?
Same by not switching I've had 100% success with like 20 rounds.
Buy a lottery ticket.
how many times did you play?
I played ~20 times, and won ~2/3s of the time as expected.
Typo: Times you didn't swicht doors: 2
Start with one million doors.
Choose one.
Now have Monty open 999,998 of them.
Do you switch doors?
I believe it works because the chooser is forced to reckon with the 1 in a million chance that they chose the correct door. Additionally, it becomes clear that Monty actually fed the chooser new information by opening 999,998 doors.
It may not take the first time, but given a few rounds of the million door challenge both truths should sink in for the chooser.
Perhaps it would help to have a Javascript version that starts with a sufficiently large number of doors the first round, then cuts that in half each round until you get down to 3. The odds of winning decrease each time but the principle should still hold. (Although I can imagine some people getting back down to three doors and suddenly reverting back to their previously held intuition...)