# Power of a hypothesis test

Please help! I am stuck at part (b)! Im not sure how to calculate the type 2 error..

To test the effectiveness of a diet, a random sample of 16 female patients is drawn from a population of adult females using the diet. The weight of each individual in the sample is taken at the start and at the end of the diet. Assume that the population of differences in weight before and after the diet follows a normal distribution. Suppose the mean decrease in weights over all 16 subjects in the study is 4.0 pounds. Assume the true standard deviation of differences computed as 6.4 pounds. Let $\mu_x −\mu_y$ equal the mean weight before the diet minutes the mean weight after the diet.

(a) Test the null hypothesis at the five-percent level that the diet is ineffective against the alternate hypothesis that it helped patients lose weight. Report the null and alternative hypothesis, the decision rule, and the appropriate test statistic.

(b) A large-scale study conducted one year later finds that diet works, but its true effect, on average, is minor. The average difference overall is a one-pound weight loss, with a standard deviation of 1.2. What was the power of our test from part (a)?

(c) Suppose we wanted to conduct a new study of the same diet, but we want to conduct our sample only with men. Assume that the true difference is the same for men and women - on average, it leads to a one-pound weight loss, with standard deviation of 1.2 pounds. What is the minimum sample size that we would need to obtain $80$% power?

$H_0$: $\mu_x −\mu_y < 4$
$H_1$: $\mu_x −\mu_y > 4$

Reject $H_0$ if $t > 2.131$

Since $t = 2.5$, reject $H_0$

Am i correct so far?? Thanks

Notations: $Z$ denote the standard normal variable $z_{\alpha}$ denote the $\alpha$-th quantile of $Z$.
At first it is given that true s.d. is 6.4, then in part (b) it is said true s.d. is 1.2. So I wonder whether in first case you mean the sample standard deviation is $6.4$.
a) The diet is ineffective means the true means of weight before and after the diet better be equal. Therefore we wish to test $$H_0:\mu_x=\mu_y \ \ \mbox{against} \ \ H_1: \mu_x>\mu_y$$
Let $X_1,X_2,\ldots,X_{16}$ be the observed difference (before-after) of weights. $\bar{X}$ gives a good idea about the true difference. So we will reject the null if $\bar{X}>c$ for some $c$. Let $\mu=\mu_x-\mu_y$. We have $X_i \stackrel{\mbox{i.i.d.}}{\sim} \mathcal{N}(\mu,\sigma^2)$ where $\sigma=6.4$ This implies $\displaystyle \frac{4(\bar{X}-\mu)}{\sigma}\sim \mathcal{N}(0,1)$. Now for 5% significance level, $c$ should satisfy $$P_{H_0}(\bar{X}>c)=0.05 \implies P_{H_0}(Z\le \frac{4c}{\sigma})=0.95 \implies c=1.6\cdot z_{0.95}\approx 2.63$$ Where $P_{H_0}$ denote the probability when null is true. Therefore we will reject the null if $\bar{X} > 2.63$, which clearly happens in this case.
b) Now here if the true s.d is changed, then the critical region will also change to $\bar{X}>c'$. So it does not make sense to calculate the power of the test $\bar{X}>2.63$ of part (a). However, it is still mathematically possible. Now you know that true $\mu$ is $1$. So, now $\frac1{1.6}(\bar{X}-1) \sim \mathcal{N}(0,1)$. Hence power of the test is given by $$P(\bar{X}>2.63)=P(Z>\frac1{1.6}(2.63-1)) \approx P(Z>1.02)\approx 0.15$$
For (c) just redo (a) and (b) with certain changes. Start with $n$ observations. Here $\sigma=1.2$. Obtain $c$ in terms of $n$. Then calculate the power.