Notes 2 1 - Teacher Slides (With Transitions)
Table of contents
- Displaying two-way tables
- Side-by-side bar graph
- Segmented bar graph
- Mosaic plot
1. Displaying two-way tables
1.1 Two-way tables
A two-way table is a way to organize data that involves two categorical variables. It lists the values of these variables and how they are paired up.
This setup helps in comparing relationships between the variables and calculating different types of proportions, also known as relative frequencies.
1.2 Joint relative frequency
Joint relative frequency refers to the proportion of data that falls into a single cell of a two-way table. This cell represents the intersection of a specific category from each of the two variables.
For example, it could show the proportion of individuals who are both Democrat and live in the Midwest.
1.3 Marginal relative frequency
Marginal relative frequency is calculated from the totals of rows or columns in a two-way table. It represents the proportion of data that falls into a single category of one variable, regardless of the other variable.
For instance, it could show the overall proportion of states located in the South.
1.4 Conditional relative frequency
Conditional relative frequency is calculated within a specific row or column of a two-way table. It shows the proportion of data that falls into a particular category of one variable, given that the data already belongs to a specific category of the other variable.
An example is the proportion of states that are Democrat, specifically among those located in the West.
1.5 Visualizing two-way table data
Data from two-way tables can be visualized using different types of graphs to better understand the relationships between variables. These visualizations help in comparing frequencies and proportions across categories.

The bar chart above shows the raw counts of Democrats and Republicans in different regions. This gives a direct view of the number of individuals in each category and region combination.

This stacked bar chart displays the relative frequencies, showing the proportion of Democrats and Republicans within each region. It highlights that Democrats are dominant in the Northeast, the South shows a higher proportion of Republicans, and the West has a more balanced distribution.

This type of stacked bar chart is useful for comparing the distribution of two categories across different regions. Each bar represents a region, and the segments within the bar show the relative frequency of each category within that region.
2. Side-by-side bar graph
2.1 Description and purpose
A side-by-side bar graph is a visual tool used to display data from a two-way table. It is particularly effective for comparing counts or proportions for each category of one variable across different groups defined by another variable.
The key feature of this graph type is that bars representing categories of one variable are grouped together for each category of the other variable. This arrangement makes it easy to visually compare the heights of the bars within each group.
2.2 Visual clue and example
The primary visual clue for a side-by-side bar graph is that the bars for different categories of one variable are placed next to each other, allowing for direct comparison. For instance, if you are comparing political party affiliation (Democrat, Republican) across different regions (North, South, East, West), you would see a set of bars for Democrats and Republicans grouped together for the North region, then another set for the South region, and so on.
📝 Imagine a graph showing the number of people who prefer coffee versus tea, broken down by age group (e.g., 18-25, 26-40, 41+). For the 18-25 age group, there would be a bar for coffee and a bar for tea placed side-by-side. This would be repeated for the 26-40 and 41+ age groups, allowing easy comparison of beverage preference within each age bracket and across age brackets.
3. Segmented bar graph
3.1 Purpose and visual cues
A segmented bar graph is useful for showing how each group is made up, often by using relative frequencies or percentages. When using percentages, each bar typically has the same total height.
This allows the heights of the segments within each bar to clearly show the proportions of different categories.
3.2 Example: Political party affiliation by region
Consider a segmented bar graph where each bar represents a different region of a country. Each bar is then divided into colored segments, with each color indicating the proportion of people in that region who identify with a specific political party.
This allows for easy comparison of party affiliation across different regions.
📝 A segmented bar graph shows the political party affiliation (Democrat, Republican) for four regions (Northeast, Midwest, South, West). Each bar represents a region and is divided into segments showing the percentage of Democrats and Republicans within that region. For instance, the "Northeast" bar might be 60% Democrat and 40% Republican, while the "South" bar might be 30% Democrat and 70% Republican.
4. Mosaic plot
4.1 Purpose and structure
A mosaic plot is a visualization tool used to display the relationships between two or more categorical variables. It is particularly useful for simultaneously examining joint, marginal, and conditional distributions.
- Visual clue: The widths of the rectangles in a mosaic plot represent the marginal distribution of one variable.
- Visual clue: The heights of the rectangles within each width represent the conditional distribution of another variable, given the category of the first variable.
To determine the "x-axis coverage" for each category of the first variable, you take the total for that category and divide it by the grand total of all observations.
4.2 Interpreting mosaic plots
Mosaic plots allow for a quick visual assessment of how proportions change across different categories. The area of each rectangle is proportional to the joint probability of the categories it represents.
- Joint distribution: The overall pattern of the rectangles shows how the categories of the two variables occur together.
- Marginal distribution: The total width of each main vertical strip corresponds to the marginal proportion of that category for the variable on the x-axis.
- Conditional distribution: The heights of the stacked rectangles within each vertical strip show the proportion of the second variable's categories for each category of the first variable.
4.3 Example: Region and Political Party
Imagine a mosaic plot showing the relationship between geographic region (e.g., Northeast, Midwest, South, West) and political party affiliation (e.g., Democrat, Republican, Independent).
- The total width of the strip for "Northeast" would represent the proportion of all respondents who live in the Northeast.
- Within the "Northeast" strip, the heights of the stacked rectangles for "Democrat," "Republican," and "Independent" would show the percentage of people in the Northeast who identify with each party.
📝 If the mosaic plot shows that the "South" region strip takes up 30% of the total width, this means that 30% of the surveyed individuals are from the South. If within the "South" strip, the "Republican" segment is taller than the "Democrat" segment, it indicates that a larger proportion of Southerners identify as Republican compared to Democrats.
4.4 Calculating proportions
To construct or interpret a mosaic plot, you often need to calculate relative frequencies.
- Marginal relative frequency: This is calculated by dividing the total count for a specific category of one variable by the grand total of all observations. For example, the proportion of individuals in the "Midwest" region is the number of individuals in the Midwest divided by the total number of individuals surveyed.
- Conditional relative frequency: This is calculated by dividing the count of individuals in a specific combination of categories (e.g., "West" and "Democrat") by the total count for the condition (e.g., the total number of individuals in the "West" region).
| Calculation | Formula |
|---|---|
| Marginal relative frequency of category A | Grand totalTotal count for A |
| Conditional relative frequency of B given A | Total count for ACount for A and B |
© 2026 Maeve. All rights reserved. This content is protected by copyright.