Pearson's Chi-Square Test of Independence

From Q
Jump to navigation Jump to search

Pearsons's Chi-Square Test of Independence tests the independence between two categorical variables, [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] which contain [math]\displaystyle{ s }[/math] and [math]\displaystyle{ r }[/math] categories respectively. The test statistic is

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

where:

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