The “Monty Hall Problem” an example of counter-intuitive

So wound up down the rabbit hole reading a chatGPT article that said chatGPT got the “dumb monty hall” problem wrong…

https://medium.com/@colin.fraser/chatgpt-automatic-expensive-bs-at-scale-a113692b13d5

“ChatGPT: Automatic expensive BS at scale”

Which is a good article…

So had a quick read about the monty hall problem, where they “The Cleverest woman in the world LOL” say you should always change from your initial selection, and I was like, no clucking way, the odds have just gone from 1 in 3 to 1 in 2, so you have no better probability by switching.

So, after correcting a silly bug in my prog. I have to admit seems cleverest woman in the world was right, it is 33 to 66 or best option according to odds (not luck) to switch to the remaining selection. (what I proved was a predilection to accept the result I was looking for and not rigorously checking my initial program was right LOL)

https://ima.org.uk/4552/dont-switch-mathematicians-answer-monty-hall-problem-wrong/

‘Suppose you’re on a game show, and you’re given the choice of three doors: behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the other doors, opens another door, say No. 3, which has a goat. He then says to you, ”Do you want to pick door No. 2?”’ Is it to your advantage to take the switch?’

Vos Savant wrote a column called ‘Ask Marilyn’ in the popular magazine Parade, in which she responded to readers’ questions. According to the Guinness Book of Records, at the time she was the woman with the highest IQ in the world.

Vos Savant responded to Whitaker in her column of 9 September 1990: she said you should switch and that you double your chances of winning if you do.

My python program proves it is 33/66 so counter-intuitively better to switch. (Some problem with it not displaying like it looks like while editing in this wordpress theme, perhaps the upgrades to the free theme deliberately made it worse????)

#!/usr/bin/env python3
# test the monty hall problem
# PWR 2023
# 3 slots, 1 with car, two with goats, selected by random
# choose 1 you think has the car in it
# rule out one of the unselected two with a goat leaving two slots
# my_choice and other_choice then add results to totaliser

import secrets
numtests = 100000
slots = 3
goat = 0
car = 1
other_choice = 0
initial_choice_car = 0
other_choice_car = 0

# use random to select the one with the car, other two get goats

round_vals = [0,0,0]

for thisround in range(numtests) :
    # fill array with goats and car
    car_slot = secrets.randbelow(slots)
    for this_slot in range(slots) :
        round_vals[this_slot] = car if (this_slot == car_slot) else goat
    # make choice
    my_choice = secrets.randbelow(slots)
    # determine remaining slot after eliminating a goat
    # this method always selects last door with goat
    # if it contains a goat, which might be a tell in real world if you
    # had analysed show enough, but does not affect statistics
    # fast exits if one of the remaining slots is a car as that is always
    # the other choice slot
    # for poker face need to not fast exit and random select the opened door
    # if the two remaining options are goats

    for this_slot in range(slots) :
        if this_slot != my_choice :
            # if it's a car than thats the other choice
            if round_vals[this_slot] == car :
                other_choice = this_slot
                break
            else :
                other_choice = this_slot


    print(thisround,round_vals,round_vals[my_choice],round_vals[other_choice])
    initial_choice_car += round_vals[my_choice]
    other_choice_car += round_vals[other_choice]

print(initial_choice_car,other_choice_car)

Leave a Reply