## Tuesday, December 28, 2010

### On babies, batting averages, and weighted means

Here's a famous old math problem you've probably seen many times before:

A king decides that his country has too many men and not enough women. So he issues a decree: once a couple has a boy, they're not allowed to have any more babies.

The king reasons as follows: no family will have more than one boy. But some families will have two girls, or three girls, or even six girls before they have a boy. So there will wind up being a lot more girls than boys.

Is the king's reasoning correct?

The answer: the king's reasoning is not correct. There will still be 50 percent boys, and 50 percent girls. There are many ways to figure this out. I'd refer you to a solution on the internet, but I can't seem to find the problem. (Can anyone supply a link?)

Now: last week, Steven Landsburg posted a variation on the question, as follows:

There's a certain country where everybody wants to have a son. Therefore each couple keeps having children until they have a boy; then they stop. What [is the expected value of the] fraction of the population [that] is female?

At first, this seems like the same question. But it's not. As Landsburg explains, the answer to this one is *not* 50 percent.

But even though the answer isn't 50 percent, it *seems* like it should be -- so much so that commenters are perplexed. One reader, a physics professor, seems certain that Landsburg is wrong, and that the answer is indeed 50 percent. Landsburg has challenged him to a \$15,000 bet.

Landburg is indeed correct. I'm going to try explaining why, with a baseball analogy. But before I do, think about it a bit, and maybe read Landsburg's posts, to try to figure it out for yourself. It took me a while to get my head around it.

-----

OK, here we go.

Suppose that in a given season, the overall MLB batting average is .250. What is the average player's batting average?

The answer is NOT .250. But this time it's a lot easier to figure out why.

If you check, you will find that the average major leaguer hits less than the league average .250.

Why? Because when you average individual players, you give them equal weight. But when you figure out the composite MLB average, you weight by the number of at-bats. And good players have more AB than bad players. Therefore, the overall average is inflated by the fact that you weight the good players more heavily, and will wind up being higher than the average of the individual players weighted equally.

This is easier to see with an example. Suppose there are two players in the league. Player A goes 100 for 399, for a batting average of .251. Player B, who is a pitcher, goes 0 for 1. The average player went .125 (the average of .251 and .000). But, overall, the league hit .250 (100 for 400).

Weighted by AB, the league hit .250. Weighted by player, the league hit .125.

Got it for baseball? Now, let's apply it to Landsburg's problem. Because births are random, and we want the average, imagine repeating the birth simulation for a million different countries.

In baseball, players with more AB have a higher proportion of hits. In Landsburg's example, countries with more births have a higher proportion of girls. That's obvious, isn't it? If there are 100 families in the country, there'll always be 100 boys at the end. The only difference, then, must be the number of girls. Countries with more babies, then, *must* have more girls, and therefore a higher proportion of girls.

So we have exactly the same situation for countries as for batters.

-- Country A might have 100 boys and 91 girls, which means a .476 "girling average".
-- Country B might have 100 boys and 109 girls, which means a .522 "girling average".

Overall, there are 200 boys, and 200 girls, for a composite average of .500. However, the average *country* has an average of only .499 (the average of .476 and .522).

If you weight the average by *babies*, you get .500, as expected. But if you weight it by *countries*, you get .499.

Landsburg's question requires you to weight the average by country, and that's why the answer is less than .500.

-----

We'll see if he gets any takers for his bet. I'm guessing he doesn't.

Labels: , , ,

At Tuesday, December 28, 2010 2:33:00 AM,  mettle said...

The whole thing seems more about word play than mathematics.
Landsburg equates "the fraction of girls in the average family" to "fraction of the population is female."
To me, they're not the same thing.

At Tuesday, December 28, 2010 2:49:00 AM,  Phil Birnbaum said...

Mettle: Right: the average fraction of girls in a family is less than the fraction of the population that is female.

But that's not what the question is.

The question is: is the average fraction of the population that is female equal to 50%?

At Tuesday, December 28, 2010 3:06:00 AM,  mettle said...

It sort of reminds me of Simpson's paradox, which I think is far more clever and can be demonstrated with BAs.
You probably know it, but:
Player A: yr1: 150/500 = .300, yr2: 10/50 = .200
Player B: yr1: 35/100 = .350, yr2: 110/450 = .244

Despite having a higher BA in both years:
Player A = .291
Player B = .263

At Tuesday, December 28, 2010 9:34:00 AM,  Anonymous said...

Phil, did you actually read Prof. Motl's post? He clearly understands the two distinct problems (expected average weighted over children vs. expected average weighted over families).

At Tuesday, December 28, 2010 10:03:00 AM,  Anonymous said...

Eh, I suppose I should read Landsburg's post in its entirety as well.

The highlighted text in Landsburg's initial post is completely ambiguous.

The paragraph right below it clarifying the post doesn't help much, if at all. Landsburg essentially requires you to assume some unspecified, but finite, initial number of couples in the country. He mentions this in the third post where he lays down the terms of the bet (4 initial couples), but not in the first two.

In a brainteaser, it's entirely fair to assume an infinite population.

At Tuesday, December 28, 2010 10:18:00 AM,  Brian Burke said...

Not to long ago we had a debate at my site about the "two-sons problem," which is a good example of how a question is asked can have a subtle but important effect on the answer.

At Tuesday, December 28, 2010 10:18:00 AM,  Phil Birnbaum said...

Anon/9:34:

Professor Motl does indeed realize the difference between "weighted by children" and "weighted by families." But he fails to realize that "weighted by countries" (which is what Landsburg is asking) requires the same kind of logic, and will be lower than 50% for the same reason that "weighted by families" is lower than 50%.

