# Single Sample Z-Test

Table of Contents

The Single Sample Z-Test is a statistical hypothesis test used to determine whether a sample mean is significantly different from a known population mean. It is based on the normal distribution and is used when the sample size is large and the population standard deviation is known. The test calculates the z-score, which measures the distance between the sample mean and the population mean in terms of standard deviations. This z-score is then compared to a critical value to determine the significance of the difference between the sample mean and the population mean. The Single Sample Z-Test is commonly used in research and data analysis to make inferences about a population based on a single sample.

## What is a Single Sample Z-Test?

The Single Sample Z-Test is a statistical test used to determine if a single group is significantly different from a known or hypothesized population value on your variable of interest. Your variable of interest should be continuous and normally distributed, and you must know the average and spread (or standard deviation) of the population.

The Single Sample Z-Test is also called the One-Sample Z-Test or Z-Test for One Mean

## Assumptions for a Single Sample Z-Test

Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.

The assumptions for the Single Sample Z-Test include:

1. Continuous
2. Normally Distributed
3. Random Sample
4. Enough Data
5. Known Population

Let’s dive in to each one of these separately.

#### Continuous

The variable that you care about (and want to see if it is different from the known or hypothesized population value) must be continuous. Continuous means that the variable can take on any reasonable value.

Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc.

If the variable that you care about is a proportion (48% of males voted in your sample vs 56% of males voted in the entire population) then you should use the One Proportion Z-Test instead.

#### Normally Distributed

The variable that you care about must be spread out in a normal way. In statistics, this is called being normally distributed (it must look like a bell curve when you graph the data). Only use a single sample z-test with your data if the variable you care about is normally distributed.

If your variable is not normally distributed, you should use the Single Sample Wilcoxon Signed-Rank Test instead.

#### Random Sample

The data points for each group in your analysis must have come from a simple random sample. This means that if you wanted to see if drinking sugary soda makes you gain weight, you would need to randomly select a group of soda drinkers for your soda drinker group, and then randomly select a group of non-soda drinkers for your non-soda drinking group.

The key here is that the data points for each group were randomly selected. This is important because if your groups were not randomly determined then your analysis will be incorrect. In statistical terms this is called bias, or a tendency to have incorrect results because of bad data.

If you do not have a random sample, the conclusions you can draw from your results are very limited. You should try to get a simple random sample. If you have paired samples (2 measurements from the same group of subjects) then you should use a Paired Samples T-Test instead. If you want to compare 2 groups of subjects instead of a single group with a population mean, then you should use an Independent Samples T-Test instead.

#### Enough Data

The sample size (or data set size) for your analysis should be greater than 30. It really depends on the expected size of the difference between your group and the population value. If you expect a large difference, then you can get away with a smaller sample size. If you expect a small difference, then you likely need a larger sample (30+).

If your sample size is less than 30 (or you do not know the average or spread of the population), you should run a Single Sample T-Test instead.

## When to use a Single Sample Z-Test?

You should use a Single Sample Z-Test in the following scenario:

1. You want to know if two groups are different on your variable of interest
2. Your variable of interest is continuous
3. You have a single group
4. You have a normal variable of interest (and population average and spread are both known)

Let’s clarify these to help you know when to use a Single Sample Z-Test.

#### Difference

You are looking for a statistical test to see whether two groups are significantly different on your variable of interest. In this case, you want to compare your group with the population average and spread (standard deviation). This is a difference question. Other types of analyses include examining the relationship between two variables (correlation) or predicting one variable using another variable (prediction).

#### Continuous Data

Your variable of interest must be continuous. Continuous means that your variable of interest can basically take on any value, such as heart rate, height, weight, number of ice cream bars you can eat in 1 minute, etc.

Types of data that are NOT continuous include ordered data (such as finishing place in a race, best business rankings, etc.), categorical data (gender, eye color, race, etc.), or binary data (purchased the product or not, has the disease or not, etc.).

#### A Single Group

A Single Sample Z-Test can only be used to compare a single group to a population average and standard deviation (spread) on your variable of interest.

If you have three or more groups, you should use a One Way Anova analysis instead. If you only have two groups, you should use the Independent Samples Z-Test.

#### Normal Variable of Interest (and population average and spread known)

Normality was discussed earlier on this page and simply means your plotted data is bell shaped with most of the data in the middle.

Another requirement for this analysis is that you know the average and standard deviation (spread) values for the population on your variable of interest.

If you actually would like to prove that your data is normal, you can use the Kolmogorov-Smirnov test or the Shapiro-Wilk test.

## Single Sample Z-Test Example

Group 1: Received the experimental medical treatment.
Population Group: Population values reported by hospitals across the nation.
Variable of interest: Time to recover from the disease in days.

In this example, group 1 is our treatment group because they received the experimental medical treatment. The population group is our control group because they received the control condition.

The null hypothesis, which is statistical lingo for what would happen if the treatment does nothing, is that group 1 and the population group will recover from the disease in about the same number of days, on average. We are trying to determine if receiving the experimental medical treatment will shorten the number of days it takes for patients to recover from the disease.

As we run the experiment, we track how long it takes for each patient to fully recover from the disease. In order to use a Single Sample Z-Test on our data, our variable of interest has to be normally distributed (bell curve shaped). In this case, recovery from the disease in days is normal for both groups.

After the experiment is over, we compare the two groups on our variable of interest (days to fully recover) using a Single Sample Z-Test. When we run the analysis, we get a z-value and a p-value. The z-value is a measure of how different the two groups are on our variable of interest. A p-value is the chance of seeing our results assuming the treatment actually doesn’t do anything. A p-value less than or equal to 0.05 means that our result is statistically significant and we can trust that the difference is not due to chance alone.

x