Statistics

One-Sample Z-Tests

Last updated: March 2026 · Advanced
Before you start

You should be comfortable with:

Real-world applications
💊
Nursing

Medication dosages, IV drip rates, vital monitoring

💰
Retail & Finance

Discounts, tax, tips, profit margins

The z-test is the simplest hypothesis test. It uses the standard normal distribution to decide whether sample data provides evidence against a null hypothesis. If you have already learned the logic of hypothesis testing — null and alternative hypotheses, p-values, significance levels, and Type I/II errors — then you are ready to put that framework into action. The z-test is the natural starting point because its reference distribution (the standard normal curve) is the one you already know from z-scores. In this lesson, you will learn two forms: the z-test for a population proportion and the z-test for a population mean when the population standard deviation σ\sigma is known.

Z-Test for a Population Proportion

Use this test when you are testing a claim about a population proportion pp — for example, whether a defect rate is 3%, whether a majority of voters favor a policy, or whether a medication’s success rate matches its label.

Conditions (all must be met):

  • The sample is a simple random sample from the population of interest
  • Individual observations are independent (sampling less than 10% of the population, or observations are naturally independent)
  • The sample size is large enough that np010np_0 \geq 10 and n(1p0)10n(1 - p_0) \geq 10, where p0p_0 is the null value. This ensures the sampling distribution of p^\hat{p} is approximately normal.

Test statistic:

z=p^p0p0(1p0)nz = \frac{\hat{p} - p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}}

Here p^\hat{p} is the sample proportion, p0p_0 is the hypothesized proportion from H0H_0, and nn is the sample size. The denominator is the standard error calculated under the null hypothesis — this is important because we are asking “If p0p_0 were the true proportion, how surprising is p^\hat{p}?”

Example 1: Defective Rate (One-Sided Right)

A manufacturer claims its defect rate is 3%. A quality inspector randomly tests 500 items and finds 22 defective, giving p^=22/500=0.044\hat{p} = 22/500 = 0.044. Is there evidence the defect rate exceeds 3%? Test at α=0.05\alpha = 0.05.

Step 1: State the hypotheses.

H0:p=0.03(defect rate is 3% as claimed)H_0: p = 0.03 \quad \text{(defect rate is 3\% as claimed)}

Ha:p>0.03(defect rate is higher — one-sided right)H_a: p > 0.03 \quad \text{(defect rate is higher — one-sided right)}

Step 2: Choose significance level: α=0.05\alpha = 0.05.

Step 3: Check conditions.

  • Random sample ✓
  • Independence: 500 items is far less than 10% of total production ✓
  • Large-sample check: 500×0.03=1510500 \times 0.03 = 15 \geq 10 ✓ and 500×0.97=48510500 \times 0.97 = 485 \geq 10

Step 4: Calculate the test statistic.

SE=0.03×0.97500=0.0291500=0.0000582=0.00763SE = \sqrt{\frac{0.03 \times 0.97}{500}} = \sqrt{\frac{0.0291}{500}} = \sqrt{0.0000582} = 0.00763

z=0.0440.030.00763=0.0140.00763=1.835z = \frac{0.044 - 0.03}{0.00763} = \frac{0.014}{0.00763} = 1.835

Step 5: Find the p-value. Since this is a one-sided right test:

p-value=P(Z>1.835)0.0333\text{p-value} = P(Z > 1.835) \approx 0.0333

Step 6: Make a decision. Since 0.0333<0.050.0333 < 0.05, we reject H0H_0.

Step 7: Conclusion in context. There is statistically significant evidence at the 5% level that the manufacturer’s defect rate exceeds 3%. The observed rate of 4.4% is significantly higher than the claimed rate. The inspector should flag this batch for further review.

Example 2: Patient Satisfaction (Two-Sided)

A hospital claims an 80% patient satisfaction rate. A survey of 300 randomly selected patients finds 225 who are satisfied, giving p^=225/300=0.75\hat{p} = 225/300 = 0.75. Test whether the satisfaction rate differs from 80% at α=0.05\alpha = 0.05.

Step 1: State the hypotheses.

H0:p=0.80(satisfaction rate is 80%)H_0: p = 0.80 \quad \text{(satisfaction rate is 80\%)}

Ha:p0.80(satisfaction rate is different — two-sided)H_a: p \neq 0.80 \quad \text{(satisfaction rate is different — two-sided)}

Step 2: Choose significance level: α=0.05\alpha = 0.05.

Step 3: Check conditions.

  • Random sample ✓
  • Independence: 300 is less than 10% of all patients ✓
  • Large-sample check: 300×0.80=24010300 \times 0.80 = 240 \geq 10 ✓ and 300×0.20=6010300 \times 0.20 = 60 \geq 10

