Contingency Table - 2x2 Table - Solved examples online
A contingency table has other names as well like crosstab or cross tabulation. It is a part of statistics. Basically a crosstab is a matrix formatted table which is displaying the frequency distribution in among the variables. The cross tabs are used very commonly in business intelligence, scientific researches, survey researches and engineering. In simple words, the crosstabs are giving a basic picture of the interconnection that exists between two variables which thus helps us in finding the interactions happening between them. 

Standard contents in a crosstabs:

1) Multiple Columns:

Each and every column is referring to a particular sub group. These columns are also called cuts, even banner points or at times also stubs.

2) Significance Tests:

Column comparisons or cell comparisons are done. The first of them compares columns and shows the result and the second makes use of color or arrows to stand out a single cell in some way of comparison.

3) Nets:

These are simply sub totals.

4) One or more:

This is percentage values like row/column percentages, averages or indexes.

5) The sample sizes which are unweighted:

Different tests can be used to see the relationship between the given variables. 

2 x 2 

As the name it has two columns and two rows. It is very simple to use as tables with more numbers of variables are quite confusing. Here we make use of chi - square test, phi coefficient, or fisher exact probability test in order to make comparisons. In general we have the following 2 x 2 contingency table.

Variable  Data 1  Data 2  Total 
 Category 1  m  n  m+n
 Category 2  p  r  p+r
 Total  m+p  n+r  N

We make use of following formula in a 2 x 2 contingency table to determine the chi square statistic:

$Z^2$ = $\frac{[(mr – np)^2 (m + n + p + r)] }{ [(m + n) (p + r) (m + p) (n + r)]}$

In other words we can do it as 

$Z^2$ = $\sum$ [$\frac{(observed value – expected value)^2 }{ expected value}$]

We perform the following steps:

1) Obtain column of difference in observed and expected.

2) Square this difference

3) Find the quotient of this square by the expected value.

4) Sum all these values obtained in 3.

5) The result is chi square statistic.


Example on Contingency table is given below:

Example: Find the chi square statistic:
 10  40  50
B  30  20  50
 Total  40  60  100


Here m = 10, n = 40, p = 30 and r = 20

We make use of following

$Z^2$ = $\frac{(mr - np)^2 (m + n + p + r)}{ (m + n) (p + r) (m + p) (n + r)}$

On substituting the given values in it we get

$Z^2$ = $\frac{(200 - 1200)^2 (100)}{(50 * 50 * 40 * 60)}$

$\rightarrow$ $Z^2$ = $\frac{1000 * 1000 * 100}{ 3000 * 2000}$

$\rightarrow$ $Z^2$ = $\frac{100}{6}$

$\rightarrow$ $Z^2$ = 16.67

So here the association between the rows and the columns is statistically extremely significant.