Tutorials › Introduction to Statistics › Marginal Totals in Two-Way Tables

Graphs for Categorical Data · Tutorial 113 of 996

Marginal Totals in Two-Way Tables

Learn how to add across rows and down columns in a two-way table, and use the resulting margins to answer questions about overall category counts.

Beginner 9 min read

What You'll Learn

  • Define row totals, column totals, margins, and the grand total in a two-way table.
  • Calculate marginal totals from cell counts and check that both sets of totals agree.
  • Use row or column margins to answer questions about overall category counts.
  • Identify assumptions that make the totals represent the cases in the table.
  • Distinguish a marginal total from a single cell count and from a percentage.

Why Marginal Totals Matter

A two-way table organizes counts according to two categorical variables. Each interior cell records the number of cases in one combination of categories. But questions often ask about just one variable: How many respondents chose the bus, regardless of their class year? How many chose morning appointments, regardless of their reminder type? Adding the relevant cells gives an overall category count, also called a marginal total.

The word “marginal” refers to the totals placed along the outer edge, or margin, of a table. These totals make the table easier to summarize and provide a basic arithmetic check. They do not show how the cases in a category are distributed across the other variable; that detail remains in the interior cells.

Definition: In a two-way table of counts, a row total is the sum of all cell counts in one row, and a column total is the sum of all cell counts in one column. These totals are called marginal totals. The grand total is the sum of all interior cell counts; it is also the sum of all row totals or, equivalently, all column totals.

Calculating the Margins

To calculate a row total, add the counts across that row, including every column category. To calculate a column total, add the counts down that column, including every row category. The grand total can be found by adding all the interior cells or by summing either set of marginal totals. A complete table places row totals beside the rows, column totals below the columns, and the grand total in the lower-right corner.

Suppose \(n_{ij}\) denotes the count in row \(i\) and column \(j\), with \(r\) row categories and \(c\) column categories. Then the total for row \(i\) is the sum of its cell counts, and the total for column \(j\) is the sum of its cell counts. The grand total is the sum over all cells.

$$ \text{Row total for row } i = \sum_{j=1}^{c} n_{ij}, \qquad \text{Column total for column } j = \sum_{i=1}^{r} n_{ij}, \qquad N = \sum_{i=1}^{r}\sum_{j=1}^{c} n_{ij}. $$

Here \(N\) is the grand total. A row total answers how many cases fall in that row category across all column categories; a column total answers how many fall in that column category across all row categories. Neither is the count in just one interior cell.

Worked Example: Adding Both Sets of Margins

In a hypothetical survey, 48 students report their preferred study location and class year. The table shows the recorded counts.

Study locationFirst yearSecond yearThird yearRow total
Library865?
Home473?
Campus café258?
Column total????

Row totals. Add across each row. For Library, \(8+6+5=19\) students. For Home, \(4+7+3=14\). For Campus café, \(2+5+8=15\).

Column totals. Add down each column. First year has \(8+4+2=14\) students; second year has \(6+7+5=18\); third year has \(5+3+8=16\).

Grand total. Adding the row totals gives \(19+14+15=48\) students. Adding the column totals gives \(14+18+16=48\) as well. The completed table is:

Study locationFirst yearSecond yearThird yearRow total
Library86519
Home47314
Campus café25815
Column total14181648

For example, 19 students selected the library overall, regardless of class year. The count of 8 in the first-year/library cell answers a narrower question: how many first-year students selected the library. The margin and the cell count answer different questions.

Why the Two Grand Totals Must Agree

The equality between the two ways of calculating the grand total is not a coincidence. Each case in the table contributes exactly once to the total for its row and exactly once to the total for its column. Summing all row totals therefore counts every interior cell once. Summing all column totals also counts every interior cell once. Both procedures add the same set of cell counts.

For a table with \(r\) rows and \(c\) columns, write the row total for row \(i\) as \(\sum_{j=1}^{c} n_{ij}\). Adding all row totals gives:

$$ \sum_{i=1}^{r}\left(\sum_{j=1}^{c} n_{ij}\right) = \sum_{i=1}^{r}\sum_{j=1}^{c} n_{ij} = \sum_{j=1}^{c}\left(\sum_{i=1}^{r} n_{ij}\right). $$

The middle expression adds every cell in the table. The first expression groups those cells by row; the last groups them by column. Since addition does not depend on the order in which the same counts are grouped, both margin sums equal the grand total \(N\). If the row totals and column totals do not sum to the same number, at least one count or calculation needs checking.

Worked Example: Answering an Overall Count Question

A hypothetical clinic records the appointment time and reminder type for 60 scheduled visits. The counts are shown below. For this example, each visit is assigned to exactly one time category and one reminder category, and the displayed table includes all 60 visits.

