# How to do you find a power of a test of two means?

I am struggling with the following question

Suppose we have randomly assigned 50 patients to the new treatment group and the other 50 patients to the conventional treatment group. Assuming both distributions follow normal distribution, with means µ1 and µ2, respectively, with standard deviations of the two groups are assumed to be 1.

The researcher expects to see a difference in the means ∆ = µ1 − µ2 = 0.6. She plans to employ a simple one-sided test for the two groups comparison at the significance level α = 0.05. What is the power of detecting such a difference based on the sample she has?

I know the power is probability of rejecting the null hypothesis if the null hypothesis is false But I am not sure how to proceed at all from here? How do we know any probability here. Any help to get me started is much appreciated

This can actually be framed as a linear regression, so let's use a power formula found in this book.

The power to detect an effect of $$\beta$$ is

$$\gamma = 1 - \Phi(z_{1-\alpha/2} - \vert \beta \vert\sigma_x\sqrt{n}\sigma_{y \vert x})$$

Here

• $$\Phi$$ is the CDF of the standard normal.

• $$z_{1-\alpha/2} \approx 1.96$$ if we are using the standard false positive rate

• $$\beta=0.6$$ as per your question

• $$\sigma_x=\sqrt{0.5^2} = 0.5$$. This is because the groups are evenly split.

• $$\sigma_{y\vert x}=1$$ is standard deviation of the outcome.

• $$n=100$$ as per your question

Plugging this all in R, it looks like there is about 85% percent power to detect an effect as small as 0.6.

You can also use simulation to verify the results

library(purrr)
library(tidyverse)

set.seed(0)
sim<-function(){
x = rnorm(50,0.6,1)
y = rnorm(50,0,1)

return(t.test(x,y, equal.var = T)$p.value<0.05) } rerun(10000,sim()) %>% unlist %>% mean  Looks like we correctly reject the null about 84.9% of the time according to this simulation, which is exactly what we would expect (up to random error). Power is computed as follows: Step 1: Figure out your rejection rule under the null. Step 2: Identify the distribution of the test statistic under the specific alternative. Step 3. Find the probability of being in the rejection region defined in (1), given the distribution in (2). - I assume you don't need any help with step 1. - Since the population standard deviations are assumed known (and equal to 1) you should be able to write the distribution of the test statistic (for a z-test) when the means differ by 0.6. That is, step 2 doesn't require much effort. - Once step 2 has been accomplished, I assume you don't need any help with step 3. • Thanks! I'm new to statistics so just a quick question how do you write the Null in a problem like this is it$\mu_1-\mu_2<0.6\$? Sep 5, 2019 at 2:43
• No. That 0.6 will be the expected effect size under the alternative. What is the null going to be in a typical test of means? If you're comparing a new treatment to an existing standard treatment, what's a typical sort of thing you need to find out? Sep 5, 2019 at 4:06