Test for Qualitative variables Chi Square Test Dr. Asif Rehman
Outline Types of Variables Quantitative Data Assessment (parametric) Descriptive assessment T-test Qualitative Data Assessment (Non parametric) Descriptive Assessment Chi Square test(Fisher Exact test)
Types of Data Quantitative data or numerical data Qualitative or Categorical data Nominal Data(unordered, Do not represent any amount) Sex (male,female) Marital status (Married, Unmarried) Blood group (O, A, AB, B) Color of eyes (blue, green, brown,Black) Nationality of a person (Pakistani, American, Turkish) Ordinal data(ordered) Measurement of height (tall, medium, short ) Degree of pain (mild, Moderate, severe) Size of garment (large, medium,small )
Chi square test are done when; Chi square test is used when both variables are measured on a nominal scale It can be applied to interval or ratio data that have been categorized in to a small number of groups It assumes that the observations are randomly sampled from the population All observations are independent (an individual can appear only once in a table and there are no overlapping categories)
Categorical data assessment Chi Square test (X 2 ) Compares observed and expected frequencies. This test is applied to compare two or more than two proportions to test whether there is significant association between two are not It is non parametric test, but is included in traditional methods of parametric tests
Chi Square test The chi-square test is always testing what scientists call the Null Hypothesis, which states that there is no significant difference between the expected and observed result. For estimating how closely an observed distribution matches an expected distribution For estimating whether two random variables are independent.
Conducting Chi-Square Analysis 1) Make a hypothesis based on your basic research question 2) Determine the expected frequencies 3) Create a table with observed frequencies, expected frequencies, and chi-square values using the formula: (O - E) 2 E 4) Find the degrees of freedom: (C - 1)( R - 1) 5) Find the chi-square statistic in the Chi-Square Distribution table 6) If chi-square statistic > your calculated chi-square value, you do not reject your null hypothesis and vice versa.
Example To see the prophylactic value of Chloroquine, a study was conducted on 3540 persons. Out of 606 persons, who were given Chloroquine prophylactically, only 19 contracted malaria. Among those who were not given prophylactic treatment 193 contracted malaria. Comment on prophylactic value of Chloroquine.
Descriptive frequencies Total study population(n)= 3540 Chloroquine given= developed malaria=19 2. Did not developed malaria=587 Chloroquine not given= Contracted malaria= Did not contract malaria=2741
2x2 contingency table Contracted malaria Did not contract malaria Total Chloroquine given Chloroquine not given Total n=3540
Null Hypothesis (H 0 ) Chloroquine has no role in prevention of malaria. At the end we have to reject or Accept the hypothesis
Calculation of expected values E= Row total x Column total/Grand total = RT x CT/GT E 1 = 606 x 212/3540 = 36 E 2 = 606 x 3328/3540 = 570 E 3 = 2934 x 212/3540 = 176 E 4 = 2934 x 3328/3540 = 2758
2x2 contingency table Contracted malariaDid not contract malaria Total Chloroquine givena (36)b (570) Chloroquine not givenc (176)d (2758) Total Expected E= Row total x Column total/Grand total = RT x CT/GT E 1 = 606 x 212/3540 = 36 E 2 = 606 x 3328/3540 = 570 E 3 = 2934 x 212/3540 = 176 E 4 = 2934 x 3328/3540 = 2758
2x2 contingency table Contracted malariaDid not contract malaria Total Chloroquine given Chloroquine not given Total n=3540 Contracted malariaDid not contract malaria Total Chloroquine given36570 Chloroquine not given Total Observed Expected
Calculation of x 2 value Observed value (O) Expected value (E) O-E(O-E) 2 (O-E) 2 /E O 1 =19E 1 = O 2 =587E 2 = O 3 =193E 3 = O 4 =2741E 4 = ∑=10.26
Calculation of degree of freedom Degree of freedom = (R - 1) x (C - 1) = (Rows-1) x (Column-1) = (2 - 1) x (2 - 1) = 1
Calculation of degree of freedom Degree of freedom = 1 Level of significance = 5% (0.05) Value = 3.84
Chi Square Table
Interpretation of results by consulting X 2 Table Table value of X 2 with 1 degree of freedom, at the significance level of 5% (0.05) is 3.84 Our calculated value of X 2 is which is more than table value of 3.84 So we will reject the null hypothesis and will say that chloroquine does have the prophylactic role in malaria and P < (the probability of occurrence of difference between two groups of persons only due to chance is <0.05 or 5%.
Exercise Suppose we have two vaccines A and B for the prevention of Measles and we have to decide which vaccine is more effective to be included in National program. We applied vaccine A to 100 children and 20 of them later developed infection. We applied vaccine B in another 100 children and 15 developed infection. Apparently vaccine be is better than A. 1. State your Null Hypothesis and Alternate Hypothesis 2. Make 2 x 2 table 3. Calculate chi square test 4. Interpret the results
THANK YOU