At Tuesday, December 28, 2010 4:18:00 PM,  JavaGeek said...

"Population" doesn't seem clearly defined. If you assume population to be equal to the sum(families) then: the expected value is E[girls/population], or sum( p(girls/population)*girls/population, girls=0..population). If for example population is FINITE then this is correct, if population is INFINITE, then the answer would be 50%. Or, the limit as population goes to infinity: SUM(p(girls/population)*girls/population, girls=0..population) = 50%.

That said this problem should approach 50% very quickly for large populations (>1000?).

If the problem asked what is the expected percentage of females in a single family then it would be more obvious, however the term population suggests more than one family.

At Tuesday, December 28, 2010 4:37:00 PM,  JavaGeek said...

Check out this spread sheet (google docs / large). It has 100 "populations" each population has 100 families. Clearly the families female percentage is close to 30%, but the population for a group of families averages to 50%.

At Tuesday, December 28, 2010 5:41:00 PM,  Phil Birnbaum said...

Right, the answer approaches 50% as the population approaches infinity.

I suspect that for any reasonable number of families, the answer is so close to 50% that a simulation won't be able to distinguish. But it's still not 50%. :)

The whole point of Landsburg's post was that the answer is not 50%, and the traditional logic is wrong.

If anyone out there read the question and said, "it's less than 50% for small numbers of families, but approaches 50% as the number of families gets large," you have my congratulations. My first reaction was, "of course it's 50%." And it took me a fair bit of effort to figure out why that logic was wrong.

At Friday, December 31, 2010 11:02:00 PM,  Anonymous said...

As I said on the Book blog, it has nothing to do with the number of families. The question, regardless of the number of countries (or the number of families) depends on if there is a limit to the number of girls a family can have. If there is (which there will be in reality), it is exactly 50/50. If there isn't, then there is no answer, as in an infinite sample size, there will be at least one family with an infinite number of girls, and in order to figure the percentage of girls or boys, you would have to divide by infinity.

If you assume that every family has a boy, then the answer is that boys have a slightly higher percentage than girls (becasue we have a population that was slectively sampled - no families with all girls).

Landsburg is all wet. His explanations are horrendously unclear (and wrong).

MGL

At Tuesday, January 04, 2011 9:04:00 AM,  Mike said...

I find 4 to be an easier number to comprehend.

Country 1 has 4 boys, 3 girls.
Country 2 has 4 boys, 5 girls.

57% boys in country 1, 44% boys in country 2, unweighted average of 50.5% boys between both countries.

I use 3, 4, and 5, because it relates well to ERA in baseball, and the concept that a run saved is worth more than a run scored.

If a team who scores 4 runs/game team improves by one run, they are scoring 25% more runs per game.

If a team who allows 4 runs/game improves by one run and now only allows 3, they are allowing 33% fewer runs.

At Tuesday, January 04, 2011 10:02:00 AM,  Mike said...

Hmmm... after reading more comments on that guys blog, my comment above isn't as appropriate I don't think. It's a simple explanation, and I think it's factually correct, but it doesn't get at the weighting that Phil does in his actual post here.

MGL makes a great analogy in the comment above my first one, too, which of course relates to gambling!

At Thursday, January 06, 2011 1:54:00 PM,  Nate said...

i read landsburg's article when it first came out and couldn't follow along. immediately after reading your baseball analogy, i understood perfectly. thanks!

sports as a lens to see the world...

At Friday, January 07, 2011 12:51:00 PM,  Hank Gillette said...

Phil,

You owe me several hours of my life I'll never get back.

I looked at Landsburg's original post, read a bunch of the comments, and then read Landsburg's followup post along with comments, plus the web sites of two or three of his most voracious critics.

My take: he is correct for his version of the problem, but he changed it from the original problem that he got from Google. The Google question asks "what fraction of the population is female?".

Given that the Google version specifies a country, it is reasonable to assume a population of thousands. It would also be reasonable to assume that women have a limited childbearing period, thus leaving some families with all girls. Using those assumptions, the answer is so close to 50% to be indistinguishable from it.

Landsburg changed the parameters, but then he claims that Google's answer of 50% is wrong. The thing is, he's solving a different problem that the one posed by Google. I find that somewhat dishonest.

At Friday, January 07, 2011 1:25:00 PM,  Phil Birnbaum said...

Hi, Hank,

Sorry about those hours!

The question, "What fraction of the population is female?" has to be interpreted. Otherwise, "it could be almost anything!" is the correct answer, since the result will be random.

I think the most plausible interpretation is, "What is the expected value of the fraction of the population that is female?" That's Landsburg's question. And that answer is not 50%.

In an idealized brain teaser of this sort, it's usually reasonable to make unrealistic assumptions to keep the problem simple. I suppose you could assume a limited childbearing period, but that still wouldn't give you an answer of 50%, unless the childbearing period was one child.

The obvious answer is, "it's 50% because the selection process can't possibly produce more girls than boys." That's wrong. The correct answer is, "it's very close to 50% but still less than 50%, for counterintuitive reasons that are explained in Landsburg's blog [and here]."

In any case, I agree that anyone who interpreted the problem differently and solved THAT problem correctly with the correct explanation deserves full credit. My perception is that none of the critics have done that, and that many of the ones who say you have to interpret the problem differently *even got the wrong answer for their interpretation*.

For instance, if you assume a limited childbearing period, what's the answer? I think it's somewhere between the answer to the Landsburg problem, and 50%. But I can't prove that, and I haven't seen it solved by anyone.