Planning Sample Size for a One-Sample Z Test
A one-sample z test can be used to test a population mean when the population variance is known. Planning its sample size means choosing \(n\) so that a test with a specified significance level has a desired probability of rejecting the null hypothesis at a particular alternative mean. The calculation depends on the direction of the test: a one-sided test places its rejection region in one tail, while a two-sided test divides the significance level between two tails.
The main planning principle is straightforward: translate the target power into a required distance between the alternative mean and the rejection boundary, measured in standard errors. Since the standard error is \(\sigma/\sqrt{n}\), the required sample size grows as the squared ratio of the noise level to the mean difference.
Write \(\Phi\) for the standard normal cumulative distribution function, and let \(z_p\) be its \(p\)-quantile, so that \(\Phi(z_p)=p\). The significance level \(\alpha\) is the probability of rejecting the null when the null mean is true. The target power is \(1-\beta\), where \(\beta\) is the probability of failing to reject at the specified alternative mean. Sample size must be a whole number, so a calculated requirement is rounded up, not to the nearest integer.
One-Sided Tests
For an upper-tailed test, \(H_0:\mu=\mu_0\) is tested against \(H_1:\mu>\mu_0\). At significance level \(\alpha\), reject when \(Z>z_{1-\alpha}\). To plan for a fixed alternative \(\mu_1>\mu_0\), the mean of \(Z\) under that alternative is
The statistic has variance 1 under the alternative as well. Thus the probability of exceeding the rejection boundary is \(\Phi(\lambda-z_{1-\alpha})\). Setting this equal to the target power gives the sample-size equation.
For a lower-tailed test, \(H_0:\mu=\mu_0\) is tested against \(H_1:\mu<\mu_0\). With \(\mu_1<\mu_0\), the rejection rule is \(Z<-z_{1-\alpha}\). The corresponding sample-size formula uses the positive difference \(\mu_0-\mu_1\):
Use the upper-tail formula only when the planned alternative mean is above \(\mu_0\), and the lower-tail formula only when it is below \(\mu_0\).
Use \(z_{1-\alpha}\) for the rejection boundary and \(z_{1-\beta}\) for the target power.
Substitute the standard deviation and the absolute difference between the null and alternative means. Round the result up to the next integer.
Substitute the integer sample size into the power function to confirm that it meets or exceeds the target.
Worked Example: Planning an Upper-Tailed Test
A hypothetical materials laboratory measures the breaking strength of a new fiber. Assume independent observations from a normal population with known standard deviation \(\sigma=12\) units. The laboratory will test \(H_0:\mu=40\) against \(H_1:\mu>40\), using \(\alpha=0.05\). Find the sample size needed for power at least \(0.90\) when the true mean is \(\mu_1=44\).
Method. Use the exact upper-tailed z-test sample-size equation. The planned increase is \(44-40=4\) units. The needed quantiles are \(z_{0.95}=1.6449\) and \(z_{0.90}=1.2816\).
Substitute the values:
The minimum integer candidate is therefore \(n=78\). To check it, the standardized mean shift under \(\mu_1=44\) is
The achieved power is \(\Phi(\lambda-z_{0.95})=\Phi(2.9439-1.6449)=\Phi(1.2990)\approx0.9031\), which exceeds \(0.90\). Rounding the unrounded result to \(77\) would not meet the target: its power is approximately \(\Phi(4\sqrt{77}/12-1.6449)=\Phi(1.2801)\approx0.8998\). Thus \(78\) is the minimum required sample size. The common mistake avoided here is rounding to the nearest integer rather than upward and checking the target.
Worked Example: Planning a Lower-Tailed Test
A hypothetical calibration process produces independent normal measurements with known standard deviation \(\sigma=6\) units. A quality analyst tests \(H_0:\mu=50\) against \(H_1:\mu<50\) at \(\alpha=0.01\). How many measurements are needed for power at least \(0.80\) if the true mean is \(\mu_1=47\)?
Method. This is a lower-tailed test, and the planned decrease is \(50-47=3\). The quantiles are \(z_{0.99}=2.3263\) and \(z_{0.80}=0.8416\). Therefore,
Round up to \(n=41\). For the lower-tail power check, the magnitude of the standardized shift is
The rejection boundary on the standard normal scale is \(-2.3263\). Under the alternative, \(Z\) has mean \(-3.2016\), so the power is
The target is met. Using the upper-tail direction or using \(47-50\) without taking account of the lower-tail rejection boundary can produce a nonsensical sign or a wrong probability. The positive distance \(50-47\) in the planning formula avoids that error.
Two-Sided Tests
For \(H_0:\mu=\mu_0\) against \(H_1:\mu\ne\mu_0\), a level-\(\alpha\) z test rejects when \(|Z|>z_{1-\alpha/2}\). Let
Under the fixed alternative, \(Z\sim N(\lambda,1)\). Power is the probability of falling in either rejection tail. The first term below is the upper-tail probability; the second is the lower-tail probability.
Unlike the one-sided case, the exact two-sided equation does not generally rearrange into a simple closed-form sample-size formula because power includes both tails. A common planning approximation drops the tail opposite the fixed alternative. With \(\Delta=|\mu_1-\mu_0|\), it gives
This approximation is useful for an initial calculation, but the exact two-sided power should be checked at the resulting integer sample size. If that power is below the target, increase \(n\) until it meets the target. The opposite-tail probability is often tiny when the alternative is clearly separated from the null, but it is part of the exact power definition.
Worked Example: Checking a Two-Sided Sample Size
A hypothetical instrument is being assessed for a mean reading different from \(100\). Measurements are independent and normal with known standard deviation \(\sigma=10\). The test is \(H_0:\mu=100\) versus \(H_1:\mu\ne100\), with \(\alpha=0.05\). Find the minimum sample size for power at least \(0.80\) at the fixed alternative \(\mu_1=105\).
Method. First use the two-sided approximation, then evaluate the exact two-tail power at nearby integer sample sizes. Here \(\Delta=|105-100|=5\), \(z_{0.975}=1.9600\), and \(z_{0.80}=0.8416\).
The approximation suggests \(n=32\). At \(n=32\), \(\lambda=5\sqrt{32}/10=\sqrt{32}/2\approx2.8284\). With \(z_{0.975}=1.9600\), the exact power is
To establish that \(32\) is the minimum, check \(n=31\): \(\lambda=5\sqrt{31}/10=\sqrt{31}/2\approx2.7839\), so the power is \(\Phi(0.8239)+\Phi(-4.7439)\approx0.7949\). This is below \(0.80\), while the power at \(32\) is above it. Therefore the minimum sample size is \(32\). The common mistake avoided is treating the approximate equation as an exact two-sided result without checking power.
Interpreting and Applying the Calculation
The formulas show how design choices affect the required number of observations. A smaller significance level makes the rejection boundary more extreme, and a higher target power requires more separation from that boundary. Both tend to increase \(n\). A larger known standard deviation also increases \(n\), while a larger difference between the planned alternative and the null mean decreases it. In the one-sided formula, these effects appear through a squared ratio; doubling \(\sigma\) while holding the other inputs fixed multiplies the required sample size by four.
The alternative mean is a planning value, not a claim that the true mean is known. Power is specific to that value: if the true mean is closer to \(\mu_0\), the power will be lower; if it is farther away in the direction of the alternative, it will be higher. The calculation also presumes that the test will use the stated \(\alpha\), known \(\sigma\), and specified tail structure. If variance must instead be estimated from the data, the z-test calculation is not the appropriate power model.
A sound planning calculation identifies the test direction, uses the correct normal quantiles, specifies the alternative mean and standard deviation in consistent units, rounds upward, and checks the power at the integer result. These steps are central to sample-size questions aligned with the SOA VEE Mathematical Statistics syllabus.
Check Your Understanding
For each problem, assume independent observations from a normal population with known standard deviation. Use the stated z test and round the required sample size up to an integer.
- A one-sided upper test has \(\mu_0=30\), \(\sigma=8\), \(\alpha=0.05\), and target power \(0.90\) at \(\mu_1=32\). What sample size is required? (Answer: \(n=138\))
- A one-sided lower test has \(\mu_0=60\), \(\sigma=5\), \(\alpha=0.025\), and target power \(0.90\) at \(\mu_1=58\). What sample size is required? (Answer: \(n=66\))
- A two-sided test has \(\mu_0=20\), \(\sigma=9\), \(\alpha=0.10\), and target power \(0.80\) at \(\mu_1=23\). Use the approximation and check the exact two-sided power at the rounded sample size. What is the minimum sample size? (Answer: \(n=56\))
- A two-sided test has \(\mu_0=75\), \(\sigma=15\), \(\alpha=0.05\), and target power \(0.90\) at \(\mu_1=81\). Use the approximation, then verify that the previous integer is insufficient. What is the minimum sample size? (Answer: \(n=66\))