I have the following problem:

I have $X_1 ... X_n$ ~ Bernoulli(p) independent. I also have the following test hypothesis: $H_0: p = p_0$ and $H_1: p > p_0$. I define my test as follows:

$T:$ I refuse $H_0$ in favour of $P_1$ if the number of successes is very high.

Now suppose $p_0 = 0.6$ and $n = 20$, we find that we have 18 successes.

I want to find the p-value of the test.

Now this is what I have done:

$p-value = \mathbb{P}(\sum x_i \geq 18)$ = 0.0005240494 However confronting it with the command:


It is not right (by a factor of 10). My problem is that I am not able to correctly asses what the "number of succession is very high". How do I work around this?

  • $\begingroup$ What is the confidence level and significance level, respectively? Maybe 0.95 and 1-0.95=0.05? $\endgroup$ – callculus Jan 17 at 21:19
  • 1
    $\begingroup$ I don't have that information. I don't think is needed as the purpose of the p-value is to work without one, from my understanding. $\endgroup$ – qcc101 Jan 17 at 21:56
  • 1
    $\begingroup$ $\mathbb{P}(\sum X_i \geq 18)=0.0036$ $\endgroup$ – d.k.o. Jan 17 at 23:27
  • $\begingroup$ @d.k.o. I see, maybe I messed up my calculation. Still, is this the right way to do it? $\endgroup$ – qcc101 Jan 18 at 9:35
  • $\begingroup$ Yes this is the correct way to do it $\endgroup$ – Alex Jan 22 at 7:12

Letting $K=\sum_i \mathbb{I}(X_i = 1)$ be the number of successes, you have $K \sim \text{Bin}(n,p)$. Thus, your p-value is:

$$\begin{equation} \begin{aligned} p \equiv p(k) &\equiv \mathbb{P}( K \geqslant k | H_0) \\[6pt] &= \mathbb{P}( K \geqslant k | K \sim \text{Bin}(n,p_0)) \\[6pt] &= \sum_{r=k}^n \text{Bin}(r|n,p_0). \\[6pt] \end{aligned} \end{equation}$$

With $p_0=0.6$, $n=20$ and $k=18$ you get the p-value:

$$p = \sum_{r=18}^{20} \text{Bin}(r|20, 0.6) = 0.003611472.$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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