# Boys and Girls, there's lies, damn lies, and statistics. From the Monty Hall Problem olumn

**URL:** <https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295>\
**Category:** Cecil's Columns/Staff Reports\
**Created:** [January 17, 2010, 6:20am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295 "2010-01-17T06:20:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [January 17, 2010, 10:26pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/21 "2010-01-17T22:26:03Z")

</div>

> [@The\_Tao\_s\_Revenge](#):
>
> Oh I agree there’s only 2 sets really but, that’s the source of the debate. the 2/3 side feels girl-boy, and boy-girl are different sets, with an equal probability each to boy-boy.
> 
> I’d therefore like to keep them separate in the poll. It’s my belief that if boy-girl, girl-boy are the same set then the artificial divide will cut them in half resulting in 1/4 boy-girl, 1/4 girl-boy, and 1/2 boy-boy. The javascript in OP demonstrates this, but it’s disputed.
> 
> So I’d like to set up an undisputed experiment.

The experiment is invalid from the start. Your responses to the poll aren’t a random sample, and you can’t draw statistical inferences from them.

---

<div class="post-metadata">

**Author:** ![bup](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bup](https://boards.straightdope.com/u/bup)\
**Post date:** [January 17, 2010, 10:36pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/22 "2010-01-17T22:36:48Z")

</div>

> [@ultrafilter](#):
>
> The experiment is invalid from the start. Your responses to the poll aren’t a random sample, and you can’t draw statistical inferences from them.

Oh, it’s fine. The only thing that matters is if a person with two kids who participates at the SDMB is going to have more or fewer sons than the population at large. That’s all we’re asking. I’m willing to risk it.

---

<div class="post-metadata">

**Author:** ![BigT](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bigt/32/12044_2.png) [@BigT](https://boards.straightdope.com/u/BigT)\
**Post date:** [January 18, 2010, 7:17am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/23 "2010-01-18T07:17:37Z")

</div>

> [@The\_Tao\_s\_Revenge](#):
>
> **BigT** I see what your trying to do but you’re considering more then 10,000 sets. The 0, 0 sets are part of the pool even though they’re eliminated out of hand. Yet you’re running them through the statistics. You’re dividing the results of ~13,333 set by 10,000. Consider this version:  
> \<example snipped\>  
> Girl-Girl is ruled out of hand. That shouldn’t be considered at all. Yet the program considers it ~3333 times that way.
> 
> Considered another way. We have poles now.
> 
> Anyone object to this pole question? “dopers having two kids, with one of them a boy, do you have:  
> 1: two boys  
> 2: boy-girl  
> 3: girl-boy”

The ruling them “out of hand” is intentional, as that’s exactly what would have to happen in real life. (Chronos gives a good description.) At first, I was going to sample 10000 groups of two children, and just throw out the girl-girl combinations, but I thought it would make more sense for each removed sample to have to be replaced. Just move looper++; back where you had it to fix it.

As far as I can tell, your original javascript would have meant picking a random male, and then adding either a male or female. (The if statement at the beginning only randomly flips the sample.) This doesn’t accurately reflect the problem, as there is no indication that the first child is the one the parent is talking about. In fact, it pretty much begs the question, as it assumes BG = GB, which is what you are trying to prove.

---

<div class="post-metadata">

**Author:** ![bup](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bup](https://boards.straightdope.com/u/bup)\
**Post date:** [January 19, 2010, 4:44pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/24 "2010-01-19T16:44:43Z")

</div>

Hello? Tao? Poll question? I’ll do it if you don’t want to - you have me piqued.

---

<div class="post-metadata">

**Author:** ![zut](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zut/32/2875_2.png) [@zut](https://boards.straightdope.com/u/zut)\
**Post date:** [January 19, 2010, 5:21pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/25 "2010-01-19T17:21:25Z")

</div>

I don’t know why a poll is any more useful than simply going through the expected numbers.

Start with this: There are exactly 100 families with exactly two children. Exactly how many families would one expect to have which sexes of children, exactly what poll question would be asked, and exactly what would one expect the responses to be?

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [January 19, 2010, 7:50pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/26 "2010-01-19T19:50:00Z")

</div>

> [@zut](#):
>
> I don’t know why a poll is any more useful than simply going through the expected numbers.

It’s not, because all of the statistical theory that people will want to apply is fundamentally based on the assumption that the poll respondents are a random sample of the population, and is not robust with respect to violations of that assumption.

---

<div class="post-metadata">

**Author:** ![bup](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bup](https://boards.straightdope.com/u/bup)\
**Post date:** [January 19, 2010, 8:29pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/27 "2010-01-19T20:29:34Z")

</div>

> [@ultrafilter](#):
>
> It’s not, because all of the statistical theory that people will want to apply is fundamentally based on the assumption that the poll respondents are a random sample of the population, and is not robust with respect to violations of that assumption.

It’s not, but it’s good enough. I refuse to believe that anything about the genders of children people have will affect their likelihood to participate in the poll (except as the people with no boys will be asked not to participate).

**zut** - Look, and I agree that a bullet fired level from a gun will strike the ground at the same instant as a bullet dropped from the height of the gun barrel, but it was still cool when they did it on _Mythbusters_.

---

<div class="post-metadata">

**Author:** ![bup](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bup](https://boards.straightdope.com/u/bup)\
**Post date:** [January 19, 2010, 8:44pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/28 "2010-01-19T20:44:56Z")

</div>

[Here I did it](http://boards.straightdope.com/sdmb/showthread.php?t=548550).

---

<div class="post-metadata">

**Author:** ![Quercus](https://avatars.discourse-cdn.com/v4/letter/q/7ab992/32.png) [@Quercus](https://boards.straightdope.com/u/Quercus)\
**Post date:** [January 19, 2010, 9:35pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/29 "2010-01-19T21:35:46Z")

</div>

> [@zut](#):
>
> Pretty much what everyone else said, but more specifically, this quote right here is the issue. What you’re doing is answering a _different question_ than the one in Cecil’s column.
> 
> The difference between the two questions is that, in the one you’re illustrating, the two children are _differentiated_. In this case they’re differentiated not by age, but by one child being identified by gender and the other one not. As an example:
> 
> 1. You’re at a party with 100 couples, each of whom has two children. You ask each couple: “Choose one of your children, but don’t tell me which one. Now: is the child you chose a girl?” Of those couples that say, “yes,” how many have a son?
> 
> 2. You’re at a party with 100 couples, each of whom has two children. You ask each couple: “Do you have any daughters?” Of those couples that say, “yes,” how many have a son?
> 
> These two questions are different. Cecil asked the second, you answered the first. It’s not surprising you have different answers.

First, I don’t think Cecil did a very good job of stating his question, so I can’t blame anyone who thought he was asking #1.  
But let me try and rephrase them

1. You [randomly] flip a penny and a quarter. If the penny doesn’t come up heads, flip again without counting it. Out of the times the penny is heads-up, how often will both coins be heads? (This is the same as just leaving the penny heads-up, and counting how often the quarter comes up heads).

2. You flip two coins, and if neither coin comes up heads, flip them again without counting that try. Out of the times that they’re not both tails, how often will both coins be heads?  
Run a simulation if you want, but the answer to #1 is clearly 1/2 the time, wheras the answer to #2 is 1/3 of the time.

---

<div class="post-metadata">

**Author:** ![Frazzled](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/frazzled/32/3368_2.png) [@Frazzled](https://boards.straightdope.com/u/Frazzled)\
**Post date:** [January 19, 2010, 10:14pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/30 "2010-01-19T22:14:32Z")

</div>

Just for kicks and giggles, I wrote this program in C# (It’s what I use at work and I like it).

I created a class called Family which contained 2 children of random gender.  
I then created 1000 families, excluding those which did not have a daughter and printed the break down:  
Girl, Girl: 346  
Boy, Girl: 324  
Girl, Boy: 330

Percent of families with boy: 65%

Looks pretty definitive, and agrees with Cecil

---

<div class="post-metadata">

**Author:** ![BigT](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bigt/32/12044_2.png) [@BigT](https://boards.straightdope.com/u/BigT)\
**Post date:** [January 19, 2010, 10:18pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/31 "2010-01-19T22:18:10Z")

</div>

> [@zut](#):
>
> I don’t know why a poll is any more useful than simply going through the expected numbers.

Because two different results have been offered, and which one matches real life expectations has been disputed.

---

<div class="post-metadata">

**Author:** ![Frazzled](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/frazzled/32/3368_2.png) [@Frazzled](https://boards.straightdope.com/u/Frazzled)\
**Post date:** [January 20, 2010, 12:13am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/32 "2010-01-20T00:13:51Z")

</div>

> [@Frazzled](#):
>
> Just for kicks and giggles, I wrote this program in C# (It’s what I use at work and I like it).
> 
> I created a class called Family which contained 2 children of random gender.  
> I then created 1000 families, excluding those which did not have a daughter and printed the break down:  
> Girl, Girl: 346  
> Boy, Girl: 324  
> Girl, Boy: 330
> 
> Percent of families with boy: 65%
> 
> Looks pretty definitive, and agrees with Cecil

I added a new function into my code and applied **The Taos’s Revenge** ’s logic to it and came up with the following result set:

Girl, Girl: 496  
Boy, Girl: 239  
Girl, Boy: 265

Percent of families with boy: 50%

When I looked at his code, I realized why we have different numbers. He runs a 50 / 50 comparison at the start to determine if the daughter is the older child or the younger child, then he determines what the gender of the other child is. In other words, in a set of 1000 families, 500 have a daughter as the older child, and 500 have the daughter as the youngest child.

I wanted to test this, so I just ran my program one last time, creating 500 families with an older daughter, and 500 families with a younger daughter:

Girl, Girl: 533  
Girl, Boy: 234  
Boy, Girl: 233

Percent of families with boy: 47%

**The Tao’s Revenge** has built some bias into his program. Run your program again allowing the program to randomly select the gender for both children, then just discard the boy / boy case and you’ll see the same results as I did in my first run, and the same results Cecil gets in his column.

---

<div class="post-metadata">

**Author:** ![Frazzled](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/frazzled/32/3368_2.png) [@Frazzled](https://boards.straightdope.com/u/Frazzled)\
**Post date:** [January 20, 2010, 3:55am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/33 "2010-01-20T03:55:31Z")

</div>

The Tao’s Revenge, I now see just what it is that is ultimately causing your program to give you erronious results.

In case 1 you expect the girl to come first, and then the second child could be boy or girl.  
So Girl Girl, or Girl Boy

In case 2 you expect the girl to come second, then the first could be a boy or girl.  
So Girl Girl or Boy Girl

Do you see the problem? You have Girl Girl twice, this is why Girl Girl is 50%, with the other 2 options each being 25%.

If you take out one of your Girl Girl choices (because it’s a duplicate), then each choice will be split into thirds, which is what the initial prediction stated.

---

<div class="post-metadata">

**Author:** ![md2000](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@md2000](https://boards.straightdope.com/u/md2000)\
**Post date:** [January 20, 2010, 6:54pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/34 "2010-01-20T18:54:23Z")

</div>

The problem with your program is that you get a do-over on the gender of the first child if it’s wrong…

\*var tester = Math.round(Math.random());

```
if (tester==1) {
	var kid1 = 1;
	var kid2 = Math.round(Math.random());
}

else {
	var kid1 = Math.round(Math.random());
	var kid2 = 1;
}*

```

Assuming you meant “tester” (not “testes”?) is the gender of the first child…  
If it’s 1/True/Boy, then the next child is random.  
If it’s 0/Girl/False, you proceed to force the second child to be a boy (kid2=1) but then you pick another random choice for kid one. Wrong. You’ve just established kid1 is a girl. The code should read:

- else {  
var kid1 = 0;  
var kid2 = 1;  
}\*

I bet that gives the correct result.

---

<div class="post-metadata">

**Author:** ![CurtC](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@CurtC](https://boards.straightdope.com/u/CurtC)\
**Post date:** [January 20, 2010, 8:11pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/35 "2010-01-20T20:11:25Z")

</div>

> [@The\_Tao\_s\_Revenge](#):
>
> Basically the logic here is there is 3 sets: M-F, F-F, and F-M. therefore each has about 1/3 chance of happening. Two sets opposite sex, therefore opposite sex is 2/3.
> 
> This just doesn’t hold up though.F-M, and M-F are same set, just rearranged. The logical fallacy here is copying a set, flipping it around and saying it’s a different, but possible set.

I’d like to point out that when figuring probability, it’s valid to list out all the possibilities and count them up, _as long as each possibility that you’ve listed is equally likely_.

Here, you consider that F-M and M-F are the same set, which is OK for you to view it that way, but if you’re wanting to do probability calculations, it doesn’t work. The reason that Cecil and others list them separately is that M-M, M-F, F-M, and F-F are four equally likely possibilities. If you want to do it your way, you can list out M-M, M-F, and F-F as the three possibilities, but that way, the M-F group contains twice as many, so it makes the calculation more involved than simply counting.

---

<div class="post-metadata">

**Author:** ![md2000](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@md2000](https://boards.straightdope.com/u/md2000)\
**Post date:** [January 20, 2010, 11:43pm UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/36 "2010-01-20T23:43:11Z")

</div>

> [@md2000](#):
>
> The problem with your program is that you get a do-over on the gender of the first child if it’s wrong…
> 
> \*var tester = Math.round(Math.random());
> 
> ```
> if (tester==1) {
> var kid1 = 1;
> var kid2 = Math.round(Math.random());
> }
> 
> else {
> var kid1 = Math.round(Math.random());
> var kid2 = 1;
> }*
> 
> ```
> 
> Assuming you meant “tester” (not “testes”?) is the gender of the first child…  
> If it’s 1/True/Boy, then the next child is random.  
> If it’s 0/Girl/False, you proceed to force the second child to be a boy (kid2=1) but then you pick another random choice for kid one. Wrong. You’ve just established kid1 is a girl. The code should read:
> 
> - else {  
> var kid1 = 0;  
> var kid2 = 1;  
> }\*
> 
> I bet that gives the correct result.

Actually, on reflection - I lied. This will not give a correct answer either.  
It corresponds to the situation - “if the first child is a girl, adopt a boy”.  
This results in a 75-25 distribution.

The programs above (Tao and BigT) have it right, Generate two sequential random numbers, for child one and child 2, and discard the one that is girl-girl.

---

<div class="post-metadata">

**Author:** ![bup](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@bup](https://boards.straightdope.com/u/bup)\
**Post date:** [January 21, 2010, 1:21am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/37 "2010-01-21T01:21:13Z")

</div>

Right now in [this poll](http://boards.straightdope.com/sdmb/showthread.php?t=548550), we have 96 observations, exactly 64 mixed and 32 daughter-onlies.

96 observations gives us a standard error of 4.8%, so going out 2 of those, there’s a 95% probability the real population split is between 57.1 (that is, 66.7-9.6) and 76.3 (66.7+9.6) percent. Going out one more standard error in each direction takes us to 99% confidence, and the range still does not include **Tao’s** predicted 50/50 split.

---

<div class="post-metadata">

**Author:** ![The\_Tao\_s\_Revenge](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@The\_Tao\_s\_Revenge](https://boards.straightdope.com/u/The_Tao_s_Revenge)\
**Post date:** [January 21, 2010, 2:38am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/38 "2010-01-21T02:38:41Z")

</div>

66%, can’t argue with results. I was so sure too, I drew a diagram showing the “flawless” logic of why it’s 50%, but learning something new is worth the flavor of my own hat, and a wasted half hour on the diagram.  
Thanks **bup** , **bigT** , and all.

---

<div class="post-metadata">

**Author:** ![DSYoungEsq](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@DSYoungEsq](https://boards.straightdope.com/u/DSYoungEsq)\
**Post date:** [January 21, 2010, 2:39am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/39 "2010-01-21T02:39:04Z")

</div>

Was there any doubt? :smack:

That observed results should mirror probability calculations is not a shock. **Tao** made an incorrect restatement of the problem in coding his simulation. blah blah blah (darn simulposts!). 😉

---

<div class="post-metadata">

**Author:** ![DSYoungEsq](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@DSYoungEsq](https://boards.straightdope.com/u/DSYoungEsq)\
**Post date:** [January 21, 2010, 2:40am UTC](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295/40 "2010-01-21T02:40:11Z")

</div>

> [@The\_Tao\_s\_Revenge](#):
>
> 66%, can’t argue with results. I was so sure too, I even had a diagram I drew out showing the “flawless” logic of why it’s 50%, but learning something new is worth the flavor of my own hat.  
> Thanks **bup** , **bigT** , and all.

I hope you do like I do and wear chocolate ones, just in case! 😛

[Previous page](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295.md?page=1)

[Next page](https://boards.straightdope.com/t/boys-and-girls-theres-lies-damn-lies-and-statistics-from-the-monty-hall-problem-olumn/525295.md?page=3)
