From Individual Records to a Table
A list of individual records can be difficult to scan when the question concerns combinations of two categorical variables. A two-way frequency table organizes the records by those combinations. Each interior cell reports how many individuals have the row category and the column category together. Constructing the table is a careful counting task: define the categories, place every eligible record once, and check the arithmetic.
For example, a school might record each student's usual way of travelling to school and usual morning drink. A table can show how many students fall into each combination, such as travelling by bus and choosing tea. The table's counts do not by themselves explain why the records have those values; they simply reorganize the information already collected.
A Reliable Construction Method
Start with the observational unit: what does one record represent? Then identify the two categorical variables to be tabulated and list all categories that the table will use. Decide which variable labels rows and which labels columns. Either variable can go in either direction; the choice changes the table's orientation, not the underlying counts. State the labels clearly so each cell has an unambiguous meaning.
Next, examine each record and add one count to the cell matching its two recorded categories. A record is not split across cells, and it should not be counted twice. Once all records have been processed, add the counts within each row and column and calculate the grand total. These totals provide useful arithmetic checks, but the cell counts remain the central information.
Confirm what one record represents and choose the two categorical variables being cross-classified.
Label every row and column, including categories with no observed records if they belong in the table.
Use the two recorded values to find the matching cell, then increase that cell's count by one.
Add the cell counts and compare their sum with the number of records being represented.
Worked Construction and Count Check
Worked Example: Travel Mode and Morning Drink
Suppose, hypothetically, a class records two categorical variables for 12 students: usual travel mode (bus, walk, or bike) and usual morning drink (coffee, tea, or none). The records are:
A: bus, coffee; B: walk, none; C: bike, tea; D: bus, none; E: walk, coffee; F: bus, tea; G: bike, none; H: walk, tea; I: bus, coffee; J: bike, coffee; K: walk, none; L: bus, none.
Put travel mode in the rows and drink in the columns. Tally the records by category combination. For instance, A and I are both bus-and-coffee records, so that cell gets a count of 2. There is one bus-and-tea record (F) and two bus-and-none records (D and L). Applying the same process to the other travel modes gives the completed table:
| Travel mode | Coffee | Tea | None | Row total |
|---|---|---|---|---|
| Bus | 2 | 1 | 2 | 5 |
| Walk | 1 | 1 | 2 | 4 |
| Bike | 1 | 1 | 1 | 3 |
| Column total | 4 | 3 | 5 | 12 |
The row totals are \(2+1+2=5\) for bus, \(1+1+2=4\) for walking, and \(1+1+1=3\) for biking. The column totals are \(2+1+1=4\) for coffee, \(1+1+1=3\) for tea, and \(2+2+1=5\) for none. The grand total is \(5+4+3=12\), matching the 12 records. This agreement is evidence that the table's counts have been accounted for, though the record-by-record tally is still needed to ensure each cell is correct.
Why the Cell Counts Sum to the Sample Size
The grand-total check follows from how the table is constructed. Assume that each of the \(n\) records has exactly one recorded category for each of the two variables, and that the table includes every possible category combination for the records being counted. Each individual then belongs to exactly one cell: their first variable selects one row, and their second variable selects one column.
To see why the total must equal \(n\), assign an indicator to each record-and-cell pair: it is 1 if that record belongs to that cell and 0 otherwise. For any one record, adding these indicators over all table cells gives 1, since the record belongs to one cell and no others. Adding over all \(n\) records therefore gives \(n\). Alternatively, adding first by cell gives the sum of the cell frequencies. Since both ways add the same indicators, the cell counts must sum to \(n\):
Here \(f_c\) is the count in cell \(c\), and \(I(i\text{ belongs to }c)\) equals 1 when record \(i\) belongs to cell \(c\), and 0 otherwise. This check depends on the assumption that every counted record has a usable category for both variables and that no relevant category has been left out.
Worked Example: Two Yes-or-No Variables
In a hypothetical group of 10 participants, a form records whether each person received a reminder and whether the person attended an appointment. The records are: 1: reminder, attended; 2: reminder, attended; 3: reminder, missed; 4: reminder, attended; 5: reminder, missed; 6: no reminder, attended; 7: no reminder, missed; 8: no reminder, attended; 9: no reminder, missed; 10: no reminder, missed.
Use reminder status for the rows and attendance for the columns. Among the five reminder records, three are attended and two are missed. Among the five no-reminder records, two are attended and three are missed.
| Reminder status | Attended | Missed | Row total |
|---|---|---|---|
| Reminder | 3 | 2 | 5 |
| No reminder | 2 | 3 | 5 |
| Column total | 5 | 5 | 10 |
Adding the four interior cells gives \(3+2+2+3=10\), equal to the number of participants. The totals also agree across directions: the row totals sum to \(5+5=10\), and the column totals sum to \(5+5=10\). The table records counts only; no conclusion about the reminder's effect follows from this counting step.
Categories, Empty Cells, and Incomplete Records
A category combination can be possible even if no record in the data set has that combination. Include a cell for it when the table's category structure calls for it, and enter 0. A zero is a meaningful count: it says that the relevant combination was checked and did not occur among the records. It is not the same as a blank cell, which could mean the count was not entered or is unknown.
A missing value needs separate attention. If a record has a missing value for either variable, it cannot be placed in an ordinary cell defined by both variables. Do not silently assign it to a category or pretend it has been counted in the table. State how incomplete records are handled and distinguish the number of complete records represented from the original number of records, if those numbers differ. If every record must appear in the table, a clearly defined missing or unknown category can be used when appropriate; that is a decision about how to represent the data, not a substitute for checking them.
Worked Example: Keeping a Zero Cell Visible
Suppose, hypothetically, 10 people report their device type (phone, tablet, or laptop) and whether a task was completed. Their records are: phone, completed; phone, completed; phone, completed; phone, not completed; phone, not completed; tablet, completed; tablet, not completed; laptop, completed; laptop, completed; laptop, completed.
Use device type for rows and task status for columns. There are three phone-and-completed records and two phone-and-not-completed records. The tablet counts are one and one. All three laptop records indicate completion, so the laptop-and-not-completed cell is zero.
| Device type | Completed | Not completed | Row total |
|---|---|---|---|
| Phone | 3 | 2 | 5 |
| Tablet | 1 | 1 | 2 |
| Laptop | 3 | 0 | 3 |
| Column total | 7 | 3 | 10 |
The cell counts sum to \(3+2+1+1+3+0=10\). The zero is shown explicitly because the category combination is part of the table, but none of the ten records falls into it. Leaving out that cell could make the table look incomplete or cause a reader to mistake a missing entry for a count that has not been checked.
Common Mistakes
- Counting records rather than category combinations. A table cell is not a tally of a single category alone. It counts records that match both the row and column labels.
- Counting one record more than once. Each fully classified record belongs to one cell, not one cell per variable or several cells at once.
- Omitting a category combination without explanation. If a combination is possible but unobserved, show its cell with a zero when it belongs in the table.
- Treating a blank as zero. A zero means the count is known to be none; a blank may mean unknown or unfinished. Label or resolve it rather than assuming.
- Forgetting the represented sample size. After tallying, add the interior cells and compare their sum with the number of records with valid entries for both variables.
- Assuming a table's orientation changes its meaning. Swapping rows and columns transposes the layout. It does not change how many individuals have each paired combination.
Check Your Understanding
Try these questions using the construction and checking ideas above.
- A record contains a person's preferred activity and whether they own a bicycle. What information determines the cell for that record in a two-way table?
- Why must the interior cell counts sum to the number of records represented when every record has valid values for both variables?
- A category combination is possible but occurs in none of the records. What count should its cell show, and why is a blank less clear?
- If three records lack a value for one of the two variables, what should be clarified before comparing the table's grand total with the original number of records?
- Does switching the row and column variables change the count for a particular pair of categories? Explain.