Chi-square in Data Analytics
Introduction to Categorical Data
Data in Categories
Not all data can be measured with a ruler or a stopwatch. Some data is about sorting things into groups. This is called categorical data. It involves variables that represent distinct labels or categories.
Think of it like sorting laundry. You put socks in one pile, shirts in another, and pants in a third. Each pile is a category.
Categorical data helps us answer questions about groups. For example, which brand of smartphone is most popular? Or what percentage of a population has a certain eye color? Instead of measuring how much of something there is, we're counting how many items fall into each group. There are two main types of categorical data: nominal and ordinal.
Nominal Data
Nominal data describes categories that do not have a natural order or ranking. The word "nominal" comes from the Latin word for "name." These categories are just names for different groups.
With nominal data, the order doesn't matter. 'Red, Blue, Green' is the same as 'Blue, Green, Red'.
Examples of nominal data are all around us. Eye color (blue, brown, green), type of pet (dog, cat, fish), or a person's country of origin are all nominal variables. There’s no inherent sense in which "brown eyes" are greater than or less than "blue eyes." They are simply different.
| Variable | Possible Categories |
|---|---|
| Marital Status | Single, Married, Divorced, Widowed |
| Blood Type | A, B, AB, O |
| Transportation | Car, Bus, Train, Bicycle |
Ordinal Data
Ordinal data, on the other hand, describes categories that do have a meaningful order or ranking. While we know the order, we don't know the exact difference between the categories. The gaps between them aren't necessarily equal.
With ordinal data, the order is key. 'Small, Medium, Large' has a clear sequence.
Think about a customer satisfaction survey. The options might be "Very Unsatisfied," "Neutral," and "Very Satisfied." We know that "Very Satisfied" is better than "Neutral," but we can't say it's exactly twice as good. Other common examples include education level (High School, Bachelor's, Master's) or spiciness levels at a restaurant (Mild, Medium, Hot).
| Variable | Possible Categories (in order) |
|---|---|
| T-Shirt Size | Small, Medium, Large, X-Large |
| Income Bracket | Low, Middle, High |
| Movie Rating | 1 Star, 2 Stars, 3 Stars, 4 Stars, 5 Stars |
This diagram breaks down the two types of categorical data.
Why It Matters
Understanding categorical data is crucial because many real-world questions involve groups, not just numbers on a scale. It's the foundation for analyzing surveys, user behavior, and experimental outcomes across many fields.
In marketing, analysts might track which ad design (A, B, or C) leads to the most product purchases. The ad design is a nominal variable. By counting the outcomes for each category, a company can make better decisions about its advertising strategy.
In biology, a researcher might study whether a specific gene variant (present or absent) is associated with a certain medical condition (present or absent). Both are nominal variables. Analyzing these categories can lead to breakthroughs in understanding diseases.
In the social sciences, a sociologist could investigate if there's a relationship between a person's highest level of education (an ordinal variable) and their opinion on a public policy issue (another ordinal variable, e.g., 'oppose', 'neutral', 'support'). This helps reveal patterns in public opinion.
Being able to correctly identify and work with categorical data is the first step toward unlocking insights hidden in these kinds of datasets.
Ready to test your understanding?
Which of the following best describes the primary purpose of categorical data?
What is the key difference between nominal and ordinal data?
Now that you can distinguish between different types of categorical data, you're ready to learn how to analyze it.
