Contingency Tables May Be Used to Summarize Continuous Variables

Chapter 4. Data Summary Using Tables and Measures

4.2 Contingency Table for Two Variables

[presentation] [video]


A contingency table or cross table is used to summarize two categorical variables and is also used to study an association of two variables. A cross table divides a table into rows and columns to create cells by using possible values of two categorical variables, and then counts the number of observations (frequency) belonging to the corresponding cell. Percentage of each cell for the sum of rows, or percentage of each cell for the sum of columns can be shown in a contingency table for further analysis. Percentage of each cell for the total number of data can also be shown in a cross table.

A contingency table is usually made for two qualitative data. In case of two quantitative data, the quantitative data can be transformed into qualitative data by using intervals, and then a contingency table for these qualitative data can be created.

Contingency Table

Contingency table or cross table divides a table into rows and columns to create cells by using possible values of two categorical variables, and then counts the number of observations (frequency) belonging to the corresponding cells.

In case of two quantitative data, the data can be transformed into qualitative data by using intervals, and then a contingency table for these qualitative data can be created.

4.2.1 Contingency Table for Two Categorical Variables

Let us discuss how to create a contingency table from the raw data of two categorical variables using the following example.

Example 4.2.1 (Survey on Gender and Marital Status)
Table 4.2.1 shows survey data on gender (1: Male, 2: Female) and marital status (1: Single, 2: Married, 3: Other) which are used in Example 2.2.3. Create a contingency table of the marital status by gender using 『eStat』

Table 4.2.1 Survey data on gender and marital status

Gender Marital Status
1 1
2 2
1 1
2 1
1 2
1 1
1 1
2 2
1 3
2 1

[Ex] ⇨ eBook ⇨ EX040201_Categorical_MaritalByGender.csv.

Answer

Enter the data of the gender and the marital status in Table 4.2.1 to the sheet of 『eStat』 as in <Figure 4.2.1>. Use [Edit Var] button to enter a variable name 'Gender' and value labels 'Male' for 1 and 'Female' for 2. In the same way, enter a variable name 'Marital' and value labels 'Single' for 1, 'Married' for 2 and 'Other' for 3. The data that were edited for their value labels should be saved in JSON format file by clicking on the JSON Save icon. If you want to load this file in JSON format, you must also click on the JSON Open icon which is for loading a file in JSON format.

<Figure 4.2.1> Data input on gender and marital status

Click on the variable name 'Marital' ('Analysis Var'), and then the variable name 'Gender' ('by Group'). Then you will see a bar graph of the marital status by gender as in <Figure 4.2.2> which is a default graph. Click the Frequency Table icon to display a contingency table of the marital status by gender in the Log Area as in <Figure 4.2.3>. In this contingency table, the 'by Group' variable becomes the row variable and the 'Analysis Var' becomes the column variable. This contingency table was used to draw the bar graph of the marital status by gender as in <Figure 4.2.2>.

<Figure 4.2.2> Bar graph on marital status by gender

<Figure 4.2.3> Contingency table on marital status and gender

Practice 4.2.1 (Survey on Gender and Vegetable Preference)
In a class of an elementary school, a survey on gender (1: male, 2: female) and favorite vegetable (1: lettuce, 2: spinach, 3: pumpkin, 4: eggplant) was conducted. The survey data can be found at the following location of 『eStat』.

[Ex] ⇨ eBook ⇨ PR040201_Categorical_VegetablePrefByGender.csv.

Create a contingency table of the favorite vegetable by gender.

4.2.2 Contingency Table for Two Quantitative Variables

In order to create a contingency table for two quantitative variables, we need to divide all possible values of each quantitative variable into some number of intervals as we did when creating a frequency table of single quantitative variable.

If both variables are quantitative, it is advisable to use a statistical software such as R, SPSS, and SAS etc. If one variable is categorical and the other one is quantitative, then a contingency table can be made by using 『eStat』. Let's take a look at the following example.

Example 4.2.2 (Teacher's Age by Gender)
In a middle school, the age and gender of all teachers are surveyed. The data are saved at the following location of 『eStat』.

[Ex] ⇨ eBook ⇨ EX040202 Continuous_TeacherAgeByGender.csv.

By using the histogram module of 『eStat』 , create a contingency table of the age by gender.

Answer

Retrieve the data from 『eStat』 as in <Figure 4.2.4> and enter value labels of 'Gender' as 'Male' for 1 and 'Female' for 2.

<Figure 4.2.4> Data input on gender and age

After clicking the histogram icon, select the 'Age' variable as 'Analysis Var', and then the 'Gender' variable as 'by Group'. A histogram will appear as shown in <Figure 4.2.5>.

<Figure 4.2.5> Histogram on age by gender

If you click the button of 'Frequency Table' in the options window below the graph (<Figure 4.2.6>), a contingency table will appear in the Log Area as shown in <Figure 4.2.7>.

<Figure 4.2.6> Options of the histogram

<Figure 4.2.7> Contingency table of age by gender

If the intervals of the histogram in <Figure 4.2.5> are to be readjusted, for example, from 20 to 10 years apart, set 'Interval Start' to 20 and 'Interval Width' to 10 in the graph options and press [Execute New Interval] button. Then a histogram with the adjusted intervals is appeared as in <Figure 4.2.8>, and a contingency table with the adjusted intervals can be obtained by clicking on [Frequency Table] button as shown in <Figure 4.2.9>.

<Figure 4.2.8> Histogram with adjusted intervals

<Figure 4.2.9> Contingency table with adjusted intervals

Practice 4.2.2 (Oral Cleanliness by Brushing Methods)
Oral cleanliness scores according to the brushing method (1:basic method, 2: rotation method) are examined and stored at the following location of 『eStat』.

[Ex] ⇨ eBook ⇨ PR040202_Continuous_ToothCleanByBrushMethod.csv.

Create a contingency table of oral cleanliness by brushing method.

escobarimettences.blogspot.com

Source: http://www.estat.me/estat/eLearning/en/chapter04/0402.html

0 Response to "Contingency Tables May Be Used to Summarize Continuous Variables"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel