# How to execute χ-square test with cross tabulation?

Pocket

You can execute $\chi^2$ test with cross tabulation by such formula as below. In each cells, subtract expected value (E) from observed value (O), square the subtraction, divide the squared by expected value and add them all.

$\displaystyle\chi^2(df)=\sum\frac{(O-E)^2}{E}$

df: degree of freedom

$\chi^2$ statistics follows $\chi^2$ distribution. When degree of freedom is 1, $\chi^2$ statistics is 3.841 if probability is smaller than 0.05 in one sided test, $\chi^2$ is 6.635 if p

 TRUE FALSE Marginal total POSITIVE a b a + b NEGATIVE c d c + d Marginal total a + c b + d N
$\displaystyle \begin{array}{rcl}\chi^2&=&(ad-bc)^2\times\frac{N}{(a+b)(c+d)(a+c)(b+d)}\vspace{0.2in}\\\chi^2(Yates)&=&\left(|ad-bc|-\frac{1}{2}\right)^2\times\frac{N}{(a+b)(c+d)(a+c)(b+d)}\end{array}$
Pocket