Step 4: Calculate the test statistic.

SE=0.80×0.20300=0.16300=0.000533=0.02309SE = \sqrt{\frac{0.80 \times 0.20}{300}} = \sqrt{\frac{0.16}{300}} = \sqrt{0.000533} = 0.02309

z=0.750.800.02309=0.050.02309=2.165z = \frac{0.75 - 0.80}{0.02309} = \frac{-0.05}{0.02309} = -2.165

Step 5: Find the p-value. Since this is a two-sided test:

p-value=2×P(Z<2.165)2×0.0152=0.0304\text{p-value} = 2 \times P(Z < -2.165) \approx 2 \times 0.0152 = 0.0304

Step 6: Make a decision. Since 0.0304<0.050.0304 < 0.05, we reject H0H_0.

Step 7: Conclusion in context. There is statistically significant evidence that the patient satisfaction rate differs from the claimed 80%. At 75%, satisfaction is significantly lower. Hospital leadership should investigate root causes and develop improvement strategies.

Z-Test for a Population Mean (σ\sigma Known)

Use this test when you are testing a claim about a population mean μ\mu and the population standard deviation σ\sigma is known. This scenario is uncommon in practice — it arises mainly when a manufacturing process has a well-established historical standard deviation, or in textbook problems designed to teach the z-test framework. In most real-world situations, σ\sigma is unknown and you would use a t-test instead.

Conditions:

  • The sample is a simple random sample
  • Observations are independent
  • The population distribution is normal, OR the sample size is large (n30n \geq 30) so that the Central Limit Theorem applies

Test statistic:

z=xˉμ0σ/nz = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}

Here xˉ\bar{x} is the sample mean, μ0\mu_0 is the hypothesized population mean from H0H_0, σ\sigma is the known population standard deviation, and nn is the sample size.

Example 3: Bottling Machine Fill Volume (One-Sided Left)

A bottling machine is designed to fill each bottle to μ=500\mu = 500 mL. From historical calibration data, the fill standard deviation is known to be σ=5\sigma = 5 mL. A quality engineer draws a random sample of 40 bottles and measures xˉ=498.2\bar{x} = 498.2 mL. Is there evidence the machine is underfilling? Test at α=0.01\alpha = 0.01.

Step 1: State the hypotheses.

H0:μ=500(machine fills correctly)H_0: \mu = 500 \quad \text{(machine fills correctly)}

Ha:μ<500(machine is underfilling — one-sided left)H_a: \mu < 500 \quad \text{(machine is underfilling — one-sided left)}

Step 2: Choose significance level: α=0.01\alpha = 0.01.

Step 3: Check conditions. Random sample ✓. Independence ✓. Sample size n=4030n = 40 \geq 30, so the CLT applies ✓. And σ=5\sigma = 5 is known ✓.

Step 4: Calculate the test statistic.

SE=σn=540=56.3246=0.7906SE = \frac{\sigma}{\sqrt{n}} = \frac{5}{\sqrt{40}} = \frac{5}{6.3246} = 0.7906

z=498.25000.7906=1.80.7906=2.277z = \frac{498.2 - 500}{0.7906} = \frac{-1.8}{0.7906} = -2.277

Step 5: Find the p-value. Since this is a one-sided left test:

p-value=P(Z<2.277)0.0114\text{p-value} = P(Z < -2.277) \approx 0.0114

Step 6: Make a decision. Since 0.0114>0.010.0114 > 0.01, we fail to reject H0H_0 at the 1% level.

Step 7: Conclusion in context. At the strict α=0.01\alpha = 0.01 significance level, there is not sufficient evidence to conclude the machine is underfilling. However, the p-value of 0.0114 is quite close to the threshold. At the more common α=0.05\alpha = 0.05 level, this result would be significant. The engineer may want to continue monitoring or collect a larger sample.

Important note: This example illustrates why the choice of α\alpha matters. The same data leads to different decisions depending on the threshold. In high-stakes manufacturing scenarios, a stricter α\alpha reduces the risk of a false alarm (Type I error) but increases the risk of missing a real problem (Type II error).

Making a Decision: The Complete Framework

Every z-test follows the same seven-step process. Here is a summary:

StepActionKey Question
1State H0H_0 and HaH_aWhat is the claim? What direction?
2Set α\alphaHow much Type I error risk is acceptable?
3Check conditionsRandom? Independent? Large enough sample?
4Calculate the test statisticHow far is the sample result from the null value?
5Find the p-valueHow surprising is this result if H0H_0 is true?
6Compare p-value to α\alphaReject or fail to reject?
7State conclusion in contextWhat does this mean for the real-world question?

