Data handling: Use experiments, simulation and probability distribution to set and explore probability models

Unit 4: Complete contingency tables to solve probability problems

Natashia Bearam-Edmunds

Unit outcomes

By the end of this unit you will be able to:

  • Draw and complete contingency tables.
  • Use contingency tables to solve probability problems.

What you should know

Before you start this unit, make sure you can:

Introduction

A two-way contingency table is also called a two-way table or a cross tabulation table. Contingency tables are used to examine relationships between categorical data. ‘Contingency’ means ‘possibilities’. Contingency tables help you work out all the possible outcomes of combined events.

Constructing contingency tables

Contingency tables are especially helpful for figuring out whether events are dependent or independent.

In a two-way contingency table one event is written down the side of the table and the other event is written along the top of the table. The results are written in the cells of the table. The combined result of the activities is found by working two ways: across and then down.

We count the number of outcomes for two events and their complements, when working with two-way contingency tables, making four events in total. A two-way contingency table always shows the counts for the four possible combinations of events, as well as the totals for each event and its complement.

Example 4.1

A coin is tossed and a die is rolled simultaneously. Draw a table to show all possible pairs of outcomes. From your table calculate the probability of getting a head and a two and state if these events are independent.

Solution

When you toss a coin there are two possible outcomes heads (H) or tails (T). When you roll a die there are six possible outcomes, [latex]\scriptsize \{1;\text{ }2;\text{ }3;\text{ 4};\text{ 5};\text{ 6 }\!\!\}\!\!\text{ }[/latex].

We will draw up the contingency table with the event rolling a die at the top of the table and the event toss a coin along the side.

  Roll a die
[latex]\scriptsize 1[/latex] [latex]\scriptsize 2[/latex] [latex]\scriptsize 3[/latex] [latex]\scriptsize 4[/latex] [latex]\scriptsize 5[/latex] [latex]\scriptsize 6[/latex]
Toss a coin

[latex]\scriptsize \displaystyle \text{H}[/latex] [latex]\scriptsize \displaystyle \text{H; }1[/latex] [latex]\scriptsize \displaystyle \text{H; 2}[/latex] [latex]\scriptsize \displaystyle \text{H; 3}[/latex] [latex]\scriptsize \displaystyle \text{H; 4}[/latex] [latex]\scriptsize \displaystyle \text{H; 5}[/latex] [latex]\scriptsize \displaystyle \text{H; 6}[/latex]
[latex]\scriptsize \displaystyle \text{T}[/latex] [latex]\scriptsize \displaystyle \text{T; }1[/latex] [latex]\scriptsize \displaystyle \text{T; 2}[/latex] [latex]\scriptsize \displaystyle \text{T; 3}[/latex] [latex]\scriptsize \displaystyle \text{T; 4}[/latex] [latex]\scriptsize \displaystyle \text{T; 5}[/latex] [latex]\scriptsize \displaystyle \text{T; 6}[/latex]

In the cells of the table we list the possible combination of outcomes. There are [latex]\scriptsize 12[/latex] outcomes in total.

To find the probability of getting a head and a two, we find the row with [latex]\scriptsize \displaystyle \text{H}[/latex] and the column with [latex]\scriptsize 2[/latex] and read across from the [latex]\scriptsize \displaystyle \text{H}[/latex] and down from [latex]\scriptsize 2[/latex], the cell where they meet shows the outcome [latex]\scriptsize \displaystyle \text{H; 2}[/latex] . This outcome occurs once.

[latex]\scriptsize P(\text{H; 2})=\displaystyle \frac{1}{{12}}[/latex]

For independent events:

[latex]\scriptsize \displaystyle P(\text{A and B})=P(A)\cdot P(B)[/latex]

From the table we see that:

[latex]\scriptsize \begin{align*}P(\text{H)}&=\displaystyle \frac{6}{{12}}\\&=\displaystyle \frac{1}{2}\end{align*}[/latex]

[latex]\scriptsize \begin{align*}P(2\text{)}&=\displaystyle \frac{2}{{12}}\\&=\displaystyle \frac{1}{6}\end{align*}[/latex]

[latex]\scriptsize \begin{align*}P(\text{H)}\cdot P(2\text{)}&=\displaystyle \frac{1}{2}\cdot \displaystyle \frac{1}{6}\\&=\displaystyle \frac{1}{{12}}\end{align*}[/latex]

We have shown that [latex]\scriptsize P(\text{H; 2})=\displaystyle \frac{1}{{12}}[/latex].

Since, [latex]\scriptsize P(\text{H; 2})=P(\text{H})\cdot P(2)[/latex]the events are independent.

