01 / 21

Types of
Variables

Learn to distinguish categorical and quantitative variables: the foundation of choosing the right statistical analysis.

College Statistics

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.

Examples
Height, eye color, GPA, zip code, temperature
Key idea
Not all variables are numbers: some record categories or labels

The Two Main Types

Variable Categorical Quantitative Nominal Ordinal Discrete Continuous eye color, brand rating, grade letter children, shoe size height, weight

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.

Nominal
Categories with no natural order: blood type (A, B, AB, O), favorite color, country of birth
Ordinal
Categories with a meaningful order but unequal spacing: letter grades (A, B, C), satisfaction ratings (low, medium, high)

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?"

Discrete
Countable values, often whole numbers: number of siblings, cars owned, goals scored
Continuous
Can take any value in an interval: height (\(172.34\) cm), time (\(3.1415\) seconds), temperature

The Classification Rule

Does the value measure a quantity? YES NO CATEGORICAL Is there a natural order? NO YES Nominal Ordinal QUANTITATIVE Can it take any value in a range? NO YES Discrete Continuous

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.

Categorical
Summarize with frequencies, proportions, and bar charts. Test with chi-square tests.
Quantitative
Summarize with mean, standard deviation, and histograms. Test with \(t\)-tests or regression.

How to Classify a Variable

1
Read the variable description. What does it record: a label/group or a numeric measurement?
2
Apply the mean test. Does computing the average make sense? If no: categorical. If yes: quantitative.
3
Refine categorical. Is there a natural ranking among categories? If yes: ordinal. If no: nominal.
4
Refine quantitative. Can values fall anywhere on a number line, or only at specific points? Anywhere: continuous. Specific points: discrete.

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.

1
What does it record? A numeric measurement of length.
2
Mean test: The average height \(\bar{x} = 164.7\) cm makes sense. So the variable is quantitative.
3
Discrete or continuous? Height can be \(165.21\) or \(165.215\): it takes any value in a range. Therefore it is continuous.

Example 2: Favorite Music Genre

A survey asks: "What is your favorite music genre?" Options: Pop, Rock, Hip-Hop, Classical, Jazz, Other.

1
What does it record? A group label: each person picks one category.
2
Mean test: The "average genre" is meaningless. The variable is categorical.
3
Nominal or ordinal? There is no natural ranking among genres. Pop is not inherently "greater than" Jazz. Therefore it is nominal.

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?

Classification
Categorical, nominal. The digits are arbitrary identifiers with no meaningful order or arithmetic.
Trap
Numbers that serve as labels (zip codes, phone numbers, ID numbers) are always categorical.

Example 4: Customer Satisfaction

Customers rate a product on a 5-point scale: Very Unsatisfied, Unsatisfied, Neutral, Satisfied, Very Satisfied.

1
Quantity or category? Each response is a label chosen from a set: categorical.
2
Natural order? Yes. "Very Satisfied" > "Satisfied" > "Neutral" > etc. So it is ordinal.
3
Equal gaps? No. The difference between "Very Unsatisfied" and "Unsatisfied" is not guaranteed to equal the difference between "Neutral" and "Satisfied."

Common Mistakes

✕ Numbers = Quantitative
Zip codes, jersey numbers, and Social Security numbers are categorical despite being digits. Apply the mean test.
✕ Ordinal = Quantitative
Likert scales (1-5 ratings) are ordinal, not quantitative. The gaps between levels are not guaranteed to be equal.
✕ Wrong Graph Type
Using a histogram for categorical data or a pie chart for continuous data. Match the graph to the variable type.

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?