Live data from Hacker News

Coding Horror: Finishing The Game

codinghorror.com

21–30 of 41 posts

Re: Coding Horror: Finishing The Game

#21
post #13

Earlier quoted context omitted.

I don't agree; Jeff was not giving a quote. Instead it is just the relevant information abstracted from whatever the person said. By choosing the quote you did, you have added more information to the problem (at least when reading it with conversational English). I think this would be a better quote of what the person might have said:"Both of my kids are driving me crazy! Just yesterday I had to pick one of them up f…

"Both of my kids are driving me crazy! Just yesterday I had to pick one of them up from the police station--I grounded her for a month!" - given just the information in your quote, the odds are 50% of a boy and a girl.

Can you give me your reasoning? I think the only conclusions you can get from that quote is that the person has two children, and at least one of those is a girl. Do you disagree with that?

If I am correct about that, then it matches the conditions discussed in the article and the answer would be 2/3 for a boy and a girl.

Re: Coding Horror: Finishing The Game

#22
post #17
post #15

This can be used as a warm-up question for another fun problem (which a friend of mine was asked during a phone screen for a position at DE Shaw): What if instead of telling you that they have two children at least one of them a girl, someone told you that they have two children at least one of them named, say, Linda? The assumption is that there are no boys named Linda, that the likelihood for a girl to be named Lin…

I'm not sure what you mean. Is the question still the same? Then why wouldn't the result be 2/3rds in either case?

It is not the same question, they only seem that way. The information given is different. The answer in the second case depends on the popularity of the name Linda.

Re: Coding Horror: Finishing The Game

#23
post #13

Earlier quoted context omitted.

"Both of my kids are driving me crazy! Just yesterday I had to pick one of them up from the police station--I grounded her for a month!" - given just the information in your quote, the odds are 50% of a boy and a girl.

Can you give me your reasoning? I think the only conclusions you can get from that quote is that the person has two children, and at least one of those is a girl. Do you disagree with that? If I am correct about that, then it matches the conditions discussed in the article and the answer would be 2/3 for a boy and a girl.

The difference is that you have specified that the child picked up from the police station is a girl, thus only the sex of the other child is unknown. This other child is either a boy or a girl, presumably with a 50/50 chance either way, resulting in a 50% chance of one being a boy and one being a girl. Concretely, using a capital letter to denote the sex of the child picked up from the station, there are only two possible permutations Gg and Gb, each of equal probability, and 50% of those are girl and boy (Gb). On the other hand if we only know that at least one is a girl we have the permuations, gg, gb, bg - resulting in the 66% chance.

Re: Coding Horror: Finishing The Game

#24
post #20
post #12

Earlier quoted context omitted.

His point is that a person telling you they have one girl would be accepted as referring to a particular child. Thus, BG and GB merge and the odds are 50% of a boy and a girl.

Pedantically, they don't merge, you just rule out GB or BG. So, initial conditions: 1) X: G, Y: G 2) X: G, Y: B 3) X: B, Y: G 4) X: B, Y: B If you are told, "at least one is a girl," as in the posted question, you can only rule out case (4). If you are told more specifically that X is a girl, you can rule out (3) and (4), giving the 50-50 chance. Which still seems a little weird to me, that knowing which is a girl, r…

Exactly - the difference is between "at least one is a girl" and pointing out a specific child as a girl.

Re: Coding Horror: Finishing The Game

#25

Sorry Jeff, I understand the problem, but the language of the setup was wrong. Since a PERSON told you they have one girl, the GB and BG are equivalent and collapse to one case instead of two in the way that normal people talk . If you had said that a mathematician or a statistician said they have one girl, that would be a different story.

The only collapse I see is that it's possible that "I have one girl" would imply ONLY one girl.

BG and GB as possibilities that often collapse in the minds of those thinking about this problem but that is exactly why the problem is paradoxical, why a certain group of people not only get it wrong but also can't let go of their wrong answer.

Re: Coding Horror: Finishing The Game

#26
The question is ill posed, because the anwser is highly dependent on how the couple told you that they have one girl.

If they tell you "we have two kids", you ask them if at least one of them is a girl and they answer "yes", then indeed the probability of the other kid beeing a boy is 2/3.

If they tell you "we have two kids, and one of them is a girl", then by all rules of rational discourse the probability for the other kid being a boy is 1.

Things start to get interesting if the talking member of the couple is a mathematician (so the rules of ordinary discourse do not apply) and he says "We have two kids, and at least one of them is a girl". Now you might say that this is equivalent two the first case. But you could also go bayesian and look at the possible conversations with couples containing at least one mathematician that have two kids. Say you have 100 couples. On average, 25 of these will have two boys and tell you "We have two kids, and at least one of them is a boy", another 25 will have two girls and tell you "We have two kids, and at least one of them is a girl". The remaining 50 couples will have one boy and one girl. Assuming no gender bias on behalf of the speaking mathematician (ha!), 25 of these will tell you "We have two kids, and at least one of them is a boy", while the remaining 25 will say "We have two kids, and at least one of them is a girl." So out of the 50 couples that tell you "We have two kids, and at least one of them is a girl," 25 will have two girls, and 25 will have a boy and a girl. So in this case, the correct answer is 1/2.

