Classifying Variables and Analyzing Categorical Data Distributions

Variable Classification and Categorical Data Analysis

Variables are fundamentally divided into two categories: categorical and quantitative. Identifying the type of variable is the first step in data analysis, as it dictates which numerical summaries and graphical representations are appropriate for the data set.

  • Categorical Variables: These variables place individuals into one of several groups or categories.

    • Examples include: state of residence, gender, ZIP code, and floor of a building.

    • ZIP codes and building floors are considered categorical because they represent labels or locations rather than measurable quantities where an average would be meaningful.

  • Quantitative Variables: These involve numerical values for which arithmetic operations such as averaging make sense. They are further divided into discrete and continuous variables.

    • Examples include: number of languages spoken at home, height (64.25inches64.25\,\text{inches}), and salary.

Discrete vs. Continuous Quantitative Variables

Once a variable is identified as quantitative, it must be classified as either discrete or continuous to determine the most effective graphing methods and numerical summaries.

  • Discrete Variables: These consist of values that are countable. They often result from counting individuals or items.

    • Wordle Example: The number of guesses to solve a Wordle puzzle is discrete because the options are limited to integers 1,2,3,4,5,or 61, 2, 3, 4, 5, \text{or } 6. One cannot solve it in 1.51.5 or 3.253.25 guesses.

    • AP Statistics Scores: Scores on the AP exam are discrete (1,2,3,4,or 51, 2, 3, 4, \text{or } 5). One cannot receive a 2.52.5 or 4.54.5.

    • Other Examples: Number of desks in a classroom, number of streaming subscriptions, and number of touchdowns in a game.

  • Continuous Variables: These can take any value in a given interval. They are typically measurements.

    • Height Example: While someone might say they are 62inches62\,\text{inches} tall, the actual measurement could be 60.187inches60.187\,\text{inches}. Height exists on a continuous scale.

    • Time and Distance: The amount of time it takes to drive to work or the miles driven are continuous because they can be measured to an infinite number of decimal places (e.g., 12.43minutes12.43\,\text{minutes}, 5.7miles5.7\,\text{miles}).

    • Other Examples: Weight, amount of water consumed, and distance traveled.

Understanding Distributions and Frequency Tables

A distribution describes what values a variable takes and how often it takes those values. Distributions can be represented through tables or graphs.

  • Frequency Table: A simple table that lists the count of individuals falling into each category.

    • Example: A table listing the number of people who preferred different communication methods like text, Snapchat, Instagram, phone calls, or face-to-face interaction.

  • Relative Frequency Table: This table shows the proportion or percentage of individuals in each category.

    • Formula: Relative Frequency=Count in CategoryTotal Count\text{Relative Frequency} = \frac{\text{Count in Category}}{\text{Total Count}}

    • Fractions, decimals, or percentages are all acceptable formats for relative frequencies.

  • Perspective on Marketing: Marketers often use graphs to make specific data points stand out. This can sometimes lead to misleading graphs that misrepresent the actual numerical data to favor a specific perspective.

Analyzing Two-Way Tables

Two-way tables (contingency tables) are used to summarize data on two categorical variables collected from the same group of individuals.

  • Sample Data: A study of 337337 individuals categorized by age range (e.g., 1535,3650,5165,66+15-35, 36-50, 51-65, 66+) and preferred method of communication.

  • Margins: The totals for each row and column located at the edges of the table.

  • Marginal Relative Frequency: This gives the distribution of one of the categorical variables among all individuals described by the table.

    • Calculation: Divide the row or column total by the overall table total (n=337n = 337).

  • Joint Relative Frequency: This describes the proportion of individuals that fall into a specific intersection of two categories.

    • Calculation: Divide the count in a specific cell (where a row and column meet) by the overall table total.

    • Example: If 1010 people in the 365036-50 age group prefer Snapchat, the joint relative frequency is 103373%\frac{10}{337} \approx 3\%.

  • Conditional Relative Frequency: This describes the distribution of one variable for a specific group of individuals defined by the other variable.

    • Calculation: Divide the cell count by the total of the row or column specified as the condition.

    • Example: To find the percentage of 365036-50 year-olds who like Snapchat, identify the 1010 individuals in that cell and divide by the total number of people in the 365036-50 age group (6565). The math is 106515.4%\frac{10}{65} \approx 15.4\%.

Graphical Analysis of Categorical Data

Graphs for categorical data allow for visual comparisons of frequencies and proportions.

  • Pie Charts: Used to show parts of a whole using percentages (360360^{\circ} of a circle). They are difficult to construct by hand but useful for visual parts-to-whole comparisons.

  • Bar Graphs: Used to represent counts or percentages of categorical variables. Bars must be of equal width with spaces between them.

  • Side-by-Side Bar Graphs: Useful for comparing two categorical variables. These typically use raw counts on the y-axis.

  • Segmented Bar Graphs (Stacked Bar Graphs): Each bar represents a category of one variable, and the bar is divided (segmented) into proportions of the second variable. The total height of the bar is always 100%100\%.

  • Mosaic Plot: A variation of the segmented bar graph where the width of each bar is proportional to the number of individuals in that category. This provides four pieces of information (frequency/width of the groups, segments of the categories, and the relationship between x and y axes).

Association Between Variables

An association exists between two variables if knowing the value of one variable helps predict the value of the other.

  • Evidence of Association: In a segmented bar graph or mosaic plot, if the segments (bar widths or heights) vary significantly across different categories, it suggests an association. For example, if younger age groups prefer Snapchat significantly more than older groups, there is an association between age and communication preference.

  • No Association: If the distributions are roughly the same across all categories of the other variable, there is no evidence of an association. The variables are considered independent.

  • Causation vs. Prediction: An association does not imply that one variable causes the other. Causal conclusions can only be drawn from well-controlled experiments. Statistics emphasizes that associations are patterns used for prediction, which may be correct or incorrect.

Questions & Discussion

Question: Can you have zero languages spoken at home? Response: If someone surveyed no languages, that would be categorical. However, the number of languages is countable (1,2,31, 2, 3), which makes it a quantitative discrete variable because you could calculate the average number of languages spoken among a group of people.

Question: What are the requirements for passing the AP Statistics exam? Response: Scores of 3,4, or 53, 4, \text{ or } 5 are generally considered passing. Schools like Mississippi State, UAB, Alabama, and Auburn usually accept a 33 and up for statistics credit. However, for language exams, some schools like Auburn might require a 4 or 54 \text{ or } 5.

Question: Why use a mosaic plot over a segmented bar graph? Response: A mosaic plot is often more accurate because it visualizes the relative size of each group through the width of the bar. It provides an extra layer of information—the proportion of the total sample that each category represents—which other graphs lack.

Question: Which bar graph is easier to create? Response: The side-by-side bar graph is generally easier to create because it uses direct counts and does not require converting every data point into a percentage of a sub-total first, as is required for segmented or mosaic plots.