2
$\begingroup$

I was watching a lecture earlier by Marcus du Sautoy called: 'Thinking Better with Mathematics.'

Marcus discusses the statistical sample sizes to verify statements about the population. In his own example, he addresses a statement about cat food.

In particular, a cat food brand in the 1970s/80s argued that "8 out of 10 cats preferred this cat food."

The population size (in the UK) at that time was 7 million. But to verify this statement, only a relatively small sample of 246 would be required.

The statement from that video is: For a population of 7 million cats, if we sample 246 cats, then 19 out of 20 times the sample is within 5% of the true value.

I wondered if someone could derive this, given the the limited information? Or if not, provide a link/direction on this type of information.

The video lecture with the information is here at 13:30 to 15:20 mins. https://www.youtube.com/watch?v=4PlmsnyWXMw

$\endgroup$
7
  • 2
    $\begingroup$ The aprx. margin of error for a Wald 95% CI is $E = 1.96\sqrt{p(1-p)/n}, $ Longest when $p = 1/2.$ Maybe in your case, it is adequate to choose $E$ and $p,$ then solve for $n.$ $\endgroup$
    – BruceET
    Commented Apr 5, 2022 at 15:26
  • 4
    $\begingroup$ You could verify this statement, at least to some degree, with a random sample of a single cat: but that wouldn't satisfy most people. Thus, your question is unanswerable without some indication of (1) just how strong should the evidence needs to be and (2) whether "verification" means "is sufficiently consistent with the assertion" or "the assertion is highly likely to be true or an underestimate of the preferences." The general problem of estimating sample sizes is part of experimental design and specifically involves power analysis, q.v. $\endgroup$
    – whuber
    Commented Apr 5, 2022 at 16:13
  • $\begingroup$ @whuber the question is valid. I have added the statement from that video in the question. However, it is not explained/computed in that video and that is what EB3112 is wondering about. $\endgroup$ Commented Apr 5, 2022 at 18:00
  • $\begingroup$ @Sextus The only way one can determine what the question might possibly be trying to ask requires readers to view that video. As you well know, we need questions to stand on their own. $\endgroup$
    – whuber
    Commented Apr 5, 2022 at 21:49
  • $\begingroup$ See en.wikipedia.org/wiki/Binomial_proportion_confidence_interval and en.wikipedia.org/wiki/Margin_of_error $\endgroup$
    – Glen_b
    Commented Apr 6, 2022 at 2:04

2 Answers 2

2
$\begingroup$

Because the variance of a binomial distribution depends on the success probability $p,$ one must be specific about the null and alternative values of $p$ in order to find the power of an exact binomial test of $H_0: p = p_0$ against $H_a: p = p_a.$

One experiment:

Suppose you have $p_0 = 0.4, p_a = 0.5, n = 246.$ For one performance of the experiment, we reject $H_0$ at the 0.2% level of significance. Exact binomial test in R:

set.seed(2021)
x = rbinom(1, 246, .5); x
x/246
[1] 0.5

binom.test(x, 246, p=.4)

   Exact binomial test

data:  x and 246
number of successes = 123, number of trials = 246, p-value = 0.001731
alternative hypothesis: 
true probability of success is not equal to 0.4
95 percent confidence interval:
     0.4358163 0.5641837
sample estimates:
 probability of success 
     0.5 

Simulated power:

To approximate the power of the test, we look at the proportion of rejections among 100,000 performances of the experiment. The power is about 89%.

n = 246; p.0 = .4; p.a = .5
set.seed(405)
pv = replicate(10^5, binom.test(rbinom(1,n,p.a), n, p=p.0)$p.val)
mean(pv <+ .05)
[1] 0.8863

However, $n = 246$ would give power about 96% distinguishing between $p_0 = 0.8$ and $p_a = 0.7,$ because binomial distributions have less variability for these relatively large success probabilities (or for relatively small ones).

n = 246; p.0 = .8; p.a = .7
set.seed(406)
pv = replicate(10^5, binom.test(rbinom(1,n,p.a), n, p=p.0)$p.val)
mean(pv <+ .05)
[1] 0.95787

Note: Various statistical software programs have 'power and sample size' procedures. Here is output from a recent release of Minitab, to find the sample sizes required to get 95% power for $p_0 = 0.8, p_a = 0.75$ and for $p_0 = 0.8, p_a = 0.75,$ for tests that use normal approximations to binomial distributions. (Of course somewhat larger samples are required for 96% power as in my simulation.)

Power and Sample Size 

Test for One Proportion

Testing p = 0.8 (versus < 0.8)
    α = 0.05

                  Sample  Target
    Comparison p    Size   Power  Actual Power
            0.75     751    0.95      0.950008
            0.70     200    0.95      0.950561

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ @Thank you BruceET. Very helpful. I genuinely appreciate seeing the code and procedures. Thank you for your time. $\endgroup$
    – EB3112
    Commented Apr 5, 2022 at 22:13
