interview question of hypothesis test: how many tests are needed to say a biased coin

56 Views Asked by At

Here is an interview question of hypothesis test:

When you observe 10% more heads than tail, how many times do you have to test to get the statistical significance to say coin is biased?

I don't much understand what I should test?

Does that mean we should test $H_0: p = 50\%,$ using number of head $X\sim N(np,np(1-p))?$ And calculate $n$ to make $$\dfrac{55\%n-np}{\sqrt{np(1-p)}}$$ match significant level? Here $55\% - 45\% = 10\%.$

1

There are 1 best solutions below

0
On BEST ANSWER

The answer depends on what level of significance is needed. However, we can certainly write an expression for the $p$-value for the test. The way the question is worded suggests that a normal approximation would be assumed, rather than an exact binomial test, thus the test statistic $$Z \mid H_0 = \frac{X - np}{\sqrt{np(1-p)}} = \frac{\frac{11n}{21} - \frac{n}{2}}{\sqrt{n/4}} = \frac{\sqrt{n}}{21} $$ is approximately standard normal. Note that $X$ counts the number of heads in $n$ trials, and since the number of heads is $10\%$ more than the number of tails, this implies $$\frac{X}{n-X} = 1 + \frac{1}{10}.$$

We reject $H_0 : p = 0.5$ in favor of $H_a : p \ne 0.5$ for a two-sided test at the $\alpha$ significance level if $$\Pr[Z > z_{\text{crit}} \mid H_0] < \alpha/2,$$ hence $z_{\text{crit}} = z_{\alpha/2}^*$, the upper $\alpha/2$ quantile of the standard normal distribution, with commonly used values as follows: $$\begin{array}{c|c} \alpha & z_{\alpha/2}^* \\ \hline 0.10 & 1.645 \\ 0.05 & 1.960 \\ 0.01 & 2.576 \end{array}$$

Thus, for a two-sided level $\alpha$ test, the required sample size to reject $H_0$ when there are $10\%$ more heads than tails, is $$n \ge \lceil (21 z_{\alpha/2}^*)^2 \rceil.$$ For the above commonly used values, this gives sample sizes as follows: $$\begin{array}{c|c|c} \alpha & z_{\alpha/2}^* & n \\ \hline 0.10 & 1.645 & 1194 \\ 0.05 & 1.960 & 1695\\ 0.01 & 2.576 & 2926 \end{array}$$ The $p$-value of the test is $$2 \Pr[Z > \tfrac{\sqrt{n}}{21}] = 2 \left(1 - \Phi(\tfrac{\sqrt{n}}{21}) \right).$$ This function is plotted below. enter image description here