Example 4.2

Example taken from from Siyavula Maths Grade 12

The table below shows the results of testing two different treatments on [latex]\scriptsize \displaystyle ~240[/latex] fruit trees which have a disease causing the trees to die. Treatment A involves the careful removal of infected branches and treatment B involves removing infected branches as well as spraying the trees with antibiotics.

Tree dies within four years Tree lives for more than four years TOTAL
Treatment A [latex]\scriptsize 70[/latex] [latex]\scriptsize 50[/latex]
Treatment B
TOTAL [latex]\scriptsize 90[/latex] [latex]\scriptsize 150[/latex]
  1. Fill in the missing values on the table.
  2. What is the probability a tree received treatment B?
  3. What is the probability that a tree will live beyond four years?
  4. What is the probability that a tree is given treatment B and lives beyond four years?
  5. Of the trees that were given treatment B, what is the probability that a tree lives beyond four years?
  6. Are a tree given treatment B and living beyond four years independent events? Justify your answer with a calculation.

Solutions

  1. Since each column has to add up to its total, we can work out the number of trees which fall into each category for treatments A and B. Then, we can add each row to get the totals on the right-hand side of the table.
    Tree dies within four years Tree lives for more than four years TOTAL
    Treatment A [latex]\scriptsize 70[/latex] [latex]\scriptsize 50[/latex] [latex]\scriptsize 120[/latex]
    Treatment B [latex]\scriptsize 20[/latex] [latex]\scriptsize 100[/latex] [latex]\scriptsize 120[/latex]
    TOTAL [latex]\scriptsize 90[/latex] [latex]\scriptsize 150[/latex] [latex]\scriptsize 240[/latex]
  2. The probability that treatment B is given to a tree is the number of trees that received treatment B divided by the total number of trees.
    [latex]\scriptsize \begin{align*}P(\text{B})&=\displaystyle \frac{{120}}{{240}}\\&=\displaystyle \frac{1}{2}\end{align*}[/latex]
  3. To find the probability that a tree lives beyond four years, we use the total of the column ‘tree lives for more than four years’ and divide that by the total number of trees.
    [latex]\scriptsize \begin{align*}P(\text{tree lives more than 4 years })&=\displaystyle \frac{{150}}{{240}}\\&=\displaystyle \frac{5}{8}\end{align*}[/latex]
  4. To determine the probability that a tree receives treatment B and lives beyond four years, we must find the cell within the table that shows the combination of these events (row [latex]\scriptsize 3[/latex], column [latex]\scriptsize 3[/latex]) and divide that by the total number of trees.
    [latex]\scriptsize \begin{align*}P(\text{B and tree lives more than 4 years })&=\displaystyle \frac{{100}}{{240}}\\&=\displaystyle \frac{5}{{12}}\end{align*}[/latex]
  5. Here, we are restricted to only the trees that received treatment B, living beyond four years. This means we no longer need to include the trees given treatment A, so the denominator needs to be adjusted accordingly.
    [latex]\scriptsize \begin{align*}P(\text{lives beyond 4 years having received B})&=\displaystyle \frac{{100}}{{120}}\\&=\displaystyle \frac{5}{6}\end{align*}[/latex]
  6. .
    [latex]\scriptsize \begin{align*}P(\text{tree lives more than 4 years })\times P(\text{B)}&=\displaystyle \frac{5}{8}\times \displaystyle \frac{1}{2}\\&=\displaystyle \frac{5}{{16}}\end{align*}[/latex]
    [latex]\scriptsize P(\text{B and tree lives more than 4 years })=\displaystyle \frac{5}{{12}}[/latex]
    So we see that [latex]\scriptsize P(\text{B and tree lives more than 4 years })\ne P(\text{B})\cdot P(\text{lives more than 4 years})[/latex]. Therefore, the treatment of a tree with treatment B and living beyond four years are dependent events.

