Introduction To Two Way Tables

avatar

Hi there. In this statistics/math/data management post, I provide an introduction to two way tables. This topic can be good for those in middle school, high school or for those in an introductory data management or statistics course.


Pixabay Image Source

 

Topics


  • Bar Graphs For Counts
  • Basic Two Way Tables
  • Adding More Rows & Columns To Two Way Tables

 

Bar Graphs For Counts


Before getting into two way tables, I think it is a good idea to review bar graphs for counts.

A simple bar graph is an elegant and nice way to display counts for categories. Examples of bar graphs include counts for favourite colours in a classroom, voting results between two candidates in a country, counts of people who like Nintendo, Microsoft or Sony as their favourite console company and more.

barGraph_example.PNG

Do keep in mind that the bottom row is for categorical variables. Categorical variables do not contain numbers. For the above example, the options for the bottom are Nintendo, Microsoft or Sony as console choices from the classroom survey.

 

Basic Two Way Tables


With a regular bar graph, we have observed counts for one variable. For two way tables, we have counts between two categorical variables.

A basic two way table has two categories where each category has two items and displays counts.

Example One

Class AClass B
Male1214
Female1514

 

On a more technical and statistical level, you can run a log-linear model to examine association and patterns between two categorical variables. There is also the chi-square test for independence for two way tables to determine if the two categorical variables are independent or not. These concepts are not covered here. You can click on the links for more information.

 

Example Two - Calculate Proportions

In this example, I show another two way table along with computing totals and proportions.

Class AClass B
Plays A Sport1011
Does Not Play A Sport1614

 

I can add another column and another row for totals. Here are the total amounts:

  • overall total for the number of students who do play a sport
  • an overall total for students not playing a sport
  • an overall total for Class A Students
  • an overall total for Class B Students
  • a grand total from all students surveyed
Class AClass BTotal
Plays A Sport101121
Does Not Play A Sport151429
Total252550

With this extended table, we can answer these questions.

a) How many students from Class A play a sport?

b) How many students do not play a sport from both classes?

c) What is the percentage of students that do play a sport from both classes?

d) From class B, what is the percentage for those who do play a sport?

e) What is the number of students who are not from class B and do play a sport?

 

Solutions

a) 10

b) 15 + 14 = 29

c) 21 out of 50 which is 42%

d) There are 25 students from class B. Eleven out of 25 do play a sport. This is 11/25 = 44%

e) The keyword and means that both conditions must be satisfied. Not from class B means class A. You want the number of students from Class A who do play a sport. This is 10 out of 50 which is 20%.

 

Example Three With An Included Bar Graph

In this third example, I include a bar graph (Excel screenshot) to show how you can display results from a two way table.

FemaleMale
Course Pass1211
Course Fail43

 

barGraph_example_coursepassfail.PNG

 

Adding More Rows & Columns To Two Way Tables


What if the two categories in a two way table have more items/choices? We can add more rows and columns to show that there are more items in each category.

Example One - Favourite Colours

The results are based on fake and made-up school survey for favourite colour.

BlackWhiteRedGreenBluePurplePinkYellow
Female81157118145
Male1442105217

 

With this table, there are more columns compared to the 2x2 two way table.

 

Example Two - More Rows & Columns

This second example deals with counts associated with final grade scores from three different classes in a subject.

Final GradeClass 1Class 2Class 3
80% and above Grade287
70 to 79.99%956
60 to 69.99%71411
50 to 59.99%131
Below 50%1182

 

With more rows and columns, finding information is trickier as a larger table is hard on the eyes. You can still find key information with an expanded table. As an example the total number of people with a final grade below 50% is 21 students (11 + 8 + 2).

As mentioned in Example one in Basic Two Way Tables, you can run a chi-square test for independence for two way tables. This is for determining if two categorical variables are independent (not related) or not.

I have included an Excel screenshot for a bar graph visual for this table.

extendedBarGraph.PNG

 

Thank you for reading.

Posted with STEMGeeks



0
0
0.000
2 comments
avatar

Good explanation of bar graph "A simple bar graph is an elegant and nice way to display counts for categories".

0
0
0.000
avatar

Thank you very much. Sometimes things just flow nicely when I draft these posts (offline).

0
0
0.000