Pearson's Chi-Square Test of Independence

From Q
Jump to: navigation, search

Pearsons's Chi-Square Test of Independence tests the independence between two categorical variables, x and y which contain s and r categories respectively. The test statistic is

X^2 = \sum^s_{k=1}\sum^r_{j=1} \frac{(o_{kj} - e_{kj})^2}{e_{kj}}

where:

o_{kj} = \sum^n_{i=1} w_i I_{x=k,y=j},
w_i is the Calibrated Weight of the ith of n observations,
e_{kj} =  \frac{\sum^s_{k=1} o_{kj} \times \sum^r_{j=1} o_{kj}}{ \sum^n_{i=1} w_i}
p \approx \Pr(\chi^2_{(s-1)(g-1)} \ge X^2)