Something about probablility

This is a discussion on Something about probablility within the A Brief History of Cprogramming.com forums, part of the Community Boards category; now that we resolve this, let's try something more challenging: 1) there are now five doors with two prices 2) ...

  1. #76
    Registered User
    Join Date
    Mar 2008
    Location
    vancouver bc
    Posts
    28
    now that we resolve this, let's try something more challenging:

    1) there are now five doors with two prices
    2) the player select one door, but do not open,
    3) the host opens the door with a price behind it
    4) the player now choose to stay or open one of the remaining door

    let's work out this one mentally first, with predicate logic and probability, before attacking it with brute force algorithm.

    --TING

  2. #77
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    I'd keep it. The money's right there.

  3. #78
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,522
    I believe the odds are 4 : 1 that you don't get a prize. This degrades into the Monty Hall problem, depending on how the game operates and what the host knows. I really don't see a benefit in switching either, in this case. The odds seem overwhelming even if we do get a peek behind another door.

  4. #79
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by ting View Post
    now that we resolve this, let's try something more challenging:

    1) there are now five doors with two prices
    2) the player select one door, but do not open,
    3) the host opens the door with a price behind it
    4) the player now choose to stay or open one of the remaining door

    let's work out this one mentally first, with predicate logic and probability, before attacking it with brute force algorithm.

    --TING
    In the 40% chance that you have a good door, you must lose when you switch. In the 60% chance that you have a bad door, you now have a 1-in-3 chance of finding a good door on a switch -- but you don't lose anything if you don't. So it would appear that switching is a bad thing 40% of the time and a good thing 20% of the time.

  5. #80
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    Oh, great, now I can think of a good, readable explanation for the Monty Hall problem.

    The initial choice is not between three doors. The choice is between two categories: good (33% chance) and bad (66% chance).
    The second choice is not between the two remaining doors. The choice is between two strategies: switch your category or not. (Eliminating one bad door guarantees that the switch is not another random choice, but specifically means switching category.)
    Since the change of being in the good category is only 33%, switching is good.


    The new problem:
    Initial choice: 40% good, 60% bad
    Second choice if initial was good: switch -> 0% good, no switch -> 100% good
    Second choice if initial was bad: switch -> 33% good, no switch -> 0% good

    Therefore:
    switch to good = (0.4 * 0) + (0.6 * 1/3) = 0.2
    no switch to good = (0.4 * 1) + (0.6 * 0) = 0.4

    Verify:
    switch to bad = (0.4 * 1) + (0.6 * 2/3) = 0.8 (+ 0.2 = 1 -> correct)
    no switch to bad = (0.4 * 0) + (0.6 * 1) = 0.6 (+ 0.4 = 1 -> correct)

    -> Switching leads to a win rate of 20%, no switching to 40%. No switching is superior.
    Last edited by CornedBee; 03-09-2008 at 04:48 AM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #81
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    The initial choice is not between three doors. The choice is between two categories: good (33% chance) and bad (66% chance).
    The second choice is not between the two remaining doors. The choice is between two strategies: switch your category or not. (Eliminating one bad door guarantees that the switch is not another random choice, but specifically means switching category.)
    Since the change of being in the good category is only 33%, switching is good.
    What do you mean by the initial "choice is between two categories: good (33% chance) and bad (66% chance)"? As I noted in post #41 of this thread, I think the initial choice simply does not matter: it is all about choosing between two strategies. So, what you call the first and the second choice seem like one single choice to me.

    EDIT:
    Ah, okay, looking at your analysis again I see what you mean. Perhaps it is not so much of a choice between two categories, but that there are two categories for analysis. The actual choice is only between strategies.
    Last edited by laserlight; 03-09-2008 at 05:14 AM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #82
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    The strategy defines your winning probability, but your initial choice defines whether you actually win or lose a round.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #83
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    The strategy defines your winning probability, but your initial choice defines whether you actually win or lose a round.
    hmm... are you saying that the initial choice is between being rational (choose the good category) and irrational (choose the bad category)?

    Or are you talking about initial chance instead of choice?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #84
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    "Chance" is indeed a better word.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #85
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    I think the initial choice simply does not matter
    It does matter - It changes probabilities of the second event (what door is opend by the host)
    If we missed - The probabilities will be 1/2,1/2,0,0
    If we selected right door - The probabilities will be 1,0,0,0
    That's why conditional probabilities of the second choice will be different for different results of the original event...

    So the original event should be taken into consideration exactly as CornedBee does it. It is simple Full Probabilities formula P(B) = P(A)*P(B|A)+P(~A)*P(B|~A)
    ~A - is notA event, P(B|A) is conditional probability of B when A occured
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  11. #86
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    It does matter - It changes probabilities of the second event (what door is opend by the host)
    Ah, but that there exists a choice before the second choice is what matters. The initial choice itself (whichever door is chosen) does not matter.

    EDIT:
    That's why conditional probabilities of the second choice will be different for different results of the original event...
    I think that holds true only in analysis, where we know what is the result of the original event. If we look at it from the point of view of the player, we can only consider strategies.
    Last edited by laserlight; 03-09-2008 at 06:07 AM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #87
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,383
    Another simplistic way of trying to explain it to the common folks (read, me) is:

    By eliminating a door, the host is not increasing my chances to 50&#37;. He is essentially giving me another door. In short, I was given 2 doors out of 3. By making sure I switch, I'll grab those odds.

    My mistake all along was refusing to observe that the initial problem couldn't just go away. There were 3 doors initially, and there were 3 doors at the end.

    Despite everything I still find the whole bloody thing fascinating. All I need is to think of something else, to be assaulted again by doubt. A veridical paradox indeed.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #88
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    I think that holds true only in analysis, where we know what is the result of the original event.
    No, it is not like that. The formula of the Full Probability - gives the resulting probability of the event B even if we do not know what occured - event A or event ~A, becuse it incorporates both possibilities. But we need to know what is the probability of the event B when event A occured, and when event ~A occured (conditional probabilities)
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  14. #89
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    No, it is not like that. The formula of the Full Probability - gives the resulting probability of the event B even if we do not know what occured - event A or event ~A, becuse it incorporates both possibilities. But we need to know what is the probability of the event B when event A occured, and when event ~A occured (conditional probabilities)
    I agree. In retrospect, my statement is misleading: what I mean by "the first choice does not matter" is that while the player deliberates the first choice, each option has an equal chance of holding a prize. My line of thought was in response to Mario F.'s assertion that the probability for the door initially chosen to contain the prize could change from 1/3 to 1/2.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #90
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    Quote Originally Posted by laserlight View Post
    My line of thought was in response to Mario F.'s assertion that the probability for the door initially chosen to contain the prize could change from 1/3 to 1/2.
    Actually - It could...
    Because we are talking here about 2 different probability spaces - one is unconditional space P(.), second is conditional space p(.|C) where C is the known event that the door opened by host does not contain price... so probabilities in these two spaces can be different...


    For example.

    You take a 52 cards stack and choose one card - randomly. Put it before you closed. What is the probability to have a King? 4/52 = 1/13

    Now I take a card from the stack and open it - suppose - it is a King
    No, what is the probability, that the card that you have choosen before, but haven't open yet is a King?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Page 6 of 8 FirstFirst 12345678 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21