• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

Probability question

Moose said:
I realize this is a quick-and-dirty implimentation, but if you were planning on running this over a large number of iterations, it's inefficient and vulnerable to (short-term) deadlock.

It's a fairly tight loop, and these are usually worth the effort of optimizing.

Instead of randomizing both children and checking to see if they fit the criteria for inclusion, I would do something like this:



This is guaranteed to run in one pass per trial, does not compromise (pseudo)-randomness and requires no comparisons.

I wrote the code to be as much like the problem as possible. I was looking at it from the point of someone picking families at random. I wasn't worried about optimization because... well I only looped through it 1000 times. I mean come on. :p
 
Just thinking said:
Originally posted by 69dodge
If you randomly pick a woman out of the phone book, and you call her up and say, "if you have exactly two children, not both girls, please come to the store and bring a son with you," you are forcing her to bring a son if she has any, and then if she does come to the store, the probability is 1/3 that she has two sons.
Good -- because that was my intent. By saying "A woman is in a store with her son ... " I wanted to guarantee that she shows a son and that she has at least one.
No, he was disagreeing with you. He was saying that in the situation where you call her up and tell her that if she has a son to bring him to the store, the probability is 1/3, but in the situation where you just happen to see her with one son, the probability is 1/2.

Older or younger doesn't matter. When you call her on the phone and tell her to bring a son if she has one, this is equivalent to asking "is either of your kids a boy" and is different from "is that particular, specific kid a boy?" (particular and specific could be the one who's older, the one she happens to have in the grocery cart, the one who's taller, or whatever, as long as we're talking about just one).
 
And you call my post vague???

You code is impenetrable
Well, it's at least logical enough for the computer to run it. I can't say that of the description of your experiment. :p
More precisely: either child 1 is a boy, or child 2 is a boy, or child 1 and child 2 are boys.
No, child(1) cannot be anything else but a boy, because child(1) is defined as the known child.

Maybe if I use clearer variable names:
Code:
Boy = 1
Girl = 0

KnownChild = Boy

FOR n = 1 TO 10000

UnknownChild = INT(RND * 2)

IF UnknownChild = Boy THEN
        Total.Times.Child2.Is.Also.A.Boy = Total.Times.Child2.Is.Also.A.Boy + 1
END IF

PRINT Total.Times.Child2.Is.Also.A.Boy / n

NEXT
In a strange sense, you can not know the gender of either child. You only know that one or more is a boy.
And you know that one is either a boy or a girl. Order of birth is irrelevant. Alphabetical order of their names is irrelevant. Which one is the better one at school is also irrelevant.
You are assuming (from the first 2 outcomes) that each has an equal probability of happening. They do not.
Why not? The mother asks us tells us the gender of one child and asks us for the gender of the other child. Since the individual genders are independent from eachother, the knowledge of the gender of one does not affect the gender of the other, as far as I know.
Also, when you say "The child we know of ... " just what exactly do you mean?
I mean the child the mother has told us the gender of. I thought that was obvious.
Now, since there are 3 outcomes (not just 2) from only knowing one was a boy
What is the third outcome?
We are (I believe) playing game 2.
Well, I'd say we are playing game 1. Dr. Adequate's explanation is pretty good, isn't it?

I believe we are playing game one, because we have no reason to believe that the mother would only have told us the gender of the child if one of them was a boy. So I'll assume that she would have told us no matter what. Ockham's Razor and all that: the simplest explanation that fits the evidence.

What is your reason for believing we are playing game two? Doesn't that require that you make assumptions about the behaviour of the mother that do not exist in the OP?
 
CurtC said:
Older or younger doesn't matter. When you call her on the phone and tell her to bring a son if she has one, this is equivalent to asking "is either of your kids a boy" and is different from "is that particular, specific kid a boy?" (particular and specific could be the one who's older, the one she happens to have in the grocery cart, the one who's taller, or whatever, as long as we're talking about just one).