Decision rules at a glance:

  • One-sided right (Ha:>H_a: >): p-value =P(Z>z)= P(Z > z)
  • One-sided left (Ha:<H_a: <): p-value =P(Z<z)= P(Z < z)
  • Two-sided (Ha:H_a: \neq): p-value =2×P(Z>z)= 2 \times P(Z > |z|)

Real-World Application: Nursing — Testing a Medication Compliance Rate

A nurse educator develops a new discharge instruction protocol aimed at improving medication compliance. The hospital’s historical compliance rate is 70%. After implementing the new protocol, a random sample of 150 discharged patients is followed up, and 115 are found to be compliant, giving p^=115/150=0.7667\hat{p} = 115/150 = 0.7667.

Is there evidence that the new protocol improves compliance above 70%?

H0:p=0.70Ha:p>0.70H_0: p = 0.70 \quad H_a: p > 0.70

Check conditions: 150×0.70=10510150 \times 0.70 = 105 \geq 10 ✓ and 150×0.30=4510150 \times 0.30 = 45 \geq 10 ✓.

SE=0.70×0.30150=0.21150=0.0014=0.03742SE = \sqrt{\frac{0.70 \times 0.30}{150}} = \sqrt{\frac{0.21}{150}} = \sqrt{0.0014} = 0.03742

z=0.76670.700.03742=0.06670.03742=1.782z = \frac{0.7667 - 0.70}{0.03742} = \frac{0.0667}{0.03742} = 1.782

p-value=P(Z>1.782)0.0374\text{p-value} = P(Z > 1.782) \approx 0.0374

At α=0.05\alpha = 0.05, we reject H0H_0. There is evidence that the new protocol increases medication compliance above the baseline 70%. The observed rate of 76.7% represents a clinically meaningful improvement — roughly 10 additional compliant patients per 150 discharged — which could reduce hospital readmissions and improve patient outcomes.

Clinical consideration: In healthcare settings, both statistical and practical significance matter. A compliance increase from 70% to 77% has real clinical impact: fewer missed doses, fewer adverse events, and lower readmission rates. The nurse educator should recommend adopting the new protocol while continuing to monitor compliance rates.

Practice Problems

Test your understanding with these problems. Click to reveal each answer.

Problem 1: A politician claims that 55% of voters support a ballot measure. A poll of 400 randomly selected voters finds 200 who support it. Is there evidence the true support is less than 55%? (α=0.05\alpha = 0.05)

H0:p=0.55H_0: p = 0.55, Ha:p<0.55H_a: p < 0.55 (one-sided left)

p^=200400=0.50\hat{p} = \frac{200}{400} = 0.50

SE=0.55×0.45400=0.2475400=0.000619=0.02487SE = \sqrt{\frac{0.55 \times 0.45}{400}} = \sqrt{\frac{0.2475}{400}} = \sqrt{0.000619} = 0.02487

z=0.500.550.02487=0.050.02487=2.010z = \frac{0.50 - 0.55}{0.02487} = \frac{-0.05}{0.02487} = -2.010

p-value=P(Z<2.010)0.0222\text{p-value} = P(Z < -2.010) \approx 0.0222

Since 0.0222<0.050.0222 < 0.05, reject H0H_0.

Answer: There is statistically significant evidence that voter support is less than 55%. The sample proportion of 50% suggests the politician’s claim overestimates true support.

Problem 2: A cereal company states that its boxes weigh an average of 340 grams. The standard deviation is known to be σ=8\sigma = 8 grams from the production process. A sample of 36 boxes has xˉ=337.5\bar{x} = 337.5 grams. Test whether the mean weight differs from 340 grams at α=0.05\alpha = 0.05.

H0:μ=340H_0: \mu = 340, Ha:μ340H_a: \mu \neq 340 (two-sided)

SE=836=86=1.333SE = \frac{8}{\sqrt{36}} = \frac{8}{6} = 1.333

z=337.53401.333=2.51.333=1.875z = \frac{337.5 - 340}{1.333} = \frac{-2.5}{1.333} = -1.875

p-value=2×P(Z<1.875)2×0.0304=0.0608\text{p-value} = 2 \times P(Z < -1.875) \approx 2 \times 0.0304 = 0.0608

Since 0.0608>0.050.0608 > 0.05, fail to reject H0H_0.

Answer: There is not sufficient evidence to conclude the mean box weight differs from 340 grams. The observed difference of 2.5 grams below the target is within the range of normal sampling variation.

Problem 3: A website claims a 12% click-through rate on its ads. An advertiser runs 800 ad impressions and observes 78 clicks. Is the click-through rate less than 12%? (α=0.05\alpha = 0.05)