Exercise 4.1

  1. Use the contingency table below to answer the following questions:
    Brown eyes Not brown eyes TOTAL
    Black hair [latex]\scriptsize 50[/latex] [latex]\scriptsize 30[/latex] [latex]\scriptsize 80[/latex]
    Red hair [latex]\scriptsize 70[/latex] [latex]\scriptsize 80[/latex] [latex]\scriptsize 150[/latex]
    TOTAL [latex]\scriptsize 120[/latex] [latex]\scriptsize 110[/latex] [latex]\scriptsize 230[/latex]
    1. What is the probability that someone with black hair has brown eyes?
    2. What is the probability that someone has black hair?
    3. What is the probability that someone has brown eyes?
    4. Are having black hair and having brown eyes dependent or independent events?
    5. What is the probability of having brown eyes or red hair?
  2. You are given the following information:
    • Events A and B are independent.
    • [latex]\scriptsize P(\text{not A})=0.3[/latex]
    • [latex]\scriptsize P(\text{B})=0.4[/latex]

    Complete the contingency table below.

    A Not A TOTAL
    B
    Not B
    TOTAL [latex]\scriptsize 50[/latex]
  3. A new treatment for influenza (the flu) was tested on a number of patients to determine if it was better than a placebo (a pill with no therapeutic value). The table below shows the results three days after treatment:
    Flu No flu TOTAL
    Placebo [latex]\scriptsize 228[/latex] [latex]\scriptsize 60[/latex]
    Treatment
    TOTAL [latex]\scriptsize 240[/latex] [latex]\scriptsize 312[/latex]
    1. Complete the table.
    2. Calculate the probability of a patient receiving the treatment.
    3. Calculate the probability of a patient having no flu after three days.
    4. Calculate the probability of a patient receiving the treatment and having no flu after three days.
    5. Using a calculation, determine whether a patient receiving the treatment and having no flu after three days are dependent or independent events.
    6. Calculate the probability that a patient receiving treatment will have no flu after three days.
    7. Calculate the probability that a patient receiving a placebo will have no flu after three days.
    8. Comparing you answers in f. and g., would you recommend the use of the new treatment for patients suffering from influenza?

The full solutions are at the end of the unit.

Summary

In this unit you have learnt the following:

  • How to construct a two-way contingency table.
  • How to complete a two-way contingency table.
  • How to calculate probabilities from a contingency table.

Unit 4: Assessment

Suggested time to complete: 25 minutes

  1. Researchers conducted a study to test how effective a certain inoculation is at preventing malaria. Part of their data is shown below:
    Malaria No malaria TOTAL
    Male  A B [latex]\scriptsize 216[/latex]
    Female C D [latex]\scriptsize 648[/latex]
    TOTAL [latex]\scriptsize 108[/latex] [latex]\scriptsize 756[/latex] [latex]\scriptsize 864[/latex]
    1. Calculate the probability that a randomly selected study participant will be female.
    2. Calculate the probability that a randomly selected study participant will have malaria.
    3. If being female and having malaria are independent events, calculate the value C.
    4. Using the value of C, fill in the missing values on the table.
  2. A rare kidney disease affects only one in [latex]\scriptsize \displaystyle 1\text{ }000[/latex] people and the test for this disease has a [latex]\scriptsize \displaystyle 99\%[/latex] accuracy rate.
    1. Draw a two-way contingency table showing the results if [latex]\scriptsize \displaystyle 100\text{ }000[/latex] of the general population are tested.
    2. Calculate the probability that a person who tests positive for this rare kidney disease is sick with the disease, correct to two decimal places.
  3. The Clueless Club consists of [latex]\scriptsize \displaystyle 500[/latex] members. In order to be part of this club you have to be a lawyer, a teacher or an engineer. Given below is an incomplete contingency table that shows the distribution of [latex]\scriptsize \displaystyle 500[/latex] members, in terms of their profession and the type of hot drinks they drink.
    Tea Coffee Hot chocolate TOTAL
    Lawyer [latex]\scriptsize 52[/latex] [latex]\scriptsize 41[/latex] [latex]\scriptsize 80[/latex] [latex]\scriptsize 173[/latex]
    Teacher [latex]\scriptsize 48[/latex] [latex]\scriptsize 69[/latex] A [latex]\scriptsize 137[/latex]
    Engineer [latex]\scriptsize 100[/latex] B [latex]\scriptsize 10[/latex] [latex]\scriptsize 190[/latex]
    TOTAL [latex]\scriptsize 200[/latex] [latex]\scriptsize 190[/latex] [latex]\scriptsize 110[/latex] [latex]\scriptsize 500[/latex]
    1. Determine the values of A and B.
    2. If a member is selected at random, what is the probability of selecting a teacher who drinks coffee?
    3. If a member is selected at random, what is the probability of selecting an engineer or a person who drinks hot chocolate?

The full solutions are at the end of the unit.

Unit 4: Solutions

