You are on page 1of 8

Test for Association of Attributes

CONTINGENCY TABLES

A frequency table in which a sample is classified according to


the distinct classes of two different attributes is called a
contingency table.
It is often of interest to test the hypothesis that, in the
population from which the sample was drawn, the two
attributes are independent.
An mxn contingency table has m rows and n columns.
Test for Association of Attributes

A typical mxn contingency table


Rows Columns ( Attribute 1)
(Attribute 2) 1 2 ... j … n Total
1 O11 O12 O1j O1n R1
2 O21 O22 O2j O2n R2
. . . . .
i Oi1. Oi2. Oij Oin. Ri
. .
m Om1 Om2 Omj Omn Rm
Total C1 C2 Cj Cn N
Test for Association of Attributes

The expected frequency of the cell corresponding to i-th row and


j-th column is found by

i th Row Total  j th Column Total Ri  C j


Eij = =
Grand Total N

Using the observed frequencies given in the contingency table


and the expected frequencies found using the above formula, we
may test the null hypothesis that,
H0: The two attributes are independent (or) the two
attributes are not associated.
H1: The two attributes are not independent (or) the
two attributes are associated.
Chi-square test for Independence of Attributes

➢ The test statistic to test the above hypothesis is:


m n (Oij − Eij ) 2
2 =
i j Eij
(O − E ) 2
or simply  = 
2
for easy of understanding.
E

➢ This statistic has chi-square distribution with (m-1)(n-1)


degrees of freedom.
➢ The decision is to reject the null hypothesis H0 if the
calculated value of , is greater than the table value at α
level of significancecorresponding
2
to (m-1)(n-1) degrees of
freedom.
Chi-square test for Independence of Attributes
EXAMPLE
The following data were collected in a study on the effectiveness
of inoculation for a particular disease. The two attributes in this
case are;
Attribute A: whether or not the person was inoculated; and
Attribute B: whether or not they contracted the disease
The 2x2 contingency table is
Attribute B
Attribute A Disease No disease
Inoculated 10 50
Not Inoculated 30 40
Chi-square test for Independence of Attributes

In this case the null hypothesis and alternative hypothesis are


stated as,
H0: Contracting the disease is independent of inoculation
H1: Contracting the disease is not independent of inoculation
Expected Frequencies
Expected frequencies Disease No disease Total
Inoculated 18.5 41.5 60
Not Inoculated 21.5 48.5 70
Total 40 90 130
Chi-square test for Independence of Attributes

The test statistic is

 =
2 ( O − E)
2

=
( . ) (50 − 415
10 − 185
2

+
. ) ( 30 − 215
2

+
. ) ( 40 − 485
2

+
.)
2

= 105
.
E 185
. 415
. 215
. 485
.

The critical value for a 1% significance level with 1 d.f. is 6.63.


The null hypothesis is therefore rejected at this level and it can
be concluded that inoculation does have an effect on the
probability of contracting the disease. From the contingency
table it can be seen that inoculation reduces the risk.
Chi-square test for Independence of Attributes
A major insurance firm interviewed a random sample of 1,200
college students to find out the type of life insurance preferred, if
any. The results follow:
Insurance Preference
Gender
Term Whole Life No Insurance
Female 100 80 325
Male 160 60 475

Is there evidence that life insurance preference of male students


is different than that of female students? Test using the 5% level
of significance.

You might also like