
237Data Analysis and Statistical Testing
relationship between the two attributes. Thus, chi-square test is an appropriate
test for checking the independence of the two attributes.
Step 3: Apply test and calculate p-value.
Calculate the expected frequency of each cell according to the following formula:
E
NN
row,column
rowcolumn
=
×
Table6.19shows the calculated expected frequency of each cell.
Now, calculate the chi-square value for each cell according to the following
formula as shown in Table6.20:
χ
2
2
=
−
∑
O
ij ij
ij
E
E
Finally, calculate the overall
χ
2
value by adding all corresponding
χ
values of
each cell.
χ
2
0 017 0 018 0 093 0 022 0 023 ...