Exercise 4.1

  1. .
    1. .
      [latex]\scriptsize \begin{align*}P(\text{with black hair has brown eyes})&=\displaystyle \frac{{50}}{{80}}\\&=\displaystyle \frac{5}{8}\end{align*}[/latex]
    2. .
      [latex]\scriptsize \begin{align*}P(\text{black hair})&=\displaystyle \frac{{80}}{{230}}\\&=\displaystyle \frac{8}{{23}}\end{align*}[/latex]
    3. .
      [latex]\scriptsize \begin{align*}P(\text{brown eyes})&=\displaystyle \frac{{120}}{{230}}\\&=\displaystyle \frac{{12}}{{23}}\end{align*}[/latex]
    4. .
      [latex]\scriptsize \begin{align*}P(\text{black hair})\cdot P(\text{brown eyes})&=\displaystyle \frac{8}{{23}}\cdot \displaystyle \frac{{12}}{{23}}\\&=\displaystyle \frac{{96}}{{529}}\\P(\text{black hair and brown eyes})&=\displaystyle \frac{{50}}{{230}}\\&=\displaystyle \frac{5}{{23}}\\P(\text{black hair and brown eyes})&\ne P(\text{black hair})\cdot P(\text{brown eyes})\end{align*}[/latex]
      The events are dependent.
    5. The probability of having brown eyes or red hair is the union of the two events.
      [latex]\scriptsize \begin{align*}P\text{(brown eyes or red hair})&=P\text{(brown eyes})+P(\text{red hair})-P\text{(brown eyes and red hair})\\&=\displaystyle \frac{{120}}{{230}}+\displaystyle \frac{{150}}{{230}}-\displaystyle \frac{{70}}{{230}}\\&=\displaystyle \frac{{200}}{{230}}\\&=\displaystyle \frac{{20}}{{23}}\end{align*}[/latex]
  2. .
    [latex]\scriptsize \begin{align*}P(\text{not A})&=0.3\\\therefore n(\text{not A})&=0.3\times 50\\&=15\end{align*}[/latex]
    [latex]\scriptsize \displaystyle \begin{align*}P(\text{B})&=0.4\\\therefore n(\text{B})&=0.4\times 50\\&=20\end{align*}[/latex]
    .
    [latex]\scriptsize \displaystyle \begin{align*}P(\text{A and B})&=P(\text{A})\cdot P(\text{B})\\&=\displaystyle \frac{{35}}{{50}}\times 0.4\\&=\displaystyle \frac{7}{{25}}\\\therefore n(\text{A and B})&=\displaystyle \frac{7}{{25}}\times 50\\&=14\end{align*}[/latex]

    A Not A TOTAL
    B [latex]\scriptsize 14[/latex] [latex]\scriptsize 6[/latex] [latex]\scriptsize 20[/latex]
    Not B [latex]\scriptsize 21[/latex] [latex]\scriptsize 9[/latex] [latex]\scriptsize 30[/latex]
    TOTAL [latex]\scriptsize 35[/latex] [latex]\scriptsize 15[/latex] [latex]\scriptsize 50[/latex]
  3. .
    1. .
      Flu No flu TOTAL
      Placebo [latex]\scriptsize 228[/latex] [latex]\scriptsize 60[/latex] [latex]\scriptsize 288[/latex]
      Treatment [latex]\scriptsize 12[/latex] [latex]\scriptsize 252[/latex] [latex]\scriptsize 264[/latex]
      TOTAL [latex]\scriptsize 240[/latex] [latex]\scriptsize 312[/latex] [latex]\scriptsize 552[/latex]
    2. .
      [latex]\scriptsize \begin{align*}P(\text{receiving the treatment})&=\displaystyle \frac{{264}}{{552}}\\&=\displaystyle \frac{{11}}{{23}}\end{align*}[/latex]
    3. .
      [latex]\scriptsize \begin{align*}P(\text{no flu})&=\displaystyle \frac{{312}}{{552}}\\&=\displaystyle \frac{{13}}{{23}}\end{align*}[/latex]
    4. .
      [latex]\scriptsize \begin{align*}P(\text{receiving the treatment and having no flu})&=\displaystyle \frac{{252}}{{552}}\\&=\displaystyle \frac{{21}}{{46}}\end{align*}[/latex]
    5. .
      [latex]\scriptsize \displaystyle \begin{align*}P(\text{receiving the treatment})\cdot P(\text{no flu})&=\displaystyle \frac{{11}}{{23}}\cdot \displaystyle \frac{{13}}{{23}}\\&=\displaystyle \frac{{143}}{{529}}\\P(\text{receiving the treatment and having no flu})&=\displaystyle \frac{{21}}{{46}}\end{align*}[/latex]
      [latex]\scriptsize \displaystyle P(\text{receiving the treatment and having no flu})\ne P(\text{receiving the treatment})\cdot P(\text{no flu})[/latex]
      Therefore, a patient receiving the treatment and having no flu after three days are dependent events.
    6. .
      [latex]\scriptsize \begin{align*}P(\text{having no flu if received the treatment})&=\displaystyle \frac{{252}}{{264}}\\&=\displaystyle \frac{{21}}{{22}}\end{align*}[/latex]
    7. .
      [latex]\scriptsize \begin{align*}P(\text{having no flu if received the placebo})&=\displaystyle \frac{{60}}{{288}}\\&=\displaystyle \frac{5}{{24}}\end{align*}[/latex]
    8. Yes, I would recommend the use of the new treatment for patients with the flu as there is a [latex]\scriptsize 95.5\%[/latex] chance of not getting the flu if they have been treated compared to the [latex]\scriptsize 20.8\%[/latex] of getting the flu if they were given the placebo.

