Copyright

Calculating Expected Counts for a Two-Way Table of Categorical Data

Andrew Davis
  • Instructors
    Andrew Davis

    Andrew Davis holds a Ph.D., ABD in Statistics from The University of Alabama in Huntsville, where he has been practicing as a research statistician for 5 years. His research aims to help rural students gain access to STEM education.

How to Calculate Expected Counts for a Two-Way Table of Categorical Data

Step 1: Append row and column totals to the two-way table.

Step 2: Use the expected count formula to calculate the expected count of each cell in the two-way table.

Step 3: Organize the expected counts in a table.

What are a Two-Way Table and an Expected Count?

A two-way table is a type of data table that is used to display frequency data for two categorical variables. An example of a two-way table follows.

Variable 1 Variable 2 Row Total
Category 1 a b a+b
Category 2 c d c+d
Column Total a+c b+d Grand Total: a+b+c+d

An expected count is the theoretically expected frequency of a cell in a two-way table, supposing that the variables under study are independent. The following formula is used to calculate an expected count for a cell in a two-way table.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} {/eq}

That is, the product of the Row Total and the Column Total is computed for the row and column containing the cell of interest, and then that product is divided by the Grand Total. To obtain, for example, the expected count for the cell containing the lowercase "a" in the two-way table provided above, multiply the Row Total of the row containing Cell "a" and the Column Total of the column containing Cell "a" together, then divide by the Grand Total. The formula is applied as follows.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} = \frac{(a+b)\cdot(a+c)}{(a+b+c+d)} {/eq}

Next, we will review two examples of calculating expected counts for a two-way table of categorical data.

Examples of Calculating Expected Counts for a Two-Way Table of Categorical Data

Example 1

A teacher wants to know more about student reading habits. The teacher polls 50 boys and 50 girls and asks them whether they prefer fiction or nonfiction books. Then, the teacher creates the following two-way table from the collected data.

Boys Girls
Fiction 35 10
Nonfiction 15 40

To better understand the data, the teacher decides to calculate the expected counts for the two-way table. Assuming independence between both the gender and book genre variables, what would the expected count be for each cell in the two-way table?

Step 1: Append row and column totals to the two-way table.

Row totals and column totals can be added to the two-way table to assist in the computation of the expected counts. These totals are obtained by summing the cells in each row and column.

Boys Girls Row Total
Fiction 35 10 45
Nonfiction 15 40 55
Column Total 50 50 Grand Total: 100

Step 2: Use the expected count formula to calculate the expected count of each cell in the two-way table.

Now, the expected count formula can be applied to each cell in the two-way table. To find the expected count of boys who prefer fiction books, compute the product of the row total for fiction and the column total for boys, then divide this product by the grand total.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{45\cdot50}{100} = 22.5 {/eq}

To find the expected count of boys who prefer nonfiction books, compute the product of the row total for nonfiction and the column total for boys, then divide this product by the grand total.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{55\cdot50}{100} = 27.5 {/eq}

To find the expected count of girls who prefer fiction books, compute the product of the row total for fiction and the column total for girls, then divide this product by the grand total.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{45\cdot50}{100} = 22.5 {/eq}

To find the expected count of girls who prefer nonfiction books, compute the product of the row total for nonfiction and the column total for girls, then divide this product by the grand total.

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{55\cdot50}{100} = 27.5 {/eq}

Step 3: Organize the expected counts in a table.

Last, organize the results of the expected count calculations into a table of expected counts for presentation.

Boys Girls
Fiction 22.5 22.5
Nonfiction 27.5 27.5

These expected count values represent the theoretically expected values of each cell in the two-way table (assuming independence between the gender and book genre variables).

Example 2

A coach wants to know which sports should be offered at a school. To begin to figure out students' preferences, the coach asks 80 athletes and 50 non-athletes whether they prefer baseball or basketball. The coach collects the following data.

Athletes Non-Athletes
Baseball 25 30
Basketball 55 20

To better understand this data set, the coach wants to calculate the expected counts for the data contained in this two-way table. Assuming independence between both the athleticism and sport variables, what would the expected count be for each cell in the two-way table?

Step 1: Append row and column totals to the two-way table.

Row totals and column totals can be added to the two-way table to assist in the computation of the expected counts.

Athletes Non-Athletes Row Total
Baseball 25 30 55
Basketball 55 20 75
Column Total 80 50 Grand Total: 130

Step 2: Use the expected count formula to calculate the expected count of each cell in the two-way table.

To find the expected count of athletes who prefer baseball:

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{55\cdot80}{130} = 33.8 {/eq}

To find the expected count of athletes who prefer basketball:

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{75\cdot80}{130} = 46.2 {/eq}

To find the expected count of non-athletes who prefer baseball:

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{55\cdot50}{130} = 21.2 {/eq}

To find the expected count of non-athletes who prefer basketball:

{eq}Expected\ Count = \frac{(Row\ Total)\cdot(Column\ Total)}{(Grand\ Total)} =\frac{75\cdot50}{130} = 28.8 {/eq}

Step 3: Organize the expected counts in a table.

Organize the results of the expected count calculations into a table of expected counts for presentation.

Athletes Non-Athletes
Baseball 33.8 21.2
Basketball 46.2 28.8

Recently updated on Study.com

Support