A coin is tossed $40$ times. Define $T$ as the number of tails.
i) Define the region of rejection by $|T-20|\geq5.$ Calculate $\alpha,$ the significance level ---
$\displaystyle\alpha = P(y\leq15 \lor y\geq25)= 1- P(16 \leq y\leq24) = 1-\sum_{T=16}^{24}{{40\choose{T}}\left(\frac{1}{2}\right)^T\left(\frac{1}{2}\right)^{40-T}} \approx 0.154.$
ii) Let $T=26.$ Compute the p-value. ---
We have $\displaystyle \frac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}} = \frac{\frac{26}{40}-0.5}{\sqrt{\frac{0.5(1-0.5)}{40}}} \approx 1.897.$ We have $H_0: p = 0.5$ and $H_a: p \neq 0.5,$ since we are testing whether it is fair or not (the side it favors doesn't matter). Hence, the p-value is $2(\phi(1.897))=0.9426.$ This also entails, using the former significance level, that we fail to reject the null.
iii) Calculate $\beta,$ the probability of a type II error for $H_0: p=0.5$ and $H_a: p = 0.6.$ ---
We have $\displaystyle z = \frac{\phi^{-1}(0.5,\sqrt{\frac{0.5(1-0.5)}{40}}, 0.846) - 0.6}{\sqrt{\frac{0.5(1-0.5)}{40}}} \approx \frac{0.581-0.6}{0.079057}\approx 0.240333,$ where $\phi^{-1}$ is the inverse normal function, with parameters $\mu, s, $ and $p$ (probability), respectively. The area to the right of this is $0.405,$ which is $\beta.$
This is a homework problem that I'm a little unsure on. Specifically, I don't fully understand how to calculate the p-value for proportions in this two-tailed scenario. Also, I'm not sure if I correctly calculated $\beta.$ I don't know whether one must take into account the fact that it's (presumably) a two-tailed test. Any pointers/guidance would be greatly appreciated.