Types of
Variables
Learn to distinguish categorical and quantitative variables: the foundation of choosing the right statistical analysis.
What Is a Variable?
In statistics, a variable is any characteristic, number, or quantity that can be measured or counted and that varies across individuals in a dataset.
The Two Main Types
Categorical Variables
A categorical variable (also called qualitative) places each observation into one of a set of groups or categories. Even if the categories look like numbers (e.g., zip codes), arithmetic on them is meaningless.
Quantitative Variables
A quantitative variable records a numerical value for which arithmetic operations like addition and averaging make sense. It answers the question "How much?" or "How many?"
The Classification Rule
Nominal vs Ordinal
| Nominal | Ordinal | |
|---|---|---|
| Natural order? | No | Yes |
| Equal spacing? | No | No |
| Can compute median? | No | Yes |
| Can compute mean? | No | No |
| Examples | Eye color, gender | Movie rating, class rank |
Discrete vs Continuous
| Discrete | Continuous | |
|---|---|---|
| Values | Countable (gaps between) | Any value in a range |
| Between \(2\) and \(3\)? | No value possible | \(2.5, 2.71, \ldots\) |
| Typical display | Bar chart | Histogram |
| Examples | Coin flips, students in class | Weight, distance, time |
Why Classification Matters
Correctly identifying a variable's type determines which statistical tools you can use. Using the wrong tool produces meaningless results.
How to Classify a Variable
Example 1: Height of Students
A researcher measures the height (in cm) of every student in a class. Values include \(165.2\), \(171.8\), \(158.0\), etc.
Example 2: Favorite Music Genre
A survey asks: "What is your favorite music genre?" Options: Pop, Rock, Hip-Hop, Classical, Jazz, Other.
Example 3: Jersey Numbers
A sports dataset records each player's jersey number: \(7\), \(23\), \(99\), \(10\), etc. These look like numbers, so they must be quantitative... right?
Example 4: Customer Satisfaction
Customers rate a product on a 5-point scale: Very Unsatisfied, Unsatisfied, Neutral, Satisfied, Very Satisfied.
Common Mistakes
Summary Table
| Feature | Nominal | Ordinal | Discrete | Continuous |
|---|---|---|---|---|
| Family | Categorical | Categorical | Quantitative | Quantitative |
| Order? | No | Yes | Yes | Yes |
| Mean? | No | No | Yes | Yes |
| Graph | Bar / Pie | Bar | Bar / Dotplot | Histogram |
| Example | Eye color | Grade letter | Siblings | Temperature |
Question 1 of 5
A dataset records the phone numbers of survey participants. What type of variable is "phone number"?
Question 2 of 5
A hospital records each patient's body temperature in degrees Fahrenheit. What type of variable is "body temperature"?
Question 3 of 5
Students rate their agreement with a statement on a scale: Strongly Disagree, Disagree, Neutral, Agree, Strongly Agree. This variable is best classified as:
Question 4 of 5
A researcher counts the number of pets owned by each household. The values are \(0, 1, 2, 3, \ldots\). This variable is:
Question 5 of 5
Which of the following is the best reason why correctly classifying a variable matters in statistics?