Relations A statistical Approach

In most studies involving two variables, each of the variables has a role. We distinguish between:

  • the explanatory variable (also commonly referred to as the independent variable)-—the variable that claims to explain, predict or affect the response; and
  • the response variable (also commonly referred to as the dependent variable)-—the outcome of the study.

Typically the explanatory (or independent) variable is denoted by X, while the response (or dependent) variable is denoted by Y.

If we further classify each of the two relevant variables according to type (categorical or quantitative), we get the following 4 possibilities for “role-type classification”

  1. Categorical explanatory and quantitative response
  2. Categorical explanatory and categorical response
  3. Quantitative explanatory and quantitative response
  4. Quantitative explanatory and categorical response

Categorical Explanatory Variable and Quantitative Response Variable

We are now ready to start with Case C→Q, exploring the relationship between two variables where the explanatory variable is categorical, and the response variable is quantitative. As you’ll discover, exploring relationships of this type is something we’ve already discussed in this Blog, but we didn’t frame the discussion this way.

Background: People who are concerned about their health may prefer hot dogs that are low in calories. A study was conducted by a concerned health group in which 54 major hot dog brands were examined, and their calorie contents recorded. In addition, each brand was classified by type: beef, poultry, and meat (mostly pork and beef, but up to 15% poultry meat). The purpose of the study was to examine whether the number of calories a hot dog has is related to (or affected by) its type. (Reference: Moore, David S., and George P. McCabe (1989). Introduction to the Practice of Statistics. Original source: Consumer Reports, June 1986, pp. 366-367.)

Answering this question requires us to examine the relationship between the categorical variable, Type and the quantitative variable Calories. Because the question of interest is whether the type of hot dog affects calorie content,

  • the explanatory variable is Type, and
  • the response variable is Calories.

Here is what the raw data look like:

A table of the data. There are three columns, "Brand", "Type", and "Calories". "Type" is the Explanatory variable, and "Calories" is the Response variable. Some example data: Brand 1, Beef, 186; Brand 2, Poultry, 129; Brand 3, Beef, 181; Brand 4, Meat, 183; ... (abbreviated) ... Brand 54, Poultry, 144

The raw data are a list of types and calorie contents, and are not very useful in that form. To explore how the number of calories is related to the type of hot dog, we need an informative visual display of the data that will compare the three types of hot dogs with respect to their calorie content.

The visual display that we’ll use is side-by-side boxplots (which we’ve seen before). The side-by-side boxplots will allow us to compare the distribution of calorie counts within each category of the explanatory variable, hot dog type:

By examining the three side-by-side boxplots and the numerical summaries, we see at once that poultry hot dogs, as a group, contain fewer calories than those made of beef or meat. The median number of calories in poultry hot dogs (113) is less than the median (and even the first quartile) of either of the other two distributions (medians 152.5 and 153). The spread of the three distributions is about the same, if IQR is considered (all slightly above 40), but the (full) ranges vary slightly more (beef: 80, meat: 88, poultry: 66). The general recommendation to the health-conscious consumer is to eat poultry hot dogs. It should be noted, though, that since each of the three types of hot dogs shows quite a large spread among brands, simply buying a poultry hot dog does not guarantee a low-calorie food.

What we learn from this example is that when exploring the relationship between a categorical explanatory variable and a quantitative response (Case C→Q), we essentially compare the distributions of the quantitative response for each category of the explanatory variable using side-by-side boxplots supplemented by descriptive statistics. Recall that we have actually done this before when we talked about the boxplot and argued that boxplots are most useful when presented side by side for comparing distributions of two or more groups. This is exactly what we are doing here!

Two-Way Tables

We are done with case C→Q, and will now move on to case C→C, where we examine the relationship between two categorical variables.

Earlier in the Blog, (when we discussed the distribution of a single categorical variable) we examined the data obtained when a random sample of 1,200 U.S. college students were asked about their body image (underweight, overweight, or about right.) We are now returning to this example, to address the following question:

