Tutorials › VEE Mathematical Statistics › Sample Size for One-Sample Z Tests

VEE Mathematical Statistics · Power and Sample Size · Tutorial 658 of 880

Sample Size for One-Sample Z Tests

Learn to plan a one-sample z test by translating a target power into the minimum integer sample size and checking the resulting power.

Intermediate 11 min read

What You'll Learn

  • State the assumptions that make the one-sample z statistic standard normal under the null.
  • Derive the sample-size equation for an upper- or lower-tailed test.
  • Use a two-sided power equation and distinguish it from its convenient approximation.
  • Round a calculated sample size up and verify the achieved power.
  • Recognize how a wrong tail, variance, or rounding choice affects a sample-size calculation.

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.

Model and assumptions: The observations \(X_1,\ldots,X_n\) are independent and identically distributed as \(N(\mu,\sigma^2)\), where the population standard deviation \(\sigma\) is known. The test concerns the population mean \(\mu\). Under these assumptions, \(\bar X\sim N(\mu,\sigma^2/n)\), so \(Z=(\bar X-\mu_0)/(\sigma/\sqrt n)\) has a standard normal distribution when the null mean is \(\mu_0\). The planning formulas below are exact for this normal model. If the population is not normal and the sample is not large enough for a normal approximation to be appropriate, these exact power calculations need not apply.

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

$$ \lambda=\frac{\mu_1-\mu_0}{\sigma/\sqrt n} =\frac{(\mu_1-\mu_0)\sqrt n}{\sigma}. $$

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.

Theorem: For an upper-tailed one-sample z test with fixed alternative \(\mu_1>\mu_0\), the required real-valued sample size for target power \(1-\beta\) is
$$ n=\left(\frac{(z_{1-\alpha}+z_{1-\beta})\sigma}{\mu_1-\mu_0}\right)^2. $$

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\):

$$ n=\left(\frac{(z_{1-\alpha}+z_{1-\beta})\sigma}{\mu_0-\mu_1}\right)^2. $$
1
Identify the direction and fixed alternative.
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\).
2
Find the two normal quantiles.
Use \(z_{1-\alpha}\) for the rejection boundary and \(z_{1-\beta}\) for the target power.
3
Calculate, then round upward.
Substitute the standard deviation and the absolute difference between the null and alternative means. Round the result up to the next integer.
4
Check the achieved power.
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:

$$ n=\left(\frac{(1.6449+1.2816)(12)}{4}\right)^2 =\left(\frac{2.9265(12)}{4}\right)^2 =(8.7795)^2 =77.0796. $$

The minimum integer candidate is therefore \(n=78\). To check it, the standardized mean shift under \(\mu_1=44\) is

$$ \lambda=\frac{4\sqrt{78}}{12}=\frac{\sqrt{78}}{3}\approx2.9439. $$

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,

$$ n=\left(\frac{(2.3263+0.8416)(6)}{3}\right)^2 =(2(3.1679))^2 =(6.3358)^2 =40.1424. $$

Round up to \(n=41\). For the lower-tail power check, the magnitude of the standardized shift is

$$ \lambda=\frac{(50-47)\sqrt{41}}{6} =\frac{\sqrt{41}}{2} \approx3.2016. $$

The rejection boundary on the standard normal scale is \(-2.3263\). Under the alternative, \(Z\) has mean \(-3.2016\), so the power is

$$ P(Z<-2.3263\mid \mu=47) =\Phi(-2.3263-(-3.2016)) =\Phi(0.8753) \approx0.8093. $$

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

$$ \lambda=\frac{(\mu_1-\mu_0)\sqrt n}{\sigma}. $$

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.

$$ \operatorname{Power}(\mu_1) =1-\Phi(z_{1-\alpha/2}-\lambda) +\Phi(-z_{1-\alpha/2}-\lambda). $$

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

$$ n\approx \left(\frac{(z_{1-\alpha/2}+z_{1-\beta})\sigma}{\Delta}\right)^2. $$

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\).

$$ n\approx \left(\frac{(1.9600+0.8416)(10)}{5}\right)^2 =(2.8016(2))^2 =(5.6032)^2 =31.3959. $$

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

$$ 1-\Phi(1.9600-2.8284)+\Phi(-1.9600-2.8284) =\Phi(0.8684)+\Phi(-4.7884) \approx0.8073. $$

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.

Exam trap: Do not confuse the known variance \(\sigma^2\) with the standard deviation \(\sigma\). The standard error in the z statistic is \(\sigma/\sqrt n\), so the sample-size formulas use \(\sigma\), not \(\sigma^2\). For example, incorrectly substituting variance \(144\) for standard deviation \(12\) in the first example would inflate the computed sample size by a factor of \(144\). Also, do not use \(z_{1-\alpha/2}\) for a one-sided test or \(z_{1-\alpha}\) for a two-sided test.

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.

  1. 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\))
  2. 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\))
  3. 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\))
  4. 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\))
Clinical Biostats