# Z-Test

Published on :

21 Aug, 2024

Blog Author :

Wallstreetmojo Team

Edited by :

Collins Enosh

Reviewed by :

Dheeraj Vaidya

## Z-Test Definition

Z-test is a statistical analysis tool that measures the average mean of two large data samples when the standard deviation is known. It only applies to a population that follows a normal distribution; It is typically used when the data samples are greater than 30.

Depending on the data parameters, a z-test can be a left-tailed, right-tailed, or two-tailed hypothesis test. Z-tests are similar to t-tests, except t-tests are employed when the sample size is smaller. The calculation of the z-trial outputs a z-score that defines the position from the mean.

##### Table of contents

- The z-test is used for hypothesis testing. When the variance is provided, it determines the average mean of large data samples.
- Using null and alternative hypotheses helps compare two data populations, the difference between them, and the z-score.
- Z-trials are further categorized into two types. The one-sample test compares a single sample average with the population means. On the other hand, the two-sample test compares the average mean of two samples.
- If x̅ is the sample mean, μ0 is the population mean, σ is the standard deviation, and n is the sample size, then the z-trial formula is expressed as follows:
**Z = (x̅ – μ0) / (σ /√n)**.

### Z-Test Explained

Z-test is a statistical tool that is used in hypothesis testing. It is the go-to method when the sample size is large. The test derives the difference between the two large population samples, provided the variance is known. Z-tests are similar to t-tests; the only difference is that t-tests are conducted for small sample sizes or when the variance is unknown.

Again, t-tests are not conducted for large datasets; on the other hand, z-tests do not work if the sample size is too small. There is a minimum limit of 30; if the sample size is above 30. Thus, experiments that feature less than 30 subjects are referred to as a small sample size.

Before venturing further into the test, let us quickly examine hypothesis testing. Hypothesis testing ascertains whether a particular assumption is true for the whole population. It is a statistical application. It determines the validity of inference by evaluating sample data from the overall population.

The concept of hypothesis works on the probability of an event's occurrence. It confirms whether the primary hypothesis results are correct or not. In research, it is very important to eliminate randomness. The data should not have been caused by chance or a random factor. Hypothesis testing eliminates such uncertainties.

The z-test definition stresses an important assumption—the sample data is a normal distribution. That is, a given sample is normally distributed; there is no influence of an external factor.

Z-trials are classified into two:

- One sample test compares a single sample average with the population means.
- Two-sample tests compare the average mean of two samples.

### Z-Test Formula

The z-test formula is as follows:

*Z = (x̅ – μ0) / (σ /√n)*

- Here, x̅ is the sample mean;
- μ0 is the population mean;
- σ is the standard deviation;
- n is the sample size.

Based on the Z-test result, the research derives the hypothesis conclusion. It can either be a null or an alternative. They are measured using the following formula:

*H _{0}: μ=μ_{0}*

_{or}

*H _{a}: μ≠μ_{0}*

Here,

- H
_{0 }= Null Hypothesis - H
_{a}= Alternate Hypothesis

The null hypothesis is proven true if the mean value equals the population means. Otherwise, the alternate hypothesis is taken into consideration.

### Calculation

Let us look at the z-test calculation.

A professor claims that all the students in the first-year class possess above-average IQs. Randomly, a test was conducted on thirty students, resulting in a mean IQ of 117. The population mean (of the entire freshman batch) was 100, and the standard deviation was 27.

One must identify the null and alternate hypotheses to check if the professor’s claim is true.

- Null hypothesis - H
_{0 }: μ = 100 - Alternative hypothesis - H
_{a: μ > 100}

Then, one adjusts the significance level. Finally, one finds the z-value or z-score. Then, one puts the given values into the z-trial formula:

- Z = (x̅ – μ0) / (σ /√n)
- Z = 117 - 100/ (27/√30)
- Z = 17/ (27/5.477)
- Z = 17/4.929
- Z = 3.44

Now one compares the z-score with the significance level.

After comparing the significance level with the z-score, the analyst either accepts or rejects the null hypothesis.

### Example

Now, let us look at a z-test example.

A doctor claims that a particular hospital contains more than 100 diabetes patients with a sugar level of 234 or more.

To verify the claim, a random test was conducted on 90 diabetes patients. The test resulted in a mean blood sugar level of 279. In addition, the test resulted in a standard deviation of 18.

Here, we set the significance level at 22.50.

Z-trails have three main steps:

- Identifying null and alternate hypotheses.
- Measuring the statistical significance.
- Comparing the z score with the significance level. Based on the comparison, the null hypothesis is either accepted or rejected.

- Thus, the Null hypothesis, H0 : µ = 234
- The alternative hypothesis, H
_{a}: µ > 234

Now we substitute the given values into the z-trial formula:

- Z = (x̅ – μ0) / (σ /√n)
- Z = 279 – 234 / 18/√90
- Z = 45 / (18/9.48)
- Z = 45/1.89
- Z = 23.80

Finally, the z-score (23.80) is compared with the significance level.

22.50 < 23.80; the doctor’s claim is proven correct.

### Interpretation

The calculation of the z-trial provides a z-score that defines the raw score position from the mean. This is expressed in units of the standard deviation.

The z-score is the number of standard deviations between the given value and the mean. If its value is above the mean, then the z-score is positive, and if it lies below the mean, the value of the z-score is negative.

Z-scores standardize normal distributions, which allows analysts to measure the scoring probability within the normal distribution. This makes it easier to compare two different scores from different samples (with the chances of having different means and standard deviations).

### Frequently Asked Questions (FAQs)

**1. What are the assumptions of z-test?**

A t-test does not presume knowledge of σ, whereas a z-test does. As a result, a t-test needs to estimate the sample's standard deviation or s. The z-statistic has a normal distribution with a standard deviation of N under the null hypothesis that the population is distributed with a mean (0,1).

**2. What is the difference between the z-test and t-test?**

Z-trial is a hypothesis testing method that uses statistics. It is used to ascertain whether the two-sample means are different; to conduct this test, the standard deviation value must be known, and the sample size should be large (minimum 30). In contrast, the t-test calculates how the average means of multiple data sets differ when the variance or standard deviation is not given.

**3. What is a one-sample z-test?**

It is applied when the population parameters are known. In most cases, those values are unknown. When the variance is known, the one-sample test measures the difference between the sample mean and the population.

### Recommended Articles

This article has been a guide to Z-Test and its definition. We explain it in detail with its formula, example, calculation, and interpretation. You can learn more about it from the following articles -