# How is the sample size determined for a test?

In general, how is the required sample size derived for a specific power and a specific significance in a test rule?

1. Since the alternative hypothesis may not be simple and the power is a function of the sample's distribution, what does the specific power require? Is it the minimum power over the sample's distributions in the alternative hypothesis?

2. If the power function is continuous at the border between null and alternative hypotheses, no matter how many the sample size is, the minimum power over the sample's distributions in the alternative hypothesis is always the significance. So isn't it meaningless to find a sample size to achieve a specific power?

For example, for a t test for $\mu=0$ versus $\mu \neq 0$ with significance $\alpha = 0.05$, the power function is a continuous function of $\mu$ at $\mu=0$.

Thanks and regards!

In sample size requirement calculations the power is stipulated for a specific choice of alternative hypothesis, e.g. $\mu=2$ in your example. So you're looking at a single point on the power curve, not the whole function. The choice depends on what $\mu$ measures; the idea is that the sample size must be large enough to have a good chance of detecting effect sizes of practical/theoretical importance.