# Hypothesis testing - Calculating $a$ and $b$

Exercise :

Let $$p$$ be the probability of having Heads during a coin toss. For the hypothesis testing $$H_0 : p = 0.5$$ against the alternative $$H_1 : p > 0.5$$ we count the number of independent trials $$X$$ needed until having Heads for the first time. If the critical region of the test is $$K = \{ X > 3 \}$$, then :

i) Calculate the importance level $$a$$ of the test given.

ii) Calculate the probability of the type II error for the test above, if $$p=0.7$$.

Attempt :

Since we are interested for an experiment regarding trials until a first success, we have a Geometric Distribution. Thus :

$$\mathbb{P}(X=k) = (1-p)^{k-1}p$$

For part (i), we have :

$$a = \mathbb{P}(\text{Reject} \; H_0|H_0) = \mathbb{P}(X>3|p=0.5)=1-\mathbb{P}(X\leq 3 | p=0.5)$$ $$=$$ $$1-\mathbb{P}(X=3|p=0.5)=1-\sum_{i=1}^3 (1-0.5)^{i-1}\cdot 0.5$$

For part (ii), we have :

$$\text{Type II Error}=\mathbb{P}(\text{Accept} \; H_0|H_1) = \mathbb{P}(X\leq3|p=0.7)$$ $$=$$ $$\sum_{i=1}^3(1-0.7)^{i-1}\cdot 0.7$$

Question : Is my reasoning and my solution correct ? I am worried a bit about the probability calculating part.

• The critical region looks more suitable for an alternative hypothesis that $H_1 : p \lt 0.5$ if $p$ is the probability of heads – Henry Jun 6 '18 at 23:55

"a" is significance not importance although in this case they mean the same thing :) Ok, the actual probability of rejecting the null given it's a fair coin is getting 4 tails which is $0.5^4 = .0625$.
Are you sure you have stated the question correctly? This test is set up to make a type II error an almost certain outcome. For a type II error, this would result in getting a head in 4 flips $= 0.7 + 0.7\cdot 0.3 + 0.7\cdot 0.3^2 + 0.7\cdot 0.3^3 = .9919$.
• Hi and thanks for your answer. Well, regarding $a$, I think you are mistaken. The number of trials is represented by $X$. Now, the critical region is the region of $\mathbb{R}^n$ for which we reject the $H_0$. Truly, for $X=4$ we would reject the $H_0$ but we would also reject it for any other $X>3$. Thus, I think that $a$ isn't simply the $\mathbb{P} = 4$ but generally $\mathbb{P}(X>3|p=0.5)$ as described in my solution and found by the geometric distribution samle (it's still a small number). For type II error, I think you have to sum up until $X=3$ and not $X=4$. – Rebellos Jun 7 '18 at 7:00