In this article, we are going to learn about how to find the Z Critical Value in Python.
In statistics, the area under the commonly used normal model is called the Z critical value. Shows the probability for each possible variable. When we perform a hypothesis test, what is produced is a test statistic. To determine whether the results of a hypothesis test are statistically significant, you can compare the test statistic to the Z critical value. A result is considered statistically significant when its absolute value exceeds the Z critical value. This tutorial will show you how to determine the Z critical value in Python.
When performing a hypothesis test, you will get a test statistic as the result. In order to determine whether the results of a hypothesis test are statistically significant, the test statistic needs to be compared with the Z critical value. If the absolute value of the test statistic exceeds the Z critical value, the test result is statistically significant.
In Python, you can use the scipy.stats.norm.ppf() method to get the Z critical value, the syntax is as follows −
scipy.stats.norm.ppf(q)
where q represents the significance level to be used.
Suppose we want to determine the Z critical value of a left-tailed test with a significance level of 0.05 −
!pip3 install scipy import scipy.stats #find Z critical value scipy.stats.norm.ppf(.05)
-1.6448536269514729
The value of key value Z is -1.64485. If the test statistic is below this threshold, the test result is statistically significant.
Suppose we are looking for a Z critical value for a right-tailed test with a significance level of 0.05 −
import scipy.stats #find Z critical value scipy.stats.norm.ppf(1-.05)
1.6448536269514722
Z is 1.64485. Therefore, if the test statistic is higher than this number, the test result is considered statistically significant.
Suppose we are looking for the Z critical value for a two-tailed test with a significance level of 0.05 -
import scipy.stats #find Z critical value scipy.stats.norm.ppf(1-.05/2)
1.959963984540054
There are always two essential values when you do a two-tailed test. 1.95996 and -1.95996 are the Z critical values in this situation. Therefore, the test's findings are statistically significant if the test statistic is either less than -1.95996 or more than 1.95996.
In statistics, the Z-critical value is used to determine insights from the data so machine learning models can use it and make predictions based on it.
The above is the detailed content of How to find Z critical value in Python?. For more information, please follow other related articles on the PHP Chinese website!