How to work out chi square independence in the following table?
Below is the observed and expected data concerning 7 themes displayed in a newspaper over a period of 3 months. I understand how to work out chi square but not with this number of columns and rows. Thank you!
May June July Total May June July Total
Gov 16 34 28 78 Gove 18.525 29.25 30.225 78
Mort 1 0 1 2 Mort 0.475 0.75 0.775 2
Damage 0 2 1 3 Damage 0.7125 1.125 1.1625 3
Recon 0 3 7 10 Recon 2.375 3.75 3.875 10
Relief 18 16 18 52 Relief 12.35 19.5 20.15 52
Health 0 0 2 2 Health 0.475 0.75 0.775 2
Survi 2 3 4 9 Survi 2.1375 3.375 3.4875 9
Other 1 2 1 4 Other 0.95 1.5 1.55 4
Total 38 60 62 160 Total 38 60 62 160
$$ \small \begin{array} {r|rrr|r||r|rrr|r} obsrv. & May & June & July & Total & expct. & May & June & July & Total \\ \hline Gov & 16 & 34 & 28 & 78 & Gove & 18.525 & 29.25 & 30.225 & 78 \\ Mort & 1 & 0 & 1 & 2 & Mort & 0.475 & 0.75 & 0.775 & 2 \\ Damage & 0 & 2 & 1 & 3 & Damage & 0.7125 & 1.125 & 1.1625 & 3 \\ Recon & 0 & 3 & 7 & 10 & Recon & 2.375 & 3.75 & 3.875 & 10 \\ Relief & 18 & 16 & 18 & 52 & Relief & 12.35 & 19.5 & 20.15 & 52 \\ Health & 0 & 0 & 2 & 2 & Health & 0.475 & 0.75 & 0.775 & 2 \\ Survi & 2 & 3 & 4 & 9 & Survi & 2.1375 & 3.375 & 3.4875 & 9 \\ Other & 1 & 2 & 1 & 4 & Other & 0.95 & 1.5 & 1.55 & 4 \\ \hline Total & 38 & 60 & 62 & 160 & Total & 38 & 60 & 62 & 160 \\ \end{array} $$
The test statistic would be $$ \sum \frac{(\text{observed}-\text{expected})^2}{\text{expected}}. $$ It should have a chi-square distribution with $(8-1)(3-1)=14$ degrees of freedom if the hypothesis of independence is true. It it has an improbably large value, you reject the null hypothesis.