H0:p=0.12H_0: p = 0.12, Ha:p<0.12H_a: p < 0.12 (one-sided left)

p^=78800=0.0975\hat{p} = \frac{78}{800} = 0.0975

Check: 800×0.12=9610800 \times 0.12 = 96 \geq 10 ✓, 800×0.88=70410800 \times 0.88 = 704 \geq 10

SE=0.12×0.88800=0.1056800=0.000132=0.01149SE = \sqrt{\frac{0.12 \times 0.88}{800}} = \sqrt{\frac{0.1056}{800}} = \sqrt{0.000132} = 0.01149

z=0.09750.120.01149=0.02250.01149=1.958z = \frac{0.0975 - 0.12}{0.01149} = \frac{-0.0225}{0.01149} = -1.958

p-value=P(Z<1.958)0.0251\text{p-value} = P(Z < -1.958) \approx 0.0251

Since 0.0251<0.050.0251 < 0.05, reject H0H_0.

Answer: There is statistically significant evidence that the click-through rate is less than 12%. The observed rate of 9.75% suggests the website’s claim overstates the actual ad performance.

Problem 4: A factory produces steel rods whose lengths should average 25.0 cm, with known σ=0.3\sigma = 0.3 cm. A random sample of 50 rods yields xˉ=25.08\bar{x} = 25.08 cm. Test whether the mean length exceeds 25.0 cm at α=0.05\alpha = 0.05.

H0:μ=25.0H_0: \mu = 25.0, Ha:μ>25.0H_a: \mu > 25.0 (one-sided right)

SE=0.350=0.37.071=0.04243SE = \frac{0.3}{\sqrt{50}} = \frac{0.3}{7.071} = 0.04243

z=25.0825.00.04243=0.080.04243=1.885z = \frac{25.08 - 25.0}{0.04243} = \frac{0.08}{0.04243} = 1.885

p-value=P(Z>1.885)0.0297\text{p-value} = P(Z > 1.885) \approx 0.0297

Since 0.0297<0.050.0297 < 0.05, reject H0H_0.

Answer: There is statistically significant evidence that the mean rod length exceeds 25.0 cm. The average of 25.08 cm is significantly above the target, suggesting the machine may need recalibration.

Problem 5: A school district claims 65% of its students read at grade level. A random sample of 250 students finds 150 reading at grade level. Is there evidence the proportion differs from 65%? (α=0.10\alpha = 0.10)

H0:p=0.65H_0: p = 0.65, Ha:p0.65H_a: p \neq 0.65 (two-sided)

p^=150250=0.60\hat{p} = \frac{150}{250} = 0.60

Check: 250×0.65=162.510250 \times 0.65 = 162.5 \geq 10 ✓, 250×0.35=87.510250 \times 0.35 = 87.5 \geq 10

SE=0.65×0.35250=0.2275250=0.000910=0.03017SE = \sqrt{\frac{0.65 \times 0.35}{250}} = \sqrt{\frac{0.2275}{250}} = \sqrt{0.000910} = 0.03017

z=0.600.650.03017=0.050.03017=1.657z = \frac{0.60 - 0.65}{0.03017} = \frac{-0.05}{0.03017} = -1.657

p-value=2×P(Z<1.657)2×0.0488=0.0976\text{p-value} = 2 \times P(Z < -1.657) \approx 2 \times 0.0488 = 0.0976

Since 0.0976<0.100.0976 < 0.10, reject H0H_0.

Answer: At the 10% significance level, there is evidence that the proportion of students reading at grade level differs from 65%. The sample proportion of 60% is significantly below the claimed rate. Note: at α=0.05\alpha = 0.05, this result would not be significant (0.0976 > 0.05), which highlights the importance of choosing α\alpha before collecting data.

Key Takeaways

  • The z-test for a proportion tests claims about a population proportion pp using the test statistic z=p^p0p0(1p0)/nz = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}
  • The z-test for a mean (when σ\sigma is known) uses the test statistic z=xˉμ0σ/nz = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}}
  • Both tests require random sampling, independence, and sufficient sample size for the normal approximation to hold
  • The z-test for a mean with known σ\sigma is rare in practice — the one-sample t-test is far more common
  • The p-value measures how surprising the sample result would be if H0H_0 were true — small p-values provide evidence against H0H_0
  • Always check conditions before performing any test. Violating assumptions can lead to misleading results.
  • State conclusions in context — a statistical decision (“reject H0H_0”) must be translated into a meaningful real-world statement
  • The choice of α\alpha can change the decision. Always set α\alpha before looking at the data.

Return to Statistics for more topics in this section.

Last updated: March 29, 2026