Poincaré's bread
Henri Poincaré was a French mathematician who taught at the Sorbonne around 1900.The following anecdote about him is probably fabricated, but it makes an interesting probability problem.
Supposedly, Poincaré suspected that his local bakery was selling loaves of bread that were lighter than the advertised weight of 1 kg, so every day for a year he bought a loaf of bread, brought it home and weighed it. At the end of the year, he plotted the distribution of his measurements and showed that it fit a normal distribution with mean 950 g and standard deviation 50 g. He brought this evidence to the bread police, who gave the baker a warning.
For the next year, Poincaré continued the practice of weighing his bread every day. At the end of the year, he found that the average weight was 1,000 g, just as it should be, but again he complained to the bread police, and this time they fined the baker.
Why? Because the shape of the distribution was asymmetric. Unlike the normal distribution, it was skewed to the right, which is consistent with the hypothesis that the baker was still making 950 g loaves, but deliberately giving Poincaré the heavier ones.
Write a program that simulates a baker who chooses n
loaves from a distribution with mean 950 g and standard deviation 50 g, and gives the heaviest one to Poincaré. What value of n
yields a distribution with mean 1000 g? What is the standard deviation?
Compare this distribution to a normal distribution with the same mean and the same standard deviation. Is the difference in the shape of the distribution big enough to convince the bread police?
First, I'll make a function that simulates choosing n
loaves and giving Poincaré the heaviest.
Here's a sample from the distribution of bread weight if the baker chooses 5 loaves.
And here's how the observed mean depends on n
.
Looks like n=4
yields a measured mean close to 1000 g.
Here's a large sample of bread weights with n=4
so we can estimate the mean and standard deviation.
Now let's compare the distribution of the sample to the normal distribution with the same mean and std.
Visually they are almost indistinguishable, which makes it seem unlikely that Poincaré could really tell the difference, especially with only 365 observations.
But let's look more closely. First, let's simulate one year.
As a test statistic, we'll use the sample skew.
The null hypothesis is that the data come from a normal distribution with the observed mean and standard deviation.
Now we can generate fake data under the null hypothesis and compute the test statistic.
And we can estimate the distribution of the test statistic under the null hypothesis:
Here's the 95th percentile of the test statistic under the null hypothesis.
If Herni observes a skew above this threshold, he would conclude that it is statistically significant.
Let's see how often that would happen under the alternate hypothesis, that they baker is giving him the heaviest of 4 loaves.
Here's what the sampling distribution looks like for the skew Poincaré observes.
If Poincaré runs this experiment for a year, what is the chance he gets a statistically significant result?
This probability is the power of the test. In this example, it is 60-70%, which is not terrible. As a very general guideline, statisticians recommend designing experiments with a power of about 80%.
For how many days would Poincaré have to weigh his bread to get a power of 80%?