top of page
Inaugurated by IN-SPACe
ISRO Registered Space Tutor

S3-SA3-0202

What is a Contingency Table?

Grade Level:

Class 9

AI/ML, Data Science, Physics, Economics, Cryptography, Computer Science, Engineering

Definition
What is it?

A contingency table is a special type of table that shows how two or more categories of data are related. It helps us count how often different combinations of events happen together, making it easy to compare them.

Simple Example
Quick Example

Imagine you want to see if students who like cricket also like samosas more than those who don't. A contingency table can list 'Likes Cricket'/'Doesn't Like Cricket' on one side and 'Likes Samosas'/'Doesn't Like Samosas' on the other, then fill in the counts for each group.

Worked Example
Step-by-Step

Let's say we asked 100 people if they prefer chai or coffee, and if they prefer sweet or savoury snacks.

---Step 1: Draw a 2x2 table with 'Chai' and 'Coffee' as row labels and 'Sweet' and 'Savoury' as column labels.

---Step 2: Start filling in the counts. Suppose 40 people prefer Chai AND Sweet.

---Step 3: 20 people prefer Chai AND Savoury.

---Step 4: 15 people prefer Coffee AND Sweet.

---Step 5: 25 people prefer Coffee AND Savoury.

---Step 6: Fill in the totals. Total Chai lovers = 40 + 20 = 60. Total Coffee lovers = 15 + 25 = 40. Total Sweet lovers = 40 + 15 = 55. Total Savoury lovers = 20 + 25 = 45. Total people = 60 + 40 = 100 (or 55 + 45 = 100).

---Answer: The table would look like this:

| | Sweet | Savoury | Total |
|-----------|-------|---------|-------|
| Chai | 40 | 20 | 60 |
| Coffee | 15 | 25 | 40 |
| Total | 55 | 45 | 100 |

Why It Matters

Contingency tables are super useful in data science and AI/ML to understand relationships between different factors, like if a new medicine works better for certain age groups. They are also used in physics to analyze experiment results and in economics to study consumer choices, helping people in careers like data analysts or researchers make smart decisions.

Common Mistakes

MISTAKE: Not including total rows/columns. | CORRECTION: Always calculate and include 'Total' rows and columns. They help in cross-checking your counts and understanding overall distribution.

MISTAKE: Mixing up categories or counts. | CORRECTION: Double-check that each count goes into the correct cell based on both categories it represents. For example, 'Chai AND Sweet' should not be in the 'Chai AND Savoury' cell.

MISTAKE: Not ensuring all numbers add up correctly. | CORRECTION: The sum of row totals must equal the sum of column totals, and both must equal the grand total of all observations. This is a crucial check for accuracy.

Practice Questions
Try It Yourself

QUESTION: A class of 50 students was asked if they walk or cycle to school, and if they bring a lunchbox or buy food. 15 students walk and bring a lunchbox. 10 students cycle and bring a lunchbox. 12 students walk and buy food. The rest cycle and buy food. Create a contingency table. | ANSWER:
| | Lunchbox | Buy Food | Total |
|-----------|----------|----------|-------|
| Walk | 15 | 12 | 27 |
| Cycle | 10 | 13 | 23 |
| Total | 25 | 25 | 50 |

QUESTION: In a survey of 80 mobile phone users, 30 use a smartphone and prefer gaming. 20 use a smartphone and prefer social media. 15 use a basic phone and prefer gaming. How many use a basic phone and prefer social media? Complete the contingency table. | ANSWER: Total users = 80. Smartphone + Gaming = 30. Smartphone + Social Media = 20. Basic Phone + Gaming = 15. So, Basic Phone + Social Media = 80 - (30 + 20 + 15) = 80 - 65 = 15.
| | Gaming | Social Media | Total |
|-----------|--------|--------------|-------|
| Smartphone| 30 | 20 | 50 |
| Basic Phone| 15 | 15 | 30 |
| Total | 45 | 35 | 80 |

