 Hello friends, in this video, we are going to see about how to perform chi-square test. This video explains about manual calculation of chi-square test. Before going to the chi-square test calculation, we need to understand these four basic background knowledge for better understanding of chi-square test. First one is about the type of variables, where we have two types of variables. Variable are nothing but the attribute of the individual, which differs from one individual to other individual. Each and every single question in the research will become a variable or some questions combined together make one variable. Say for example, weight may be one single variable or if you calculate BMA out of weight and height, that also becomes a variable. So, variable varies between individuals. In this point, we need to understand there are two types of variables, categorical and numerical. You can also know the fact that categorical can be again divided into nominal and ordinal, where nominal means it's just a name. Example, all your gender, blood group, all will become a nominal variable. Ordinal means the variables follow the rank order. Even though they are categorical, they have a rank order. For example, mild, moderate, severe, anemia will be a categorical variable. On the other hand, numerical variable can be again divided into two types. That is discrete and continuous. Discrete means the whole number and continuous means there will be decimals. On the other hand, numerical variables can be again divided into interval and ratio. The example for ratio scale is weight. If you are not getting the types of variables clearly, just for the chi-square calculation, you need to remember that there are two types of variables, categorical and numerical. And we are going to use this chi-square test for two categories. That is, the purpose of chi-square test is to compare between two categorical variables or to study the test of association between two categorical variables. That is the purpose of this test. For example, I have told gender and blood group is a categorical variable. So, when we are studying association between gender and blood grouping, then you can use chi-square test as a test of association. That is the second important background knowledge, which you need to understand for computing chi-square test. The third important point is, you need to understand about the hypothesis. That there are two hypotheses available in research. That is one is the null hypothesis, null means nothing. It says that there is no association between these two variables. On the other hand, alternate hypothesis or the research hypothesis says there is a relationship between these two categorical variables. The fourth one is the type of errors. We have two types of errors in research that is alpha error and beta error. We need to understand the fact that in research, we have this null hypothesis which says there is no relationship. In reality, this may be either true or false. There are two possibilities for this. It may be either true or false. On the other hand, our study result, it can either accept it or reject it. So, when we make the possibilities, there are four possibilities. That is, we can accept when the null hypothesis is true. That is a true positive result. On the other hand, we have true negatives. That is, we reject the null hypothesis when it is actually false. For both these situations, they are not errors. That is true positives and true negatives. We will be happy with the study results. The null hypothesis and our study results are syncing with the reality. On the other hand, we have two types of errors. That is, when the null hypothesis is actually true, but you still reject it. That is, you are rejecting the null hypothesis when it is actually true. That is an error. That error is called as alpha error. The second type of error, that is type 2 error or beta error, is the false negatives except the null hypothesis when it is actually false. So, you can remember this by a mnemonic called ART. That is, alpha error is rejecting the null hypothesis when it is actually true. The reverse is, the beta error or type 2 error, alpha error is type 1 error, beta error is type 2 error, is accepting the null hypothesis when it is false. And you should remember the fact that both these places, we are dealing with null hypothesis and we never deal with the alternate hypothesis. And why do we know these types of errors in chi-square test calculation is? The inverse of this beta error is called as the power of the study. The probability of committing the alpha error is called as p-value of the study. To understand p-value, we should know about the errors. And p-value is nothing but the probability of committing this alpha error. To expand, p-value is nothing but the probability of rejecting the null hypothesis when it is actually true. So, we need to understand these four important points. And that is the type of variables. We have categorical and numerical. And the purpose of chi-square test is to test for association between two categorical variables. And we have two hypothesis that is null hypothesis and alternate hypothesis or research hypothesis. And we have two types of errors. The probability of committing this alpha error is called as p-value. With this knowledge, we move on to chi-square test calculation. As we told earlier, chi-square test is used for testing association between two categories or two proportions. So, we have given two categories that is one pass or fail is a category and male and female is a category. So, we are going to compare whether there is any association between gender and exam results. So, we have got the results like this. We are going to apply this chi-square test for this purpose. Now, we need to understand chi-square test has four steps. Number one is we need to state the hypothesis. That is we have two hypothesis that is alternate or research hypothesis and null hypothesis. Alternate hypothesis or research hypothesis says that there is a relationship between two variables. On the other hand, null hypothesis says that there is no relationship. Then the second step that is the lengthiest and difficult step of chi-square test. So, we are going to see this in detail. That is we need to calculate the chi-square test value, calculation of expected cells of the each cell and chi-square value will be calculated. So, the expected value of each cell will be calculated by multiplying row total into column total divided by grand total. So, that is the formula for getting this expected value. I will let you know how it is. So, this was the table which was given. We are going to study the association between the gender and the exam results. So, we are going to calculate the expected cell values. Because what we get here is the observed value and expected value is calculated by multiplying the column total into row total divided by grand total. So, we get like this. So, for this first cell alone, the expected value is 88.55. I would advise you to put up a table for this where we have this serial number 1, 2, 3 and 4. So, here we put up the observed values. Here first is observed value 83, 27, 78 and 12. Then we calculate the expected value. For the first cell, it is 88.55. So, then we calculate the observed minus expected. Then we calculate the observed minus expected, the whole square. Then we calculate the observed minus expected, whole square divided by expected. So, here in this case, observed minus expected will be 5.55. Then we need to calculate the 5.55 whole square. Then we need to divide it with the expected value. That is, here it is 5.55 whole square divided by 88.55. So, we need to do this for all the cells. We need to total or sum this up. What we get here is the sigma observed minus expected, the whole square divided by expected. So, that is the chi square value. So, I repeat, the chi square value is given by the formula sigma observed minus expected, the whole square divided by expected. This is the most lengthier and difficult step in calculating the chi square value. So, chi square value is given by this formula. So, I would advise you to put up a table for this. We need to put up the observed value whatever in the table here. We need to calculate the expected value which is given by rho total into column total divided by grand total. So, with that formula we need to calculate the expected value. Then observed minus expected, then observed minus expected the whole square. Then observed minus expected the whole square divided by expected. Then we need to sum up all these values. We will get the chi square value that is sigma observed minus expected divided by expected value. Then we move on to the third step that is the calculating the degree of freedom. Degree of freedom is given by column minus 1 into rho minus 1. That is we have two column here. So, minus 1 into rho minus 1 that is 2 minus 1. So, 1 into 1 is equal to 1. So, degree of freedom here in this 2 bar 2 table is 1. Most commonly for examination purpose you will get only 2 bar 2 table. So, you can remember the degree of freedom as 1 and you can remember this formula. If suppose you get 3 bar 2 table then 3 minus 1 into 2 minus 1. So, you will get the degree of freedom as 2. But in exams you will get only 2 bar 2 table calculation. Then the fourth important step is interpreting the probability value using the probability table. This is the probability table. This is the table of chi square test or the probability value. So, where you can see the degree of freedom which is increasing from 1 to 10 here. So, you need not look at down. So, you can look at only the degree of freedom 1. In the rho it is the p value this is 0.50, this is 0.10, this is 0.05. We all know 0.05 is a critical point for significance. So, below which we say there is a significant association, above which we say there is no significant association. So, this point is very critical and for this 0.05 level the chi square value is 3.84. If you carefully look at the chi square value increases as the p value decreases that is 3.84, 5.41, 0.05 and 0.2. If you get the chi square value greater than 3.84 your p value will be less than 0.05. So, that is the sentence provided here that is for 2 bar 2 table that is degree of freedom 1. The critical value of p value that is less than 0.05 the test value should be greater than 3.84. Now, let me go back to this original calculation where if you calculate this you will get the chi square value as 3.98. So, this 3.98 is greater than 3.84. So, how to interpret this is there is a significant association between gender and the exam results. And if you want to go one step ahead that you need to look at the percentages the high percentage of fast is among females the past percentage among females is significantly higher when compared to the males. So, I repeat to understand the chi square test you need to understand 4 important points that is first the types of variables there are 2 types categorical and numerical and the purpose of the chi square test is to study the association between 2 categorical variables and we have 2 hypothesis that is null hypothesis and alternate hypothesis we have 2 types of errors the alpha error and beta error p value is nothing but the probability of committing this alpha error rejecting the null hypothesis when it is actually true. So, p value is the probability of rejecting the null hypothesis when it is actually true. So, that is the background knowledge you needed for calculating the chi square test and what are all the steps in calculating the chi square test is there are 4 steps that is we need to state the hypothesis there are 2 hypothesis alternate and null hypothesis and calculate the chi square test value chi square test value will be calculated by calculating the expected value which is given by the formula row total into column total divided by grand total. So, after calculating the expected value chi square value is given by the formula sigma observed minus expected the whole square divided by expected then we have to calculate the degree of freedom for 2 bar 2 table the degree of freedom will be 2 minus 1 into 2 minus 1 is equal to 1. So, then we need to look at the probability table we need to understand the fact that when the chi square value is more than 3.84 the p value will be less than 0.05 for a degree of freedom of 1 after this we need to provide the interpretation whether the p value is significant or not based on this chi square value. In manual calculation we may not get the exact p value, but if we are doing with an online calculators or software such as SPSS you will get the exact p value that is the probability of rejecting the null hypothesis when it is actually true. Even though chi square calculation is little lengthy and difficult why it is included in UG curriculum is that when you are calculating this chi square test you will be able to understand many parameters which is related to research such as the types of variables p values etcetera. Thanks for watching this video if you like this video please share it to your friends if you haven't subscribed to the channel please subscribe.