Z test and Chi-square are two different statistical hypotheses testing. Both the tests give an alternate point of view to null value hypotheses.

**Z-Test vs Chi-Square**

The difference between Z-test and Chi-square is that Z-test is a statistical test checks if the results of the means of two populations vary from each other. Moreover, when there is a standard deviation given and the sample size is large.On the other hand,Chi-square is a procedure used for testing if two categorical variables are related in some population or not.

Z-test is typically used for dealing with problems relating to large samples (n>30). It is easier to use when the standard deviation is available. It is a statistical procedure to give an alternate hypothesis against a null hypothesis.

The Chi-square test used for testing relationships between categorical values. The null hypotheses of the Chi-square say that two categorical variables in the population should be independent.

## Comparison Table Between Z-Test and Chi-Square (in Tabular Form)

Parameter of Comparison | Z-Test | Chi-square |
---|---|---|

Statistic used | The statistics used for the alternate hypothesis testing is called Z-statistic. | The statistics used for null hypothesis testing is called the Chi-square statistic. |

Null and Alternate values | Null: The sample mean is the same as the population mean. | Null: Both the Variables C and D are independent. |

Alternatively, it can be said that the results of sample mean and population mean should be different. | Alternative: Both variable A and variable B are not independent. | |

Conditions | Standard deviation should be known. The sample size should be large enough or else z-test may not perform well. A normal distribution should be followed by the test statistics. | There should be a minimum of five observations in each of the levels of variables. The test can be done only if there are categorical values. The sampling method should be simple and random. |

Formula | z = (x-μ)/(σ / √n) Where, x = sample mean. μ = population mean. σ / √n = standard deviation. | Χ2 = Σ(O − E)2/E Where, O = each Observed (actual) value E = each Expected value |

Uses | Determines if the results of two means obtained from two populations are different, when the variance and data is large | Uses categorical data in comparing two or more groups where the values are mentioned. |

## What is Z-Test?

A Z-test is noting but a type of hypothesis test. The samples are usually distributed while conducting the test. It is used only when there is a given standard deviation and the sample data should always be large (n>30).

In other words, it validates hypotheses drawn by the sample to same population.

Conditions required to perform a Z-test:

- The sample data should be greater than 30.
- The data points should be independent of each other, that is there should be no similarities or overlapping.
- The data should always be normally distributed.
- From the population, the data is collected through random sampling.

How to run a Z-test?

- First the null (H0) must be stated and then alternativehypotheses(HA).
- Then, choose the alpha level.
- The Z table is used for determining the criticality of Z.
- The Z state statistic is now calculated.
- The test statistic should be compared now with the critical value z. This will lead you to the solution whether to accept the null hypotheses (H0).

Advised that Z-test should be to analyse the null hypothesis when the data is in large scale and the standard deviation known.

## What is Chi-Square?

The Chi-Square test is best defined as a statistical hypothesis test. This test is used either for comparing a group having a value or in comparing multiple groups with categorical data.

The advantages of this test are the robustness with respect to the given data. It can only be used when two categorical variables are there and related to some population.

The Chi-square test is a goodness fit statistic because it measures how well the observation data fits the distributed data. It can only happen when the two given variables are independent of one another.

**Main Differences Between Z-Test and Chi-Square**

- Both these tests are statistical hypotheses. They can be used only when the given data is on a larger scale.
- Z-test used only when there is a given standard deviation and the data is larger than 30 size. But, Chi-square is used when two categorical variables are independent of each other and belong to the same population.
- Z-test concludes whether the null hypothesis accepted or not and Chi-square used to compare between the given two variables.
- In Z-test, the samples are evenly distributed, whereas in Chi-square it should be simple and randomly selected from the given population.
- The both tests used different methods but used for giving alternate hypotheses to the null value hypotheses.

## Conclusion

Both the test methods are useful for large scale data. They have their own unique methods and limitations. Z-test data can happen only when there is a given standard deviation, that helps the test to be applicable. Whereas the Chi-square is helpful when two different variables are independent of each other. Both the statistical tests are useful and give better hypotheses for large scale data.