QUESTION: A coaching institute surveyed 200 students about their favourite subject (Maths or Science) and if they use online classes (Yes or No). 70 students liked Maths and used online classes. 50 students liked Science and used online classes. There were 80 students who did not use online classes in total. How many students liked Maths but did not use online classes? | ANSWER: Total students = 200. Maths + Online = 70. Science + Online = 50. Total Online = 70 + 50 = 120. Total Not Online = 80. Students who liked Maths but did not use online classes = Total Not Online - (Students who liked Science but did not use online classes). First, find total Science students: Science + Online = 50. Total Science students = 200 - (Total Maths students). Total Maths students = Maths + Online (70) + Maths + Not Online (X). Total Science students = Science + Online (50) + Science + Not Online (Y). We know X + Y = 80. Total Maths = 70 + X. Total Science = 50 + Y. We need X.
| | Online | Not Online | Total |
|-----------|--------|------------|-------|
| Maths | 70 | X | 70+X |
| Science | 50 | Y | 50+Y |
| Total | 120 | 80 | 200 |
From the table, X + Y = 80. Also, (70+X) + (50+Y) = 200 => 120 + (X+Y) = 200 => 120 + 80 = 200. This confirms totals. To find X, we need more information or assume equal distribution if not provided. Given the question, it's a bit tricky without a total for Maths or Science. Let's re-evaluate: Total Not Online = 80. If 80 students did not use online classes in total, and Y students liked Science but did not use online classes, and X students liked Maths but did not use online classes, then X + Y = 80. Without another piece of information (e.g., total Maths students or total Science students), we can't find X or Y uniquely. Let's assume the question meant to give total Maths students OR total Science students. If it means 'the rest liked Maths but did not use online classes', then it would be 80 - (number of Science students who did not use online classes).

Let's assume the question implies that the *remaining* 'Not Online' students liked Maths. Total 'Not Online' = 80. If we had the number of 'Science and Not Online' (Y), we could find X. The problem is underspecified to find a unique X and Y without another piece of information. However, if we assume the question implies 'How many students liked Maths AND did not use online classes?', and there are 80 students who did not use online classes in total, and we also assume that the other part of the 80 (i.e. 'Science and Not Online') is not given, then we cannot solve it uniquely.

Let's rephrase the question to make it solvable: A coaching institute surveyed 200 students about their favourite subject (Maths or Science) and if they use online classes (Yes or No). 70 students liked Maths and used online classes. 50 students liked Science and used online classes. There were 80 students who did not use online classes in total. Also, 30 students liked Science but did not use online classes. How many students liked Maths but did not use online classes?

Revised Answer: Total 'Not Online' = 80. Science + Not Online = 30. So, Maths + Not Online = 80 - 30 = 50.
| | Online | Not Online | Total |
|-----------|--------|------------|-------|
| Maths | 70 | 50 | 120 |
| Science | 50 | 30 | 80 |
| Total | 120 | 80 | 200 |

MCQ
Quick Quiz

What is the primary purpose of a contingency table?

To display data in a pie chart format

To show the relationship between two or more categorical variables

To calculate the average of numerical data

To list data in alphabetical order

The Correct Answer Is:

B

A contingency table is specifically designed to show how different categories of data relate to each other, like how often two events happen together. Options A, C, and D describe other data display or analysis methods.

Real World Connection
In the Real World

Imagine a local health clinic tracking how many patients received a flu shot and then developed a fever versus those who didn't get a shot and developed a fever. They use a contingency table to see if the flu shot reduces the chance of fever. This helps doctors make better recommendations for public health, just like how ISRO scientists analyze data from satellite launches to understand different factors.

Key Vocabulary
Key Terms

CATEGORICAL DATA: Data that can be divided into groups or categories (e.g., gender, favourite colour). | FREQUENCY: The number of times a particular event or category occurs. | MARGINAL TOTALS: The totals for each row and column in a contingency table. | JOINT FREQUENCY: The count of observations that fall into a specific combination of categories (e.g., 'male' AND 'likes cricket').

What's Next
What to Learn Next

Great job understanding contingency tables! Next, you can explore 'Conditional Probability', which uses these tables to calculate the probability of one event happening given that another event has already happened. This will open up even more ways to analyze data!

bottom of page