(This is essentially the argument from the intro on this page that was linked from the discussion on coding horror: http://www.overcomingbias.com/2008/10/my-bayesian-enl.html )

Re: Coding Horror: Finishing The Game

#27
post #23

Earlier quoted context omitted.

Can you give me your reasoning? I think the only conclusions you can get from that quote is that the person has two children, and at least one of those is a girl. Do you disagree with that? If I am correct about that, then it matches the conditions discussed in the article and the answer would be 2/3 for a boy and a girl.

The difference is that you have specified that the child picked up from the police station is a girl, thus only the sex of the other child is unknown. This other child is either a boy or a girl, presumably with a 50/50 chance either way, resulting in a 50% chance of one being a boy and one being a girl. Concretely, using a capital letter to denote the sex of the child picked up from the station, there are only two po…

How much do you need to know about the person to know which child is which?

I don't quite understand it, but apparently anything which can be used to distinguish the children will do.

Possibilities with two children:

    Gg, Bg, Gb, Bb
If one of them has a distinguishing mark, they have an apostrophe: (in jail, has red hair, or born first)

    G'g, B'g, G'b, B'b, Gg', Bg', Gb', Bb'
Then note that the marked one is a girl:

    G'g, G'b, Gg', Bg'
So, there is a 50% change that the children are a boy and a girl. Only if there is no way to distinguish them, do you get the 66% behaviour, where the set is:

    Gg, Bg, Gb

Re: Coding Horror: Finishing The Game

#28

Sorry Jeff, I understand the problem, but the language of the setup was wrong. Since a PERSON told you they have one girl, the GB and BG are equivalent and collapse to one case instead of two in the way that normal people talk . If you had said that a mathematician or a statistician said they have one girl, that would be a different story.

Wrong, wrong, WRONG. You DO NOT understand the problem, if you think that this means the probability of the other child being a boy is 1/2. GB and BG are equivalent linguistically, but not mathematically; they do not represent identical possibilities in the space of all conceptual representations of a family of two.

Here, I'll prove it for you:

    ;; Have a child, with an equal probability of the child being a boy or a
    ;; girl.
    (defun make-child ()
      (if (eql (random 2) 0)
          'boy
          'girl))

    ;; Make a family of n members, with each child having an equal probability
    ;; of being either a boy or a girl.
    (defun make-family (n)
      (do ((family nil)
           (i 0 (+ i 1)))
          ((>= i n) family)
        (push (make-child) family)))

    ;; As in the story, meet someone at a party who informs us that (1) she or
    ;; he has two children, and (2) that at least one of these children is a
    ;; girl.  E.g.,
    ;;
    ;; Me: "Hi there, what's your name?"
    ;; Cute lady: "Jennifer"
    ;; Me: "Nice to meet you, Jennifer, I'm Mark.  What brings you here?"
    ;; Jennifer: "Well my husband is out of town on a business trip, so I
    ;;            wanted to come here and catch up with some old friends of
    ;;            mine.  Fortunately I was able to get a baby sitter for my
    ;;            two kids on such short notice.  One of the kids, Meg, has
    ;;            to be up early in the morning for dance practice and..."
    ;; Me: "Husband?  Damn, all the good ones are taken."
    ;; Jennifer: "What?"
    ;; Me: "Nothing.  Hey, hang on while I work out the probability that your
    ;;      other child is a boy, based on the information that you've already
    ;;      given me."
    ;; Jennifer: "You're weird.  Have a good evening."
    ;;
    ;; This function works by calling (make-family 2) repeatedly until we get a
    ;; family that meets both of these criteria, then returns a representation
    ;; of said family.  This is a precise analogy for the story: just as the
    ;; fictional person at this party, here we take the space of all possible
    ;; conceptual representations of a family of two, then discard any of these
    ;; that *does not* include at least one female child.  THIS IS THE ONLY
    ;; REASONABLE WAY TO HANDLE THE INFORMATION THAT JENNIFER RELATES IN THE
    ;; ABOVE EXCHANGE.
    (defun meet-at-party ()
      (do ((family (make-family 2) (make-family 2)))
          ((find 'girl family) family)))

    ;; Perform the (meet-at-party) scenario num-total times, and then return
    ;; the fraction of those times in which the family contained a boy.
    (defun run-test (num-total)
      (let ((num-with-boys 0))
        (dotimes (i num-total (float (/ num-with-boys num-total)))
          (if (find 'boy (meet-at-party)) (incf num-with-boys)))))
Just call (run-test 1000000) or something. The result is approximately 2/3.

Re: Coding Horror: Finishing The Game

#29
post #12
post #9

Earlier quoted context omitted.

I don't think you do understand the problem. The thing you're taking issue with - GB vs BG - is the vitally important to the statistics, and is the thing that "normal" people get wrong when they see this kind of problem for the first time. The only real objection to the problem as it's posed is that it's pretty unlikely that anyone would say that one of their children was a girl when both of their children are girls.…

His point is that a person telling you they have one girl would be accepted as referring to a particular child. Thus, BG and GB merge and the odds are 50% of a boy and a girl.

And this is flat out incorrect.

Re: Coding Horror: Finishing The Game

#30

Sorry Jeff, I understand the problem, but the language of the setup was wrong. Since a PERSON told you they have one girl, the GB and BG are equivalent and collapse to one case instead of two in the way that normal people talk . If you had said that a mathematician or a statistician said they have one girl, that would be a different story.

The only collapse I see is that it's possible that "I have one girl" would imply ONLY one girl. BG and GB as possibilities that often collapse in the minds of those thinking about this problem but that is exactly why the problem is paradoxical, why a certain group of people not only get it wrong but also can't let go of their wrong answer.

Another possible collapse would be to say "I have two children, and the oldest [or youngest] is a girl". That would disambiguate GB & BG, by effectively stating I have G? [or ?G]. Then the odds would be 50%.
Post reply on HN