Back to Exercise 4.1

Unit 4: Assessment

  1. .
    1. .
      [latex]\scriptsize \begin{align*}P(\text{female})&=\displaystyle \frac{{648}}{{864}}\\&=\displaystyle \frac{3}{4}\end{align*}[/latex]
    2. .
      [latex]\scriptsize \begin{align*}P(\text{malaria})&=\displaystyle \frac{{108}}{{864}}\\&=\displaystyle \frac{1}{8}\end{align*}[/latex]
    3. .
      [latex]\scriptsize \begin{align*}P(\text{female and malaria})&=P(\text{female)}\cdot P(\text{malaria})\text{ since these are independent events }\\&=\displaystyle \frac{3}{4}\cdot \displaystyle \frac{1}{8}\\\therefore \text{c}&=\displaystyle \frac{3}{{32}}\times 864\\&=81\end{align*}[/latex]
    4. .
      Malaria No malaria TOTAL
      Male  [latex]\scriptsize 27[/latex] [latex]\scriptsize 189[/latex] [latex]\scriptsize 216[/latex]
      Female [latex]\scriptsize 81[/latex] [latex]\scriptsize 567[/latex] [latex]\scriptsize 648[/latex]
      TOTAL [latex]\scriptsize 108[/latex] [latex]\scriptsize 756[/latex] [latex]\scriptsize 864[/latex]
  2. .
    1. .
      [latex]\scriptsize \begin{align*}\text{Number of people with disease }&=\displaystyle \frac{1}{{1\text{ }000}}\times 100\text{ }000\\&=100\end{align*}[/latex]
      .
      Test for this disease has [latex]\scriptsize \displaystyle 99\%[/latex] accuracy rate:
      [latex]\scriptsize \begin{align*}\text{Number of people with disease and test is positive }&=0.99\times 100\\&=99\end{align*}[/latex]
      [latex]\scriptsize \begin{align*}\text{Number of people with no disease and test is negative }&=0.99\times 99\text{ 9}01\\&=98\text{ }901\end{align*}[/latex]

      Disease No disease TOTAL
      Test is positive [latex]\scriptsize 99[/latex] [latex]\scriptsize 999[/latex] [latex]\scriptsize 1\text{ }098[/latex]
      Test is negative [latex]\scriptsize 1[/latex] [latex]\scriptsize 98\text{ }901[/latex] [latex]\scriptsize 98\text{ }902[/latex]
      TOTAL [latex]\scriptsize 100[/latex] [latex]\scriptsize 99\text{ }900[/latex] [latex]\scriptsize 100\text{ }000[/latex]
    2. .
      [latex]\scriptsize \begin{align*}P(\text{have the disease if test is positive)}&=\displaystyle \frac{{99}}{{1\text{ }098}}\\&=\displaystyle \frac{{11}}{{122}}\\&=0.09\end{align*}[/latex]
  3. .
    1. .
      [latex]\scriptsize \begin{align*}\text{A}&=137-48-69\\&=20\end{align*}[/latex]
      [latex]\scriptsize \begin{align*}\text{B}&=190-41-69\\&=80\end{align*}[/latex]
    2. .
      [latex]\scriptsize P(\text{teacher and coffee)}=\displaystyle \frac{{69}}{{500}}[/latex]
    3. .
      [latex]\scriptsize \begin{align*}P(\text{engineer or hot chocolate})&=P(\text{engineer})+P(\text{hot chocolate})\\&-P(\text{engineer and hot chocolate})\\&=\displaystyle \frac{{190}}{{500}}+\displaystyle \frac{{110}}{{500}}-\displaystyle \frac{{10}}{{500}}\\&=\displaystyle \frac{{290}}{{500}}\\&=\displaystyle \frac{{29}}{{50}}\end{align*}[/latex]

Back to Unit 4: Assessment

License

Icon for the Creative Commons Attribution 4.0 International License

National Curriculum (Vocational) Mathematics Level 4 by Natashia Bearam-Edmunds is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book