Why Derive Sample Size From Power?
A study planned around a mean difference needs enough observations to make that difference detectable with a chosen probability. The required number depends on the direction and size of the effect the study is designed to detect, the variability of individual observations, the significance level, and the target power. Deriving the sample-size formula makes those connections explicit and shows exactly why the final answer must be rounded up.
This tutorial considers a one-sided upper-tail z test for a population mean when the population standard deviation is known. The goal is to find the smallest whole-number sample size that gives at least a specified power at a particular alternative mean. The result is conditional on the model and planning values; it is not a guarantee that a future study will observe a significant result.
Model and Power Condition
Independence and the specified distributional model justify the standard error \(\sigma/\sqrt{n}\) and the normal distribution used in the calculation. In some settings, a normal approximation for \(\bar{x}\) may be used instead of an exactly normal population, but that approximation must be reasonable for the planned sample size and population. The formula below treats \(\sigma\), \(\alpha\), and \(\delta\) as known planning inputs.
Write \(z_{1-\alpha}\) for the standard normal quantile with cumulative probability \(1-\alpha\), and \(z_{1-\beta}\) for the quantile with cumulative probability \(1-\beta\), where \(1-\beta\) is the target power. The upper-tail test rejects when its standardized statistic exceeds \(z_{1-\alpha}\):
At the planned alternative \(\mu_1=\mu_0+\delta\), the sample mean has distribution \(N(\mu_0+\delta,\sigma^2/n)\). Power is the probability of rejection when this alternative is true. Thus, it is the probability that the sample mean exceeds the rejection threshold, calculated under the alternative rather than under the null.
Deriving the Sample-Size Formula
The rejection condition can be written as a condition on \(\bar{x}\). Because \(\sigma/\sqrt{n}\) is positive, rearranging the inequality does not reverse its direction. The following steps use the normal model at the specified alternative.
\(Z>z_{1-\alpha}\) is equivalent to \(\bar{x}>\mu_0+z_{1-\alpha}\sigma/\sqrt{n}\).
When \(\mu=\mu_0+\delta\), standardizing the threshold using the alternative distribution gives power \(\Phi(\delta\sqrt{n}/\sigma-z_{1-\alpha})\), where \(\Phi\) is the standard normal cumulative distribution function.
Set \(\Phi(\delta\sqrt{n}/\sigma-z_{1-\alpha})\geq 1-\beta\). Since \(\Phi\) is increasing, applying its inverse gives \(\delta\sqrt{n}/\sigma-z_{1-\alpha}\geq z_{1-\beta}\).
For \(\delta>0\), \(\sigma>0\), and a target power greater than \(\alpha\), the right-hand side \(z_{1-\alpha}+z_{1-\beta}\) is positive. Squaring after isolating \(\sqrt{n}\) gives the sample-size threshold.
This derivation shows why the formula is specific to the stated test and alternative. The critical value \(z_{1-\alpha}\) comes from the upper-tail rejection rule. The quantile \(z_{1-\beta}\) comes from requiring power \(1-\beta\) at the planned alternative. The difference \(\delta\) is the distance from the null boundary \(\mu_0\) to that alternative mean, not the standard deviation of the sample mean.
Worked Example: A Target Power of 90 Percent
Suppose a hypothetical test compares a population mean with \(\mu_0=50\) units using an upper-tail z test. The known population standard deviation is \(\sigma=10\) units. The study must have 90% power to detect a mean of 54 units, using \(\alpha=0.05\). Find the minimum sample size.
The model assumes independent normally distributed observations with known \(\sigma=10\) units. The specified direction is appropriate for the planned alternative \(54>50\), and the relevant difference is \(\delta=54-50=4\) units. For \(\alpha=0.05\), \(z_{1-\alpha}=1.6449\); for target power \(0.90\), \(z_{1-\beta}=z_{0.90}=1.2816\).
Substitute the planning values. The units of \(\sigma\) and \(\delta\) cancel, leaving a dimensionless sample-size threshold.
The minimum whole-number sample size is therefore \(n_{\min}=54\). At \(n=53\), the sample size is below the derived threshold; at \(n=54\), it is above it. Under the stated model, the power at \(n=54\) is approximately \(\Phi(4\sqrt{54}/10-1.6449)=\Phi(1.2945)\), or about 0.902. This is at least the 0.90 target.
Worked Example: A More Stringent Significance Level
A hypothetical one-sided z test is planned to detect an increase of at least 5 units in a population mean. Assume independent normal observations and known population standard deviation \(\sigma=12\) units. The significance level is \(\alpha=0.01\), and the target power is 0.80. What sample size is required?
The planned increase gives \(\delta=5\) units. The stricter significance level has upper-tail critical value \(z_{0.99}=2.3263\), and the 0.80 target power gives \(z_{0.80}=0.8416\). Substitution yields:
The minimum integer sample size is \(n_{\min}=58\). As a check, using the displayed critical value, the power at 58 is \(\Phi(5\sqrt{58}/12-2.3263)\approx\Phi(0.8469)\approx0.8015\), just above 0.80. The sample-size threshold and the check refer to the same upper-tail test and the same planned difference of 5 units.
Worked Example: Rounding Up Near an Integer Boundary
Consider a hypothetical study using a one-sided z test to detect a mean increase of 3 units. Assume independent normally distributed observations, known \(\sigma=8\) units, \(\alpha=0.05\), and target power 0.95. Find the required integer sample size.
Here \(\delta=3\) units. Both quantiles are \(z_{0.95}=1.6449\). Keeping the displayed values throughout the arithmetic gives:
Although the threshold is close to 77, it is below 77, so the smallest integer that meets it is \(n_{\min}=77\). For confirmation, the power at 77 is \(\Phi(3\sqrt{77}/8-1.6449)\approx\Phi(1.64571)\approx0.9501\). Using 76 observations would not meet the target: the power is approximately \(\Phi(3\sqrt{76}/8-1.6449)\approx0.9478\). This example illustrates why the ceiling rule, not ordinary rounding, determines the answer.
What the Result Does and Does Not Say
The formula gives a minimum sample size for a particular model, test, significance level, target power, and alternative difference. It does not say that every study with that sample size will reject the null hypothesis. Rather, if the model and inputs hold, repeated samples of that size would reject at the stated long-run proportion when the true mean equals the specified alternative.
The planned difference \(\delta\) should be chosen in the context of the question. It represents the smallest mean difference the study is designed to detect with the target power. A test can have high power for a larger difference and lower power for a smaller one. Thus, a calculation is only as meaningful as its stated alternative and measurement units.
The calculation also assumes the test is one-sided in the direction selected before examining the data. If the scientific question concerns departures in either direction, this upper-tail formula does not describe the required test. Changing the test changes its rejection threshold and therefore changes the power condition.
Common Mistakes
- Rounding to the nearest integer. A threshold of 57.805 does not call for 58 merely because it is near 58; it calls for 58 because 57 is below the threshold and 58 is the smallest whole number that meets it.
- Using the wrong alternative difference. In the formula, \(\delta\) is the difference between the planned alternative mean and the null boundary. It is not \(\mu_1\) itself.
- Using a two-sided critical value. This derivation uses the upper-tail critical value \(z_{1-\alpha}\). A two-sided test has a different rejection rule and does not use this formula unchanged.
- Treating power as certainty. A planned power of 0.80 does not mean the study will certainly detect the effect. It means the rejection probability is 0.80 under the model when the true mean equals the specified alternative.
- Ignoring the known-\(\sigma\) assumption. The derivation uses \(\sigma/\sqrt{n}\) and a standard normal statistic. It is not automatically the sample-size formula for a test that estimates the standard deviation from the data.
Check Your Understanding
Try these questions using the definitions and derivation above.
- In the sample-size formula, what does \(\delta\) represent, and why must it be positive for the upper-tail test described here?
- For \(\alpha=0.05\) and target power 0.90, identify the two normal quantiles used in the formula and explain what each one represents.
- A calculation gives a threshold of 41.02. What is the minimum whole-number sample size, and why is 41 insufficient?
- Explain why increasing the planned minimum relevant difference changes the calculated sample-size threshold, holding the other inputs fixed.
- What model assumption allows the exact normal power calculation when \(\sigma\) is known?