### 3. Probability: Contingency Tables

### Interpreting Contingency Tables

Contingency tables

A common way of summarizing the measurements of two *categorical *variables is with the use of a *contingency table*.

The contingency table below summarizes the sample data of #200# individuals whose blood was tested in order to determine their blood group and rhesus type:

A | B | AB | O | Total | |

Rhesus #+# | #68# | #18# | #6# | #76# | #\blue{168}# |

Rhesus #-# | #12# | #4# | #2# | #14# | #\blue{32}# |

Total | #\blue{80}# | #\blue{22}# | #\blue{8}# | #\blue{90}# | #\orange{200}# |

#\phantom{0}#

The row and column totals of a contingency table are located in the *margins *(edges) of the table and are therefore referred to as #\blue{\textbf{marginal totals}}#.

The total number of observations used to construct a contingency table is called the #\orange{\textbf{grand total}}# and is found in the bottom-right corner of the table.

#\phantom{0}#

The absolute frequencies displayed in a contingency table can be transformed into proportions and in turn interpreted as probabilities.

#\phantom{0}#

Interpreting Proportions as Probabilities

To transform the absolute frequencies of a contingency table into proportions, divide each cell in the table by the total number of observations. The resulting table is commonly referred to as a *proportion table*.

#\phantom{0}#

A | B | AB | O | Total | |

Rhesus #+# | #\purple{0.34}# | #\purple{0.09}# | #\purple{0.03}# | #\purple{0.38}# | #\blue{0.84}# |

Rhesus #-# | #\purple{0.06}# | #\purple{0.02}# | #\purple{0.01}# | #\purple{0.07}# | #\blue{0.16}# |

Total | #\blue{0.40}# | #\blue{0.11}# | #\blue{0.04}# | #\blue{0.45}# | #1# |

#\phantom{0}#

The proportions in the margins of a proportion table are called #\blue{\textbf{marginal probabilities}}# and tell us the probability of a *single* event occurring.

For instance, the probability of randomly selecting a person with *blood group B* from this sample would be #0.11#:

\[\mathbb{P}(B) = 0.11\]

Similarly, the probability of randomly selecting a person with a *positive rhesus factor* would be #0.84#:

\[\mathbb{P}(Rh+) = 0.84\]

The proportions located in the center block of a proportion table are called #\purple{\textbf{joint probabilities}}# and tell us the probability of the *intersection* of two events occurring.

For instance, the probability of randomly selecting a person that has both *blood group O *and* a negative rhesus factor* would be #0.07#:

\[\mathbb{P}(O \cap Rh-)=0.07\]

Similarly, the probability of randomly selecting a person that has both *blood group A *and a *positive rhesus factor* would be #0.34#:

\[\mathbb{P}(A \cap Rh+) = 0.34\]

Cat | Dog | Bird | Total | |

Male | #35# | #48# | #5# | #88# |

Female | #49# | #56# | #7# | #112# |

Total | #84# | #104# | #12# | #200# |

Cat | Dog | Bird | Total | |

Male | #0.175# | #0.24# | #0.025# | #0.44# |

Female | #0.245# | #0.28# | #0.035# | #0.56# |

Total | #0.42# | #0.52# | #0.06# | #1# |