If we had separated our sample of 1,200 U.S. college students by gender and looked at males and females separately, would we have found a similar distribution across body-image categories? More specifically, are men and women just as likely to think their weight is about right? Among those students who do not think their weight is about right, is there a difference between the genders in feelings about body image?

Answering these questions requires us to examine the relationship between two categorical variables, gender and body image. Because the question of interest is whether there is a gender effect on body image,

  • the explanatory variable is gender, and
  • the response variable is body image.

Here is what the raw data look like when we include the gender of each student:

A table of the data. There are three columns, "Student", "Gender", and "Body Image". "Gender" is the Explanatory variable, and "Body Image" is the Response variable. Some example data: ... (abbreviated) ... student 25, M, overweight; student 26, M, about right; student 27, F, underweight; student 28, F, about right; student 29, M, about right; ... (abbreviated) ...

Once again the raw data is a long list of 1,200 genders and responses, and thus not very useful in that form. To start our exploration of how body image is related to gender, we need an informative display that summarizes the data. In order to summarize the relationship between two categorical variables, we create a display called a two-way table.

Here is the two-way table for our example:

A two-way table. The columns are for each possible category in "Body Image". These categories are "About Right", "Overweight ", "Underweight". There is also an additional column for Total. In addition, there is a row for each of the categories in "Gender". These are "Female" and "Male" There is also an additional Total row. So, overall, there are 4 columns of the names "About Right", "Overweight", "Underweight", and "Total". There are 3 rows, "Female", "Male", and "Total". Here are the values in the cells, in Row,Column: Value format: Female, About Right: 560; Female, Overweight: 163; Female, Underweight: 37; Female, Total: 760; Male, About Right: 295; Male, Overweight: 72; Male, Underweight: 73; Male, Total: 440; Total, About Right: 855; Total, Overweight: 235; Total, Under Weight: 110; Total, Total (Total # of Responses): 1200;

The table has the possible genders in the rows, and the possible responses regarding body image in the columns. At each intersection between row and column, we put the counts for how many times that combination of gender and body image occurred in the data. We sum across the rows to fill in the Total column, and we sum across the columns to fill in the Total row.

 Conditional Percents

So far, we have organized the raw data in a much more informative display—the two-way table:

The same table as on the previous page. The description of it for reference: A two-way table. The columns are for each possible category in "Body Image". These categories are "About Right" "Overweight ", "Underweight". There is also an additional column for Total. In addition, there is a row for each of the categories in "Gender". These are "Female" and "Male" There is also an additional Total row. So, overall, there are 4 columns of the names "About Right", "Overweight", "Underweight", and "Total". There are 3 rows, "Female", "Male", and "Total". Here are the values in the cells, in Row,Column: Value format: Female, About Right: 560; Female, Overweight: 163; Female, Underweight: 37; Female, Total: 760; Male, About Right: 295; Male, Overweight: 72; Male, Underweight: 73; Male, Total: 440; Total, About Right: 855; Total, Overweight: 235; Total, Under Weight: 110; Total, Total (Total # of Responses): 1200;

Remember, though, that our primary goal is to explore how body image is related to gender. Exploring the relationship between two categorical variables (in this case, body image and gender) amounts to comparing the distributions of the response variable (in this case, body image) across the different values of the explanatory variable (in this case, males and females):

The two-way table with the "Female" and "Male" rows highlighted. These are the rows for which we need to compare distributions.

Note that it doesn’t make sense to compare raw counts, because there are more females than males overall. So, for example, it is not very informative to say, “There are 560 females who responded ‘about right’ compared to only 295 males,” since the 560 females are out of a total of 760, and the 295 males are out of a total of only 440.

We need to supplement our display, the two-way table, with some numerical summaries that will allow us to compare the distributions. These numerical summaries are found by simply converting the counts to percentages within (or restricted to) each value of the explanatory variable separately.

In our example, we look at each gender separately and convert the counts to percentages within that gender. Let’s start with females:

The same table, but with percents instead, and without the "Total" row. Here are the cells, in "Row, Column: Value " format: Female, About Right: 560/760 = 73.7%; Female, Overweight: 163/760 = 21.5%; Female, Underweight: 37/760 = 4.9%; Female, Total: 760/760 = 100%; The Male row is blank.

Note that each count is converted to a percentage by dividing by the total number of females, 760. These numerical summaries are called conditional percentages, since we find them by “conditioning” on one of the genders.

Now find for the males.

Comments

  1. In our example, we chose to organize the data with the explanatory variable gender in rows and the response variable body image in columns, and thus our conditional percentages were row percentages, calculated within each row separately. Similarly, if the explanatory variable happens to sit in columns and the response variable in rows, our conditional percentages will be column percentages, calculated within each column separately. For an example, see the “Did I Get This?” exercises below.
  2. Another way to visualize the conditional percentages, instead of in a table, is to use a double bar chart. This display is quite common in newspapers.
A two-way table, the same as the previous table explaining conditional percents. However, the "Male" row has been filled in. The cells in "Row,Column: Value" format: Female, About Right: 73.7%; Female, Overweight: 21.4%; Female, Underweight: 4.9%; Female, Total: 100%; Male, About Right: 67.0%; Male, Overweight: 16.4%; Male, Underweight: 16.6%; Male, Total: 100%; Below this is a double bar chart. The vertical axis is labeled "Percent", it ranges from 0 to 80%. The horizontal axis is labeled "Body Image". There are 3 sub-categories which make up 3 groups of bars. These categories are "about right", "overweight", and "underweight". Each category has two bars, one for male, and one for female, for a total of 6 bars in the graph. Here are the bars, and their values: About Right,Female: 73.7% About Right, Male: 67.0% Overweight, Female: 21.4% Overweight, Male: 16.4% Underweight, Female: 4.9% Underweight, Male: 16.6%

Now that we have summarized the relationship between the categorical variables gender and body image, let’s go back and interpret the results in the context of the questions that we posed.

Two Quantitative Variables

In the previous two cases we had a categorical explanatory variable, and therefore exploring the relationship between the two variables was done by comparing the distribution of the response variable for each category of the explanatory variable:

  • In case C→Q we compared distributions of the quantitative response.
  • In case C→C we compared distributions of the categorical response.

Case Q→Q is different in the sense that both variables (in particular the explanatory variable) are quantitative, and therefore, as you’ll discover, this case will require a different kind of treatment and tools.

Example: Highway Signs

A Pennsylvania research firm conducted a study in which 30 drivers (of ages 18 to 82 years old) were sampled, and for each one, the maximum distance (in feet) at which he/she could read a newly designed sign was determined. The goal of this study was to explore the relationship between a driver’s age and the maximum distance at which signs were legible, and then use the study’s findings to improve safety for older drivers. (Reference: Utts and Heckard, Mind on Statistics (2002). Originally source: Data collected by Last Resource, Inc, Bellfonte, PA.)

Since the purpose of this study is to explore the effect of age on maximum legibility distance,

  • the explanatory variable is Age, and
  • the response variable is Distance.

Here is what the raw data look like:

A table of the data. There are three columns, "Driver", "Age", and "Distance". "Age" is the Explanatory variable, and "Distance" is the Response variable. Some example data: Driver 1, 18, 510; Driver 2, 32, 410; Driver 3, 55, 420; Driver 4, 23, 510; ... (abbreviated) ... Driver 30, 82, 360;

Note that the data structure is such that for each individual (in this case driver 1….driver 30) we have a pair of values (in this case representing the driver’s age and distance). We can therefore think about these data as 30 pairs of values: (18, 510), (32, 410), (55, 420), … , (82, 360).

The first step in exploring the relationship between driver age and sign legibility distance is to create an appropriate and informative graphical display. The appropriate graphical display for examining the relationship between two quantitative variables is the scatterplot. Here is how a scatterplot is constructed for our example:

To create a scatterplot, each pair of values is plotted, so that the value of the explanatory variable (X) is plotted on the horizontal axis, and the value of the response variable (Y) is plotted on the vertical axis. In other words, each individual (driver, in our example) appears on the scatterplot as a single point whose X-coordinate is the value of the explanatory variable for that individual, and whose Y-coordinate is the value of the response variable. Here is an illustration:

A scatterplot. The Y-Axis is labeled "Sign Legibility Distance (feet)", and the X-axis is labeled "Driver Age (years)" Already plotted is Driver 1's data point. It is located at x=18,y=510. Also, Driver 2's data point has been ploted, at x=32,y=410.

And here is the completed scatterplot:

The completed scatterplot. There are 30 data points, shown as black dots scattered about.

Comment

It is important to mention again that when creating a scatterplot, the explanatory variable should always be plotted on the horizontal X-axis, and the response variable should be plotted on the vertical Y-axis. If in a specific example we do not have a clear distinction between explanatory and response variables, each of the variables can be plotted on either axis.

Interpreting the Scatterplot

How do we explore the relationship between two quantitative variables using the scatterplot? What should we look at, or pay attention to?

Recall that when we described the distribution of a single quantitative variable with a histogram, we described the overall pattern of the distribution (shape, center, spread) and any deviations from that pattern (outliers). We do the same thing with the scatterplot. The following figure summarizes this point:

When describing the relationship between two quantitative variables using a scatterplot, we look at: (1) The overall pattern, which can be described using direction, form, and strength. We also look at (2) Deviations from the pattern, which result from outliers.

As the figure explains, when describing the overall pattern of the relationship we look at its direction, form and strength.

  • The direction of the relationship can be positive, negative, or neither:


    positive (or increasing) relationship means that an increase in one of the variables is associated with an increase in the other.A negative (or decreasing) relationship means that an increase in one of the variables is associated with a decrease in the other.Not all relationships can be classified as either positive or negative.
  • The form of the relationship is its general shape. When identifying the form, we try to find the simplest way to describe the shape of the scatterplot. There are many possible forms. Here are a couple that are quite common:Relationships with a linear form are most simply described as points scattered about a line:
    Relationships with a curvilinear form are most simply described as points dispersed around the same curved line:
    There are many other possible forms for the relationship between two quantitative variables, but linear and curvilinear forms are quite common and easy to identify. Another form-related pattern that we should be aware of is clusters in the data:
  • The strength of the relationship is determined by how closely the data follow the form of the relationship. Let’s look, for example, at the following two scatterplots displaying positive, linear relationships:

    The strength of the relationship is determined by how closely the data points follow the form. We can see that in the top scatterplot the data points follow the linear pattern quite closely. This is an example of a strong relationship. In the bottom scatterplot, the points also follow the linear pattern, but much less closely, and therefore we can say that the relationship is weaker. In general, though, assessing the strength of a relationship just by looking at the scatterplot is quite problematic, and we need a numerical measure to help us with that. We will discuss that later in this section.

Data points that deviate from the pattern of the relationship are called outliers. We will see several examples of outliers during this section. Two outliers are illustrated in the scatterplot below:

A scatterplot which has a positive relationship. Most of the points are in a line-like shape from the bottom left of the plot to the top right. However, there are two points which do not match this trend. One is far below the majority of the points and the other is far left. These points do not participate in the line-like shape at all.

Let’s go back now to our example, and use the scatterplot to examine the relationship between the age of the driver and the maximum sign legibility distance. Here is the scatterplot:

A scatterplot. The Y-Axis is labeled "Sign Legibility Distance (feet)", and the X-axis is labeled "Driver Age (years)" There are 30 points on the plot.

The direction of the relationship is negative, which makes sense in context, since as you get older your eyesight weakens, and in particular older drivers tend to be able to read signs only at lesser distances. An arrow drawn over the scatterplot illustrates the negative direction of this relationship:

A line from the upper left of the plot to the lower right has been drawn. The points of the scatterplot roughly follow this line.

The form of the relationship seems to be linear. Notice how the points tend to be scattered about the line. Although, as we mentioned earlier, it is problematic to assess the strength without a numerical measure, the relationship appears to be moderately strong, as the data is fairly tightly scattered about the line. Finally, all the data points seem to “obey” the pattern—there do not appear to be any outliers.

In next we will explore different relationship and move to more statistical measures.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s