fofopausiomiava

2022-10-11

For Chi-Squared test on contingency tables there is a proof to get from: $\sum \frac{\left({O}_{i}-{E}_{i}{\right)}^{2}}{{E}_{i}}$ which equals $\frac{N\left(ad-bc{\right)}^{2}}{\left(a+b\right)\left(c+d\right)\left(a+c\right)\left(b+d\right)}$Can anyone explain the steps in the proof i know how to get from one to other but not sure why certain steps happen!
Below ill put the proof if anyone wants to see it or can explain it?

domino671v

Same way, but done by human:
Starting with ${\chi }^{2}=\sum _{i=1}^{4}\frac{\left({o}_{i}-{e}_{i}{\right)}^{2}}{{e}_{i}}$, and expand the square:
${\chi }^{2}=\sum _{i=1}^{4}\frac{\left({o}_{i}-{e}_{i}{\right)}^{2}}{{e}_{i}}=\sum _{i=1}^{4}\left(\frac{{o}_{i}^{2}}{{e}_{i}}-2{o}_{i}+{e}_{i}\right)=\sum _{i=1}^{4}\frac{{o}_{i}^{2}}{{e}_{i}}-n$
(since $\sum {o}_{i}=\sum {e}_{i}=n$)
Substitute the values in:
${\chi }^{2}=\frac{n{a}^{2}}{\left(a+c\right)\left(a+b\right)}-a+\frac{n{b}^{2}}{\left(b+d\right)\left(a+b\right)}-b+\frac{n{c}^{2}}{\left(a+c\right)\left(c+d\right)}-c+\frac{n{d}^{2}}{\left(c+d\right)\left(b+d\right)}-d$
Notice:
$an-\left(a+c\right)\left(a+b\right)=a\left(a+b+c+d\right)-\left(a+c\right)\left(a+b\right)=ad-bc$
So,
$\frac{a}{\left(a+c\right)\left(a+b\right)}\left[na-\left(a+c\right)\left(a+b\right)\right]=\frac{a\left(ad-bc\right)}{\left(a+c\right)\left(a+b\right)}$
Do the same thing for b,c,d.

Do you have a similar question?