1
$\begingroup$

I could not verify the statement

For a population of 7 million cats, if we sample 246 cats, then 19 out of 20 times the sample is within 5% of the true value.

Trying to reverse engineer what they might have done, we could have

$$\frac{0.8}{\sqrt{246}} \approx 0.05$$

But that expression makes no sense.

Another potential derivation, mentioned by Whuber in the comments, could be based on a z-test but with a minor mistake.

$$ Z_{\alpha/2} \cdot \sigma_X = 0.05 \cdot \mu_X $$

Filling in the variance $\sigma_X = \sqrt(np(1-p)$ and mean $\mu_X = pn$ of the binomial distribution gives an answer close to the computation below. But if one fills in $\mu_X = n$, then the result will be $n \approx 246$. That is however an erroneous computation.


Say, the true probability is 0.8 and you sample 246, then the outcome of your experiment will be binomial distributed (given that you performed the experiment well like sampling independently and without bias as mentioned in the video).

Below is a plot how this distribution looks like and what the probability is to be 5% of the true value.

computation of 5% boundaries and probabilities

So, if the true value would be 80% then there is a 11.09 % probability that the observed percentage in the sample would be more than 5% away from the true value.


Note that this is only one way to make the computation. The computation of the interval that contains the true value 95% of the time (19 out of 20 cases), also known as a confidence interval can be done in different ways (by using different approaches or viewpoints). For the estimate of a percentage/proportion, the different ways are summarized on this Wikipedia page: https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval

But in any case, the number of 246 seems too low (although it is not a large difference, with the method that created the image the correct size would be $n=367$).


R-code to make the figure:

### settings
n = 246
#n = 367
p = 0.8
q = 1-p
x = 0:n

### plot binomial distribution
plot(x,dbinom(x,n,p), xlim = c(n*0.6,n), 
     pch = 21, col = 1, bg = 1, cex = 0.7, ylim = c(0,0.1),
     ylab = "P(X = x)", xlab = "x", main = "distribution for number of cats that like Whiskas \n among sample of size 246 \n If true percentage would be 80%")

### add upper and lower 5% boundaries
upper = n*p*1.05
lower = n*p*0.95
lines(upper * c(1,1), c(0,1), lty = 2)
lines(lower * c(1,1), c(0,1), lty = 2)
text(upper, 0.03, "5% above true vale", pos = 4, srt = 90, cex = 0.8)
text(lower, 0.03, "5% below true vale", pos = 2, srt = -90, cex = 0.8)


### compute percentages and add to plot
x3 = round((1-pbinom(upper, n, p))*100,2)
x1 = round((pbinom(lower, n, p))*100,2)
x2 = round(100 - (1-pbinom(upper, n, p))*100 - (pbinom(lower, n, p))*100,2)

text(n*p, 0.1, paste0(x2, " %"))
text(n*p*1.1, 0.1, paste0(x3, " %"))
text(n*p*0.9, 0.1, paste0(x1, " %"))
$\endgroup$
5
  • $\begingroup$ @Thank you Sextus Empiricus. Really appreciate your time and feedback here. Genuinely appreciated :) $\endgroup$
    – EB3112
    Commented Apr 5, 2022 at 22:10
  • $\begingroup$ This answer errs at the outset, because the intended (although still incorrect!) equation is $$Z_{\alpha/2} \sqrt{np(1-p)} = \epsilon n$$ for $\alpha=1-0.95,$ $p=0.8,$ and $\epsilon = 0.05.$ Its solution is $$n = \left(\frac{Z_{0.025}}{0.05/2}\right)^2(0.2)(0.8) \approx 245.85,$$ which was rounded up: that's the reverse engineering. The claim, though, is erroneous in its incorrect logic: one must allow $p$ to vary, because it is unknown; and the possibility that $p$ is closer to $1/2$ than $0.8$ will cause the sample size $n$ to increase. $\endgroup$
    – whuber
    Commented Jun 8 at 12:52
  • $\begingroup$ @whuber I will revise my answer but I didn't intend to say that my reverse engineering to be correct, I just noticed that this number 0.05 or 19 out of 20 is equal to 0.8/sqrt(246). What I eventually did was re-computing this 19 out of 20 in the statement "For a population of 7 million cats, if we sample 246 cats, then 19 out of 20 times the sample is within 5% of the true value." and I found that it is different. $\endgroup$ Commented Jun 8 at 13:10
  • $\begingroup$ @whuber It should have been $$Z_{\alpha/2} \sqrt{np(1-p)} = \epsilon np$$ the right hand sight is $\epsilon = 5\%$ times the expected value $np$ and not the sample size $n$. $\endgroup$ Commented Jun 8 at 13:19
  • $\begingroup$ If you divide the 246 by 0.8^2, then you get close to the value that I computed. $\endgroup$ Commented Jun 8 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.