I am having difficulty in how to calculate the Pearson's $\chi^2$ statistic for a contingency table with entries: (3, 0) and (0, 3) (row-wise).

I was studying Agresti's categorical data analysis and found this table. He calculated it as 6.

Through what calculation did he reach this answer?


Here is the procedure to be followed in order to compute Pearson's Chi-squared statistic.

Assume this is your observed 2x2 contingency table:

$$\begin{array}{c|cc|c} \hline X/Y & \textrm{cat 1} & \textrm{cat 2} & \textrm{tot} \\ \hline \textrm{cat 1} & O_{11} & O_{12} & O_{1.}\\ \textrm{cat 2} & O_{21} & O_{22} & O_{2.}\\ \hline \textrm{tot} & O_{.1} & O_{.2} & O_{..} \end{array}$$

  • there are $O_{11}$ observations that fall within the first category of $X$ $\underline{\textrm{and}}$ within the first category of $Y$;
  • There are $0_{2.}$ observations that fall within the second category of $X$;

  • the total sample size is $O_{..}$.

1st step: Compute the expected contingency table

$$\begin{array}{cc} \hline E_{11} & E_{12} \\ E_{21} & E_{22} \end{array}$$


$$E_{ij} = \frac{O_{i.} O_{.j}}{O_{..}} \cdot$$

2nd step Compute Pearson's statistic:

$$\chi^2 = \sum_{ij} \frac{(O_{ij} - E_{ij})^2}{E_{ij}} \cdot$$

  • $\begingroup$ Note that this can be generalised to higher dimensions... $\endgroup$ – ocram Feb 26 '12 at 11:14
  • $\begingroup$ I'm speculating but if the questioner is entering their data into a stats package rather than calculating the stat from first principles as set out here, it could be that they get an answer different to 6 because the Yates continuity correction might be the default for 2x2 contingency tables. This is the case, for example in R's chisq-test (which will deliver 2.667 if correct=T, the default; or 6 as per the original question if correct=F) $\endgroup$ – Peter Ellis Feb 27 '12 at 4:59
  • $\begingroup$ @Peter Ellis: Yes, good point! $\endgroup$ – ocram Feb 27 '12 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.