When you perform an analysis on a sample, you only get the statistics of the sample. You want to make claims about the entire population using the sample statistics. But remember that these are just claims; so, you cannot be sure that they are true. This kind of a claim or assumption is called a hypothesis.
For example, your hypothesis may be that the average lead content in a food product is less than 2.5 ppm, or the average time to resolve a query at a call centre is 6 minutes.
Whatever your hypothesis is, it is only a claim based on a limited amount of data and not the entire population. Hypothesis testing helps you statistically verify whether a claim is likely to be true or not for the whole population.
Thus, we can say that hypothesis testing is a method or procedure that tests the statistical validity of a claim.
The components involved in hypothesis testing are as follows:
Null hypothesis: A null hypothesis is a prevailing belief about a population; it states that there is no change or no difference in the situation and assumes that the status quo is true. It is denoted by .
Alternative hypothesis: An alternative hypothesis is a claim that opposes the null hypothesis. It challenges the status quo and may or may not be proved. It is symbolised by .
Let’s understand these with the help of an example.
Jeep, a well-known car maker, claims that its car ‘Compass’ gives a mileage of at least 17 km/litre.
The null hypothesis for this case would be:
: μ ≥ 17
And the alternative hypothesis is:
: μ < 17
An important thing to note is that a null hypothesis always has the ‘=’ sign and is a common belief about the population, while the alternative hypothesis never has the ‘=’ sign and always challenges the status quo.
Steps in hypothesis testing
The process of hypothesis testing has a well-defined path that stems from our intuition. For the sake of simplicity, it can be broken down into easy-to-remember steps.
The first step in the process is to define the hypothesis. This involves stating the null and alternative hypotheses for the problem. For example, Google claims that its internet browser ‘Chrome’ is the best in the industry, as it has an optimum boot time of only 250 ms, with a standard deviation of 9 ms. Sam, a tech geek, wanted to test the claim of Google. So, he randomly collected boot time data of 165 devices of Chrome and got a sample mean of 247 ms.
Based on this, the hypotheses can be defined as follows:
Ho: μ = 250, i.e., the mean boot time is 250 ms.
Ha: μ ≠ 250, i.e., the mean boot time is not 250 ms.
The next step is to identify the associated distribution.
Condition 1: n >30, which means that the population sample size should be greater than 30 observations.
Condition 2: 𝝈 is known, i.e., the population standard deviation is known.
Now, if both these conditions are satisfied, you go for a normal distribution or Z-test; otherwise, you use the t-test.
This problem satisfies both these conditions, as the sample size is 165 and the standard deviation is 9 ms. So, you go for a normal distribution.
The next step is to determine the test statistic. A test statistic, in simple terms, is a value that is to be calculated from some given data, which is then used to compare the results arrived at with the tabular values.
The test statistic for a normal distribution or a Z-test is defined as:
Here, x is the process mean, μ is the population mean, σ is the standard deviation and n is the sample size.
In this example, the distribution is normal. So, let’s calculate the test statistic using the aforementioned formula, which gives us:
Z = (247 - 250)/(9/√165)
Z = -4.3
Continuing with our demonstration on the ‘Chrome’ browser, we will now test our hypothesis at a 95% confidence level. For a 95% confidence interval, Z critical value = +1.96 and -1.96; these are the upper and lower critical values, respectively. The test statistic value we calculated is -4.3.
The region between +1.96 and -1.96 is called the acceptance region, and the region outside it is called the critical region.
So, the question that arises is: How do you compare the two Z-statistics? This comparison is done on the basis of whether or not the calculated Z-statistic lies in our stated confidence interval, also called the region of acceptance.
If the calculated Z-statistic is in the region of acceptance, you fail to reject the null hypothesis. If the calculated Z-statistic lies outside the region of acceptance, i.e., in the critical region, you reject the null hypothesis.
Going back to our previous example, the test statistic value is -4.3, which lies outside the region of acceptance of ±1.96. So, you reject the null hypothesis.
It is also important to understand that you can never accept the null hypothesis, you can only fail to reject it. This is because the whole testing takes place with an aim to reject the present status quo, which is what the alternative hypothesis is. So, you try and gather support for the alternative hypothesis so that you can reject the null hypothesis. Similarly, you can never say that you reject the alternative hypothesis; instead, you say that you failed to reject the null hypothesis.
For instance, suppose that your friend Diksha tells you that she has an average score of 80 in the game of pistol shooting, based on all her past games. But you don’t believe her. So, you decide to test her claim and ask for five rounds of shooting.
The null hypothesis would be that Diksha’s average score is 80, which is represented as µ= 80.
Here, the critical region lies on both sides of the population mean. But this is not the case always.
The critical region depends upon the nature of the alternative hypothesis. An alternative hypothesis can be of two types:
1. Non-directional
2. Directional
Let’s see what these terms mean. In this example, the null hypothesis, H0, is µ = 80, i.e. Diksha’s average score is exactly equal to 80. So, your alternative hypothesis,Ha, will be µ ≠ 80. This does not specifically say that it is more than 80, or less. The population mean can be more or less than 80. So, there is no indication of the direction in which it will lie, i.e., whether towards the left end or the right end of the distribution. Therefore, this kind of an alternative hypothesis is called a non-directional hypothesis.
When you test any non-directional hypothesis, you need to define the critical region on both the sides, as you need to check whether the sample mean lies to the left or the right of the assumed population mean.
This kind of a test is called a two-tailed test because you have to check both the tails of the sampling distribution.
But there are cases where you are only interested in finding whether the mean is lower or higher than the claimed value.
For example, if Diksha now claims that her average shooting score is greater than or equal to 80, the null hypothesis will be µ ≥ 80. In this case, the alternative hypothesis will be µ < 80. It will hypothesise that the population mean lies in a particular direction from the assumed mean. Such an alternative hypothesis is called a directional hypothesis.
In this case, since H1: µ < 80, the critical region will lie on the left tail of the sampling distribution. Thus, the hypothesis test is called a one-tailed test, and more specifically, a lower-tailed test.
Similarly, if the null hypothesis is H0: µ ≤ 80, then H1: µ > 80.
This alternative hypothesis is also a directional hypothesis, and the critical region will lie on the right tail of the sampling distribution. So, the hypothesis test is called a one-tailed test, and more specifically, an upper-tailed test.