Power function

Outcomes of hypothesis testing:
$$H_O: \theta \in \Omega_0\text{ vs }H_A: \theta \in \Omega_1$$
$$\begin{matrix} \text{}& \text{} & \text{} & Decision & \text{} \\ \text{}& \text{} & \text{Accept } H_O & \text{} & \text{Reject }H_O\text{/Accept }H_A \\ \text{}& H_O & \checkmark & \text{} & \text{type I error} \\ Truth & \text{} & \text{} & \text{} &\text{}\\ \text{}& H_A & \text{type II error} & \text{} & \checkmark \end{matrix}$$

Let $W$ be a test statistics, and $R$ be the rejection region.

\underbrace{p(W\in R|\theta)}_{\text{probability reject } H_O \text{ as a function of }\theta} = \left\lbrace \begin{aligned} \text{probability type I error, if }\theta \in \Omega_O \\ \text{probability type II error, if }\theta \in \Omega_A \\ \end{aligned} \right.

Definition: Given test statistics $W$ and rejection region $R$, the power function is $pow(\theta)=p(W\in R|\theta)$, So $\begin{matrix}\text{if }\theta \in \Omega_O, \text{then ideally } pow(\theta) \text{ is close to } 0 \ \text{if }\theta \in \Omega_A, \text{then ideally } pow(\theta) \text{ is close to } 1 \end{matrix}$

E.X. Let $X\sim Bin(5,p). H_O:p\leq 0.5 \text{ vs } H_A:p>0.5$. Test statistcs: $W = X$. Derive $pow(p)$ for 2 cases:
(a) $R = \lbrace W=5\rbrace$; (b) $R = \lbrace W\geq 4\rbrace$
Ans:
(a) $$\begin{matrix}\begin{split}pow(p) &= P(W=5|p) \\ &= p^5 \end{split}\end{matrix}$$
(b) $$\begin{matrix}\begin{split}pow(p) &= P(W\geq 4|p) \\ & = P(W=4) + P(W=5) \\ & = {5 \choose 4}p^4(1-p)+p^5 \end{split}\end{matrix}$$

Rule(a) has smaller probability type I error if $p\leq 0.5$.
Rule(b) has smaller probability type II error if $p>0.5$

What is the probability of type I error if $p=0.6$?
Rule(a): $1-0.6^5 = 0.922$
Rule(b): $1-[{5 \choose 4}0.6^40.4+0.6^5] = 0.663$

What is the level $\alpha$ of the two rules?
Recall $\alpha = \max \limits_{\theta \in \Omega_0}p(W\in R|\theta)= \max \limits_{\theta \in \Omega_0} pow(\theta)$
Ans:
(a) $0.5^5 = 0.03125$
(b) ${5 \choose 4}0.5^5+0.5^5 = 0.1875$

If you like my article, please feel free to donate!