# Missing something in this Hypothesis Test question

An urn contains marbles that are either red or blue. To test the null hypothesis of equal proportions of these colors, we agree to sample 64 marbles with replacement, noting the colors drawn, and to adopt the following decision rule:

Accept the null hypothesis if $28 \leq X \leq 36$, where X is the number of red marbles in the 64.

Reject the null hypothesis if $X<27$ or if $X>37$.

(a) Find the probability of rejecting the null hypothesis when it is correct. (b) Graph the decision rule and the result obtained in part (a).

I calculated the probability of $28 \leq X \leq 36$ is $(28-32)/4< Z <(36-32)/4$. That Z-value is, obviously, Z from -1 to 1, which is 0.6826, so the probability required on (a), the p-value = 1 - 0.6826 = 0.3174. But the given correct answer is 0.2604?

• Do not use normal approximation. Use Binomial distribution directly to get the best answer. – user158565 Jun 11 '17 at 1:42
• Textbooks commonly say that for large samples (N >= 30), you can safely use the Normal distribution to approximate. Even if the answers aren't perfectly identical, the difference surely wouldn't be that big, i guess. – Victor S. Jun 11 '17 at 1:58
• @Victor Some textbooks might give such a blanket rule, but it would be a bad textbook that would tell you to do that in this situation. It could be a very bad rule in a binomial with a smaller $p$ (e.g. with a test of whether there were 5% red balls). For binomials most textbooks have a rule something similar to $np>5$ and $n(1-p)>5$ or $np(1-p)>9$ or some such (however, your problem would pass most of those tests as well) – Glen_b -Reinstate Monica Jun 11 '17 at 2:46

The answer appears to have been based on an exact binomial calculation rather than a normal approximation:

The binomial calculation matches the answer.

The ordinary normal approximation is fairly poor here (about 20% out), as you can see in your question (the correct value using a normal approximation is $0.3173$ to 4dp, the difference in the last place being due to tables producing rounding at an earlier step). It's considerably better with a continuity correction (which is nearly always a good idea in the $p=\frac12$ case), which gives $0.2606$ to 4d.p. (the following done in R):

> 1-(pnorm(36.5,32,4)-pnorm(27.5,32,4))
[1] 0.260589


but since it's actually no harder to do the exact binomial calculation with a computer, why would you do anything else?

> 1-(pbinom(36,64,.5)-pbinom(27,64,0.5))
[1] 0.2604355


There are few situations in which I couldn't calculate almost the exact binomial almost as quickly as the normal approximation (note that even by hand if we use symmetry there's only 5 distinct probabilities to calculate, each is a simple modification of the previous one, and the denominator is the same for each) -- for "hand" calculation the required probability is:

$\frac{64 \choose 32}{ 2^{64}} \cdot(1 + 2 (\frac{32}{33} (1+\frac{31}{34}(1+\frac{30}{35}(1+\frac{29}{36})))))$

Most calculators can manage this calculation and give you the correct answer to as many figures as needed. However, if your calculator won't do that one you can use say Stirling's approximation (though you can do better!) on the first term and perform a lot of cancellation before reaching for a calculator. If you just use the plain Stirling approximation you get:

$\frac{64 \choose 32}{ 2^{64}} \cdot(1 + 2 (\frac{32}{33} (1+\frac{31}{34}(1+\frac{30}{35}(1+\frac{29}{36})))))\\ \approx \frac{1}{\sqrt{32\pi}} \cdot(1 + 2 (\frac{32}{33} (1+\frac{31}{34}(1+\frac{30}{35}(1+\frac{29}{36}))))) = 0.7425$

which by subtraction then yields an approximate tail probability with about 1.1% error (worse than the continuity correction, but needing no tables at all). If you try the fairly simply modification in Gosper's approximation (see near the end of the page) then that calculation just above is multiplied by $\frac{\sqrt{64+\frac16}}{(8+\frac{1}{48})}$ which gives a tail area that comes out to be exact to 4 d.p. (Wikipedia offers a variety of approximations suitable for a calculator but Gosper's is easy to remember; it's a pity they don't include it there).

• Your demonstration showed that really I had forgotten about the continuity correction, thank you. And yes it's better to use the binomial. – Victor S. Jun 11 '17 at 3:27