Exactly. Consider a woman with two children, ask her:

1) Think of one of your children. Is it a boy? Yes.

2) Is any one of your children a boy? Yes.

What's the probability of her having two boys? In 1 it's 1/2, in 2 it's 1/3. In 1 you can talk about "the one we know of", in 2 you can't.

If we see a woman with a son, is it case 1 or case 2? I now lean to case 1.
 
Though, on a pure common sense approach, if you say "I have two children, one of them is a boy", you're clearly implying the other one is a girl, so the probability of the other child being a boy is actually pretty close to zero (non-zero only due to the possibility of misclassification). Who doesn't give a complete count of their offspring's genders (when talking about their offsprings genders)?

/hopefully it'll be a few months before we have another conditional probability flamewar.
 
Jellby said:
It was an implicit premise: if you see a woman giving birth to a son and you know she already has another child, it's obvious the baby you're seeing is younger than his sibling.


Well, you first said (before mentioning a twin birth) ... "The only difference with the shop scene is you now know that the boy you saw is the younger child." This statement in no way infers that the child you see is the younger one.

Well, yes, ignoring all that (as we ignore differences in boy/girl frequencies and hermaphrodites).


I'm not sure we can ignore that. Perhaps the ratio of Identical to Fraternal is not 1:1 given a twin birth ... maybe it's not even close. And maybe one is more likely to have twin girls rather than twin boys. I don't know that either. So let's keep twins and other oddities out of this for now.



As I understand it, if you can label unambiguously both children and you know which one is a boy, then the probability is 1/2. If you know one is a boy but can't assign that piece of information to either of the labeled children, then it's 1/3.


That is correct. And the latter statement is the actual problem I (and the original post) are suggesting.

So, if we know that the oldest is a boy, we have 1/2. But would it be different if we knew the tallest is a boy?


Yes, this does nothing except tell us that one is a boy -- we're back to P = 1/3.


What if we know somehow that one of the children is out of the city when we see mother and child? We can call the one in this city A and the one away B, we know A is a boy... the probability of B being a boy too is 1/2 (I'd say). What are the restrictions we have when giving a label the the children? (Surely, we can't say "let's call the one we know is a boy A", can we? This would be what Earthborn suggested).

