The Chi-square test for small tables

These tests are based on the data gathered in the form of a contingency table of 2 features ($X$, $Y$), each of them has 2 possible categories $X_1, X_2$ and $Y_1, Y_2$ (look at the table (\ref{tab_kontyngencji_obser})).

The $\chi^2$ test for $2\times 2$ tables – The Pearson's Chi-square test (Karl Pearson 1900) is constraint of the Chi-square test for (r x c) tables.

The test statistic is defined by:

\begin{displaymath}
\chi^2=\sum_{i=1}^2\sum_{j=1}^2\frac{(O_{ij}-E_{ij})^2}{E_{ij}}.
\end{displaymath}

This statistic asymptotically (for large expected frequencies) has the Chi-square distribution with a 1 degree of freedom.

The settings window with the Chi-square test (2×2) can be opened in Statistics menu → NonParametric testsChi-square, Fisher, OR/RR or in ''Wizard''.

EXAMPLE (sex-exam.pqs file)

There is a sample consisting of 170 persons ($n=170$). Using this sample, you want to analyse 2 features ($X$=sex, $Y$=exam passing). Each of these features occurs in two categories ($X_1$=f, $X_2$=m, $Y_1$=yes, $Y_2$=no). Based on the sample you want to get to know, if there is any dependence between sex and exam passing in the above population. The data distribution is presented in the contingency table below:

\begin{tabular}{|c|c||c|c|c|}
\hline
\multicolumn{2}{|c||}{Observed frequencies }& \multicolumn{3}{|c|}{exam passing}\\\cline{3-5}
\multicolumn{2}{|c||}{$O_{ij}$} & yes & no & total \\\hline \hline
\multirow{3}{*}{sex}& f & 50 & 40 & 90 \\\cline{2-5}
& m & 20 & 60 & 80 \\\cline{2-5}
& total & 70 & 100 & 170\\\hline
\end{tabular}

Hypotheses:

$\begin{array}{cl}
\mathcal{H}_0: & $there is no dependence between sex and exam passing in the analysed population,$\\
\mathcal{H}_1: & $there is a dependence between sex and exam passing in the analysed population.$
\end{array}$

The expectation count table contains no values less than 5. Cochran's condition is satisfied.

At the assumed significance level of $\alpha=0.05$ all tests performed confirmed the truth of the alternative hypothesis:

  • chi-square test, p=0.000053,
  • chi-square test with Yeates correction, p=0.000103,
  • Fisher's exact test, p=0.000083,
  • mid-p test, p=0.000054.