# Help calculating the power function at a point $\mu=0.5$ for the normal distribution

For some reason, I've been stuck on this question, even though other questions of this type weren't that much of a problem to me before (with for instance the binomial distribution). The situation is as follows:

Suppose $$X_1...X_{25}$$ is a sample from an $$N(\mu,2^2)$$-distribution. We would like to test for $$H_0: \mu\leq 0$$; $$H_1:\mu>0$$, with significance $$a_o=0.05$$.

Calculate the power function of this test at the point $$\mu=0.5$$.

My approach:

Earlier in this problem I had to calculate the critical values and found the following: $$K_T = \{T\in \mathbb{R}:T\geq 1.64\}$$} and $$K=\{\mu\in\mathbb{R}:\mu\geq0.656\}$$} where $$T=\sqrt{n}\frac{\mu-\mu_0}{\sigma}$$

For $$H_0$$ we use $$\mu_0=0$$ and find (with a table or calculator) these values for $$c$$ in $$P(T\geq c)\leq0.05$$.

Now we have to use $$\mu_0=0.5$$. Given this information, we have to calculate $$P_{0.5}(X\in K)$$ which is the power function. I thought of two things, but they both give me wrong answers.

First I tried to just calculate $$P(T\in K_T$$) given $$\mu=0.5$$, but I stumbled upon a problem; I didn't seem to have used the fact that $$\mu=0$$ in my calculation for the critical values for $$K_T$$. I just chose $$T=\sqrt{n}\frac{\mu-\mu_0}{\sigma} =\frac{5}{2}\mu$$ and said that $$T\sim N(0,1)$$ and proceeded to use the table. Only for $$K$$ I used that $$T=\frac{5}{2}\mu\geq1.64 \iff \mu\geq0.656$$. (so here we used $$\mu_0=0\implies T=\frac{5}{2}\mu$$)

So, changing to $$\mu_o=0.5$$ didn't really give me anything in this calculation, if I would just put it in there I would get that $$P(T\in K_T)=0.05=a_0$$ again.

Then I tried to calculate $$P(X\in K)=P(N(0.5,2^2)\geq1.64)=$$ $$P(4N(0,1)+0.5\geq1.64)=P(N(0,1)\geq 0.285)=0.39$$

This comes closer, but the correction model says it's $$0.34$$. I did find, that $$P(N(0,1)\geq a)=0.34$$ for $$a=0.41$$ which is $$1.64/4$$, the original critical value divided by $$4$$.

I really feel like I'm missing a (relatively simple) key element of the way to approach this problem. Any corrections, tips, hints or explanations are highly appreciated!

Under $$H_o$$, find the critical value (C) for $$\bar X$$, which is $$\Pr(\bar X > C) =\Pr(\frac {\bar X}{2/5}>\frac C{2/5}) = 0.05$$ We have $$\frac C{2/5} = 1.64$$, so $$C= 1.64\times \frac 25=0.656$$. You did it correctly.

Then think about if $$H_a: \mu = 0.5$$ is true, $$\bar X \sim N\left(0.5, \frac {2^2}{25}\right)$$.

The Probability of $$\bar X>0.656$$, which is power. is

$$\Pr(\bar X >0.656) = \Pr(\frac{\bar X -0.5}{2/5}>\frac {0.656-0.5}{2/5})$$ It equals $$Z = (0.656 - 0.5) \times 5/2 = 0.39$$

From standard normal distribution, $$\Pr(Z>0.39) = 0.3483$$

Comment: The power computation in the Answer by @a_statistician is correct (+1) for $$n=25, \alpha= .05, \sigma = 2,$$ and $$\Delta = \mu_a - \mu_0 = 0.5$$ (one-sided alternative).

Because the power for these parameters seems lower than is usually considered desirable, I show power functions from Minitab software that illustrate what is required for larger power values. I use both $$n = 25$$ (lower curve) and $$n = 150$$ (upper).

Power and Sample Size

1-Sample Z Test

Testing mean = null (versus > null)
Calculating power for mean = null + difference
α = 0.05  Assumed standard deviation = 2

Sample
Difference    Size     Power
0.5      25  0.346475
0.5     150  0.921760


From the upper curve we see that the power increases from about 0.35 to about 0.92 if we increase $$n$$ from 25 to 150. Alternatively, from the lower curve we see that with $$n = 25$$ the power against the alternative $$\mu_a = 1.2$$ is about 0.9.

Notes: (a) The slight difference between power 0.3465 and 0.3483 seems to be because of rounding necessary to use a printed standard normal table.

(b) To be fussy, the vertical axis might be labeled "P(Reject)" instead of "Power": Except for one point, the points on the curve are power, that is, $$P(\text{Reject } H_0 | \mu_a).$$ The exception is that the left-most point shows the significance level, $$\alpha = P(\text{Reject } H_0 | \mu_0 = 0).$$

(c) Many statistical software programs include procedures for making power curves. R has a library devoted to power curves.

(d) Some textbooks give a formula for the power of such a (one-sided) z-test: $$\pi(\mu_a) = P\left(Z > z_{\alpha} - \frac{|\mu_0-\mu_a|}{\sigma/\sqrt{n}}\right).$$ The Answer by @a_statistician can be used as a template for a proof of this formula. With a slight change in notation, I copied it from Ott & Longnecker, 5e, Chapter 5. It is the basis for making power curves such as the one above. In R, the specific computation in your Question is as follows:

1 - pnorm(qnorm(.95) - .5/(2/5))
[1] 0.3464755