Home » One Sample Z-Test: Definition, Formula, and Example

One Sample Z-Test: Definition, Formula, and Example

by Erma Khan

one sample z-test is used to test whether the mean of a population is less than, greater than, or equal to some specific value.

This test assumes that the population standard deviation is known.

This tutorial explains the following:

  • The formula to perform a one sample z-test.
  • The assumptions of a one sample z-test.
  • An example of how to perform a one sample z-test.

Let’s jump in!

One Sample Z-Test: Formula

A one sample z-test will always use one of the following null and alternative hypotheses:

1. Two-Tailed Z-Test

  • H0μ = μ0 (population mean is equal to some hypothesized value μ0)
  • HA: μ ≠ μ0 (population mean is not equal to some hypothesized value μ0)

2. Left-Tailed Z-Test

  • H0μ ≥ μ0 (population mean is greater than or equal to some hypothesized value μ0)
  • HA: μ 0 (population mean is less than some hypothesized value μ0)

3. Right-Tailed Z-Test

  • H0μ ≤ μ0 (population mean is less than or equal to some hypothesized value μ0)
  • HA: μ > μ0 (population mean is greaer than some hypothesized value μ0)

We use the following formula to calculate the z test statistic:

z = (x – μ0) / (σ/√n)

where:

  • x: sample mean
  • μ0: hypothesized population mean
  • σ: population standard deviation
  • n: sample size

If the p-value that corresponds to the z test statistic is less than your chosen significance level (common choices are 0.10, 0.05, and 0.01) then you can reject the null hypothesis.

One Sample Z-Test: Assumptions

For the results of a one sample z-test to be valid, the following assumptions should be met:

  • The data are continuous (not discrete).
  • The data is a simple random sample from the population of interest.
  • The data in the population is approximately normally distributed.
  • The population standard deviation is known.

One Sample Z-Test: Example

Suppose the IQ in a population is normally distributed with a mean of μ = 100 and standard deviation of σ = 15.

A scientist wants to know if a new medication affects IQ levels, so she recruits 20 patients to use it for one month and records their IQ levels at the end of the month:

To test this, she will perform a one sample z-test at significance level α = 0.05 using the following steps:

Step 1: Gather the sample data.

Suppose she collects a simple random sample with the following information:

  • n (sample size) = 20
  •  x (sample mean IQ) = 103.05

Step 2: Define the hypotheses.

She will perform the one sample z-test with the following hypotheses:

  • H0μ = 100
  • HAμ ≠ 100

Step 3: Calculate the z test statistic.

The z test statistic is calculated as:

  • z = (x – μ) / (σ√n)
  • z = (103.05 – 100) / (15/√20)
  • z = 0.90933

Step 4: Calculate the p-value of the z test statistic.

According to the Z Score to P Value Calculator, the two-tailed p-value associated with z = 0.90933 is 0.36318.

Step 5: Draw a conclusion.

Since the p-value (0.36318) is not less than the significance level (.05), the scientist will fail to reject the null hypothesis.

There is not sufficient evidence to say that the new medication significantly affects IQ level.

Note: You can also perform this entire one sample z-test by using the One Sample Z-Test Calculator.

Additional Resources

The following tutorials explain how to perform a one sample z-test using different statistical software:

How to Perform Z-Tests in Excel
How to Perform Z-Tests in R
How to Perform Z-Tests in Python

Related Posts