Appointment timeText reminderPhone reminderNo reminderRow total
Morning1285?
Afternoon1067?
Evening435?
Column total????

The question is: How many visits had a text reminder, regardless of appointment time? This asks for the Text reminder column total. Add that column: \(12+10+4=26\) visits.

For completeness, the row totals are Morning: \(12+8+5=25\), Afternoon: \(10+6+7=23\), and Evening: \(4+3+5=12\). The other column totals are Phone reminder: \(8+6+3=17\), and No reminder: \(5+7+5=17\). Thus, the grand total from the columns is \(26+17+17=60\), and from the rows it is \(25+23+12=60\).

The completed margins show that 26 visits had text reminders overall. They do not say how many of those visits were morning appointments; that is the interior cell count of 12. The overall count and the count for one combination of categories should not be substituted for one another.

Assumptions Behind the Totals

The arithmetic is simple, but interpreting the margins correctly depends on how the table was defined. For a count table to summarize its stated cases, each case should contribute to exactly one cell: it belongs to one category of the row variable and one category of the column variable. The categories must cover the cases being counted, and a case should not be counted twice. If a table is intended to include all cases in a defined group, the grand total should match the number of cases in that group.

Sometimes a table deliberately describes only a subset of cases. For example, it may include only completed visits, rather than every scheduled visit. Then its grand total is the number of included visits, not necessarily the number originally scheduled. The table’s scope needs to be clear before a grand total is interpreted.

Worked Example: Checking a Reported Grand Total

A hypothetical recreation center reports counts for 35 visitors classified by membership type and day of visit. The displayed interior counts are:

Membership typeWeekdayWeekend
Member119
Guest67

Add the four interior cells: \(11+9+6+7=33\). The table therefore accounts for 33 visitors, not 35. The row totals are Member: \(11+9=20\), and Guest: \(6+7=13\); together they sum to \(20+13=33\). The column totals are Weekday: \(11+6=17\), and Weekend: \(9+7=16\); together they also sum to \(17+16=33\).

The reported total of 35 does not match the counts shown. The difference is \(35-33=2\) visitors. One should not silently change a cell or claim the margins total 35. The table needs clarification: perhaps two cases are missing from the displayed counts, perhaps the stated total is wrong, or perhaps the intended scope differs. The arithmetic identifies the inconsistency but does not determine its cause.

What Margins Preserve—and What They Leave Out

Margins are useful because they answer questions about each variable separately. In the study-location example, the row margins report the overall counts for each location, while the column margins report the overall counts for each class year. These summaries are often exactly what is needed when the question concerns a single category without regard to the other variable.

However, margins alone discard the details of how categories overlap. The three row totals and three column totals do not tell us the count in every location-by-year combination. Different interior tables can have the same margins. When the question concerns combinations of categories, use the relevant interior cell rather than a margin. When the question asks about overall counts for one variable, use the corresponding row or column margin.

Marginal totals are counts, measured in cases such as students, visits, or people. They are not percentages. A margin can serve as the count needed for later calculations, but a proportion requires a specified denominator and a division step. The choice of denominator depends on the question, so an overall category count should not be described as a proportion.

Common Mistakes

  • Using one cell as the overall category count. A cell describes a combination of two categories. To count everyone in one row or column category, add all cells along that row or column.
  • Adding only part of a row or column. A marginal total includes every category of the other variable in the table. Leaving out a column or row produces an incomplete total.
  • Adding the row totals and column totals together. Each set separately sums to the grand total. Adding both sets together counts every case twice.
  • Ignoring a mismatch. If the row margins and column margins have different sums, or if they disagree with the stated number of cases, check the cells and the scope rather than forcing the numbers to agree.
  • Calling a count a percentage. A total such as 26 visits is a count. It is not a percentage unless it has been divided by an appropriate denominator and expressed as a proportion or percent.
Key takeaway: Add across a row for its row total, down a column for its column total, and sum either set of margins to obtain the grand total. Both sets must agree because each interior cell is counted exactly once in either calculation.

Check Your Understanding

Use the definitions and arithmetic checks in this tutorial to answer the following questions.

  1. A table has two rows. One row contains counts 7, 4, and 9. What is that row’s marginal total, and what question does it answer?
  2. A column contains counts 5, 8, and 6. Calculate its column total.
  3. In a completed two-way table, the row totals sum to 42. What must the column totals sum to, and why?
  4. A cell contains 13, while the total at the end of its row is 31. Explain what each count represents.
  5. The displayed cell counts add to 27, but the table reports a grand total of 30. What can be concluded from this discrepancy, and what cannot be concluded from it alone?