The are two main approaches for statistical hypothesis testing. The classical method follows the sequence of steps described in the article about z-test. The second approach uses the p-value. This method is preferred by some of statistical software and therefore it is useful to understand it.
In terms of statistics, the p-value is defined as a probability that the null hypothesis is true. We will use this knowledge to create a simple rule how to decide whether we should reject the null hypothesis: If the p-value is lower than the level of significance then the null hypothesis is rejected. Otherwise it is not rejected.
The calculate the p-value, we need to know the value of the test statistics. Let’s go back to the example from the article about z-test. The value of the statistics of the test was -1.2125. We are performing two-tailed test for which is the computation of the p-value slightly more complicated than for one-tailed.
We can see the probability density function of the test statistics (which has the normal distribution) at the figure below. The level of significance is 5 % so the size of the red area is 0.05. The p-value is depicted by the blue hatched area from to the value of the statistics. To be able to compare it the p-value with the level of significance, we need to add the second blue hatched area – the one from 1.2125 to $\infty$.
p-value can be calculated as the area below the probability density function. In other words, it is the value of the distribution function of the standard normal distribution for the value of the statistics multiplied by 2.
The exact value cannot be found in the statistical tables, but we can use plenty of software product to calculate it. For example, in Microsoft Excel we can use the function NORM.S.DIST (distribution function of the standard normal distribution) and multiply the result by 2 to see 0.225 is the p-value of the test. Please note that .
Now we will look the the boundary case. Let’s assume that the value of the statistics is – 1.96, so it equal the side point of the critical region. In this case both read and blue hatched area have the same side points and therefore their areas must be the same. So the area of the blue hatched area is 0.05, i.e. the p-value is 5 %.
Now let’s assume that the value of the statistics lies in the critical region, for example it equals -2.40. At the figure below it can be seen that the blue hatched area is smaller than the red one. So the p-value is smaller than the level of significance and the null hypothesis is rejected.