So, now this statistic is no longer a Z statistic,

because we're considering the alternative hypothesis, not the null hypothesis.

it, it's a normal of course, if, if the, if the data is Gaussian distributed.

And this is, of course, still normally distributed,

just with a different mean.

And if n is large, and we're applying the Central Limit

Theorem, then this is, again, not converging to a Z statistic.

So, what we need to do is convert it to a Z statistic.

So, the easiest thing to do would be to maybe add, subtract

the mean under the alternative, and we do that on this line here.

Then in the next line, we simply take the correctly, normalized mean, X bar minus

the mu under the alternative, which is what we are assuming to be true.

Divided by the standard air single, square root n, and now, we're calculating the

probability that, that is larger than Z1

minus alpha, minus this quantity over here.

mu a minus 30 over sigma over square root of N.

Now again, this standardized mean is a Z

statistic, because we're doing the calculation under the alternative.

So we want

the probability Z is larger than this quantity over here, which

we can perform this calculation, because we know Z1 minus alpha.

But we're assuming we know sigma.

We of course know n, and we know 30, of course.

so mu a is that only thing we have to plug in.

And that is the fact about power calculations,

is that you have to plug in the particular

value, the mean, that you're interested in.

Okay, so let's actually do a specific version of this calculation.

And suppose that we want to calculate the power of detecting an increase in the

mean RDI of at least two events per hour, above our null hypothesis of 30.

So we, we want to be, we want to calculate what's the

power if the, the alternative mean, the population av, the population

mean or Respiratory Disturbance Index is 32.

When our null hypothesis is that it's 30, and

we'd like to calculate the power of detecting that.

Now, again, under the assumption where the type one error rate is 5%.

So, again, assume normality and at the sample question

will have a standard deviation of four, events per hour.

What will be the power if we took a sample of size 16?

Okay, so, here are Z1 minus alpha is 1.645 are

mu a minus 30 over 4 over square root of 16, works out to be 2.

So, we want the probability that a standard normal is bigger than

1.645 minus 2, just the probability of standard normal is bigger

than negative 0.355 which is 64%. So, under these

set of assumptions the probability of detecting an alternative of

two events above the hypothesized value per hour is 64%.

And this is, of course, a bound if the, the power only

gets larger as the alternative goes away from 30 events per hour.

This is, this makes sense of course, right?

Because, the, the, the bigger the difference is from

the null, the easier it should be to detect, right?

If, if the true population mean is 100 events per hour, we

shouldn't, you know, we should have a high probability of detecting that.

A higher probability of detecting that than if the true mean is 30.01

events per hour which seems like it would be very hard to detect.

relative to 30,

because it's such a small change. so this power,

64%, is a bound for all values above 32. So

instead of calculating power given a sample

size a variance, and a value

of the alternative. We could flip the question

around and say, imagine we have a power that we'd

like to achieve for a particular value of the alternative.

What sample we, what sample size would we need to achieve it?

And this is called a sample size calculation.