Any information other than sex is moot. (Now who's going to be the first to jump on that line? Ooooooooo)
 
Alkatran said:
I wrote the code to be as much like the problem as possible. I was looking at it from the point of someone picking families at random. I wasn't worried about optimization because... well I only looped through it 1000 times. I mean come on. :p

Actually, I can't really let this pass. While I fully realize the limited scope of the problem, this is one of those issues.

You need to read the wikipedia entry on the "Bogosort" algorithm, which covers the issue very well.

Code worth writing is usually worth writing well. You'd be amazed at how often your thousand record "saturday night special" gets scaled to a few billion records.

[Edit to add:] I'd be happy to discuss this some more if you like, but it might be best to take it to PMs so as not to hijack the thread any further.
 
ReFLeX said:
What I don't understand is how this is different from the 'gambler's fallacy', that the previous flip of the coin affects the next one, and so on.
In the gambler's fallacy the gambler knows the results of all previous flips and is speculating only on the next flip.

Here the flips have already occured. We are asked for a proability concerning the entire set of flips, not just the last one. We have information about the set (but not any specific member) which allows us to rule out some possibilities.
 
Originally posted by ReFLeX
If so, it's NOT because of that proof.
The proof that 0.999... = 1 easily simplifies to the equation 9x=9, so if you saw it as "9x=9x" there was a typo in there somewhere.

Originally posted by Jorghnassen
Though, on a pure common sense approach, if you say "I have two children, one of them is a boy", you're clearly implying the other one is a girl...
That's true, and that's why I pointed out earlier that the question is better stated as a census worker asking her first if she has a boy.

Originally posted by Just Thinking
So, if we know that the oldest is a boy, we have 1/2. But would it be different if we knew the tallest is a boy?
Yes, this does nothing except tell us that one is a boy -- we're back to P = 1/3.
No, if you're given that the tallest is a boy, we're back to P=1/2. That's because you're now talking about a specific kid, and not the question "is either of them a boy" as in the census worker example (which is P=1/3).
 
Language is such an inexact thing...

I think some of the confusion is because the original question appears to ask about the probability of one child being male. But that is not what is being asked. The question being asked is really "What is the probability that both children are male?"

The probability of any one child being male is always 1/2.

Given 2 children, with no other information, the probability that both are male is 1/4.

But if we know that the set of 2 children includes at least one male, then the probability that both are male is 1/3.

1/3 is the probability that the set includes 2 males, not the probability that any one of them is male.

OTOH, if we know that a specific child is male (oldest, tallest, whatever) then the question does become "What is the probability that the other (one specific) child is male? And the answer is 1/2.
 
CurtC said:
No, if you're given that the tallest is a boy, we're back to P=1/2. That's because you're now talking about a specific kid, and not the question "is either of them a boy" as in the census worker example (which is P=1/3).

I did the combinations and it does come out to 1/2.

Sorry.

What it does is eliminate two of the girl boy pairs (we're now talking about 8 instead of 4).
 
CurtC said:
No, he was disagreeing with you. He was saying that in the situation where you call her up and tell her that if she has a son to bring him to the store, the probability is 1/3, but in the situation where you just happen to see her with one son, the probability is 1/2.

I knew that ... I was simply saying that my intent was to let the observer know that she has at least one male son out of 2 children. Remember, my intent is to have the women bring a male child with them (if they have one) -- they have no choice if they have one of each.

Older or younger doesn't matter. When you call her on the phone and tell her to bring a son if she has one, this is equivalent to asking "is either of your kids a boy" and is different from "is that particular, specific kid a boy?"

Here's where we disagree. Let's look at all the possible pairs of offspring the woman can have if we see her in the store ...

BB
BG
GB
GG

We walk up to her and ask (without seeing a child) ... "How many children do you have?" She says "2". We then ask "Is one a boy?" and she replies "Yes". We caculate the probability of the second being a male as 1/3.

Next we see another woman (without seeing a child) and do the same. "How many children do you have?" She says "2". We then ask "Is one a boy?" and before she replies a male child runs up to her crying for his mommy. Are you saying this gives us more information than the first woman? (Keep in mind my intended conditions above.)
 
Just thinking said:
Well, you first said (before mentioning a twin birth) ... "The only difference with the shop scene is you now know that the boy you saw is the younger child." This statement in no way infers that the child you see is the younger one.

But the previous sentence was:
"If you see a mother giving birth to a son, and you're told he's her second child... you have again 1/2 for the other child."

I'm not sure we can ignore that. Perhaps the ratio of Identical to Fraternal is not 1:1 given a twin birth ... maybe it's not even close. And maybe one is more likely to have twin girls rather than twin boys. I don't know that either. So let's keep twins and other oddities out of this for now.

It was just a thought experiment to turn the previous case into another one where you don't know which is the older. I didn't mean the probabilities are close to 1:1, but just "let's pretend they are for the sake of this argument" :-)
 
Just thinking said:
We walk up to her and ask (without seeing a child) ... "How many children do you have?" She says "2". We then ask "Is one a boy?" and she replies "Yes". We caculate the probability of the second being a male as 1/3.

Next we see another woman (without seeing a child) and do the same. "How many children do you have?" She says "2". We then ask "Is one a boy?" and before she replies a male child runs up to her crying for his mommy. Are you saying this gives us more information than the first woman? (Keep in mind my intended conditions above.)

Strangely, I think there is a difference, but I can't say exactly what it is. In the second case you know that "this particular kid" is a boy, which I think is enough.

It may have something to do with the fact that "running up to her crying" is independent of the sex of the kid, so the information that allows you to say "this particular kid" is independent of "is a boy". In the first case, however, this doesn't happen, as you're forcing the mother to give you information about whichever one of the kids that's a boy, and so they're not independent. If you somehow know that only boys cry for their mother, then the second case would be equivalent to the first.
 
Jellby said:
Strangely, I think there is a difference, but I can't say exactly what it is. In the second case you know that "this particular kid" is a boy, which I think is enough.

I somehow agree with that -- if the mother randomly brings a child into the store. But if she is always going to bring a male child (if she has at least one) it may be the same.

I think it was 69dodge that suggested a situation where there are 2 mothers -- one with 10 boys and one with 9 girls and 1 boy. You see a mother with a boy in the store and determine her to be more likely the one with 10 boys. True if she brings a child in at random, but if you know she must bring a male child (if she has one) it's 50-50 as to which mother she is. Agree?
 
Originally posted by Just thinking
We walk up to her and ask (without seeing a child) ... "How many children do you have?" She says "2". We then ask "Is one a boy?" and she replies "Yes". We caculate the probability of the second being a male as 1/3.

Next we see another woman (without seeing a child) and do the same. "How many children do you have?" She says "2". We then ask "Is one a boy?" and before she replies a male child runs up to her crying for his mommy. Are you saying this gives us more information than the first woman? (Keep in mind my intended conditions above.)

I would like to put it this way:

In the second situation, the question is asked once per boy child (who came crying). So if this situation is repeated 100000 times, the BB mothers will get to answer the question twice as often as the GB (or BG) mothers.

In the first situation, the question is asked once per woman, not once per boy child. So if this situation is repeated 100000 times, the BB mothers will get to answer the question the same number of times as the GB (or BG) mothers.

Consider the following two situations:

A:
4000 mothers who have exactly two children are gathered in a room. Each one is asked if one of her children is a boy. All who say No are removed from the room. (Assuming equal distribution of sexes etc etc) nearly 3000 will stay in the room.

Now these women are asked to raise their hands if their other child is a boy. Nearly 1000 will raise their hands, i.e. 1/3rd of 3000.


B:
All the mothers that have come to the mall with only one son are asked if they have exactly two children. If yes, they are gathered in a room. Say there are 3000 such women.

They are now asked to raise their hands if their other child is a boy. Nearly 1500 will raise their hands, i.e. 1/2 of 3000.


Are these two situations not different ?

In situation A, the "second" question is asked once per woman. The 3000 mothers in the room have in total 1000 "second" boys.

In situation B, the "second" question is asked once per boy child. The 3000 mothers in the room have in total 1500 "second" boys.


Among the families with 2 children one of which is a boy,

1/2 of the boys have a brother.

But only 1/3rd of the mothers have a son with a brother.

I guess that's the difference.
 
Just thinking said:
Here's where we disagree.
I agree with this statement!
Next we see another woman (without seeing a child) and do the same. "How many children do you have?" She says "2". We then ask "Is one a boy?" and before she replies a male child runs up to her crying for his mommy. Are you saying this gives us more information than the first woman?
Yes, I'm saying that gives you more information, and the odds would adjust accordingly. If the pair of kids is (kid in the store, kid not in the store) then out of the four possibilities (B,B) (B,G) (G,B) (G,G) you now have ruled out two of them.

And I would be willing to wager a lot of money on this answer if we carry out random simulations.
 
CurtC said:
I agree with this statement!Yes, I'm saying that gives you more information, and the odds would adjust accordingly. If the pair of kids is (kid in the store, kid not in the store) then out of the four possibilities (B,B) (B,G) (G,B) (G,G) you now have ruled out two of them.

And I would be willing to wager a lot of money on this answer if we carry out random simulations.


The trick here is that the gender of the specific child was revealed at random, not by selection of the mother.

If the mother pull the boy out from behind a curtain and said, "look I have a boy", then you would be back to 1/3 again.
 

Back
Top Bottom