Categorical vs Quantitative Variables
A categorical variable sorts things into groups; a quantitative variable measures or counts an amount. One question settles most cases: would the average of the values mean anything?
Last updated
A categorical variable puts each item into a group: eye colour, favourite sport, T-shirt size. A quantitative variable is a number that measures or counts an amount: height, temperature, the number of pets in a home.
The test that settles most cases is a single question: would the average of the values mean anything? The average height of a class is a real height. The average of three eye colours is not a colour, so eye colour is categorical.
Sort the variables below. Some of them are chosen because they look like the other type.
Example values brown, blue, green, hazel
Is it categorical or quantitative?
Nothing sorted here yet.
Nothing sorted here yet.
| Type | Examples | Graph that fits |
|---|---|---|
| NominalCategorical | eye colour, blood type | Bar chart or pie chart. The order of the bars is up to you. |
| OrdinalCategorical | T-shirt size, star rating | Bar chart with the bars kept in their natural order. |
| DiscreteQuantitative | number of pets, goals scored | Dot plot, or a bar chart with one bar per value. |
| ContinuousQuantitative | height, time, temperature | Histogram or box plot. For two measured variables, a scatter plot. |
The four types
Each of the two families splits in two, and the split is where most exam questions live.
| type | family | what decides it | examples |
|---|---|---|---|
| nominal | categorical | groups with no order | eye colour, blood type, favourite sport |
| ordinal | categorical | groups with a natural order | T-shirt size, star rating, education level |
| discrete | quantitative | counted, separate values | number of pets, goals scored, children in a family |
| continuous | quantitative | measured, any value in a range | height, time, temperature, weight |
For a categorical variable, ask whether the groups have an order. Small, medium and large do; red, green and blue do not.
For a quantitative variable, ask whether you count it or measure it. You count pets, so a household has 0, 1, 2 or 3 of them and nothing in between. You measure a race time, and a finer clock can always split it further: 41.2 minutes, 41.23 minutes, 41.234 minutes.
Numbers that are really labels
The most common mistake is to call a variable quantitative because its values are written in digits.
- A zip code such as 10001 is the name of an area. Adding two zip codes gives nothing meaningful, so it is categorical and nominal.
- A jersey number tells you who a player is, not how good they are. Number 23 is not worth more than number 7.
- A phone number or a student ID is an identifier. The digits could be replaced by letters without losing any information.
The opposite trap is a scale that looks like a measurement. A 1 to 5 star rating has an order, so it is at least ordinal, but the gap between 1 star and 2 stars is not a fixed amount of anything. Statisticians call it ordinal. Many websites average ratings anyway, which is a choice to treat them as numbers, not a fact about them.
Which graph fits
The type of variable decides the chart, which is the practical reason to learn any of this.
| type | graph that fits | why |
|---|---|---|
| nominal | bar chart, pie chart | you are comparing the size of groups |
| ordinal | bar chart in the natural order | the order carries information, so keep it |
| discrete | dot plot, bar chart with one bar per value | each value is a separate count |
| continuous | histogram, box plot | values are grouped into ranges on a number line |
| two quantitative variables | scatter plot | each point is one pair of measurements |
A histogram of eye colours makes no sense, because the bars of a histogram sit on a number line and eye colours have no place on one. A pie chart of heights makes no sense either: heights are not parts of a whole.
When both variables are quantitative, a scatter plot shows how they move together, and the correlation coefficient puts a number on how closely.
Worked example: classifying a survey
A school asks every student five questions. Here is each answer classified.
| question | type | reason |
|---|---|---|
| How many minutes do you spend on homework each night? | quantitative, continuous | time is measured |
| How many siblings do you have? | quantitative, discrete | siblings are counted |
| Which is your favourite subject? | categorical, nominal | subjects have no order |
| How much do you enjoy maths: not at all, a little, a lot? | categorical, ordinal | the answers have an order |
| What is your home zip code? | categorical, nominal | a zip code is a label |
The survey would report the average homework time and the average number of siblings, and a count or a percentage for each of the other three.
One thing, recorded two ways
The type belongs to how a variable is recorded, not to the thing itself. The same fact can be collected as a number or as a group:
- Age in years is quantitative. Age recorded as the band 18 to 24, 25 to 34, 35 to 44 is categorical and ordinal.
- Income in dollars is quantitative. Income recorded as low, middle or high is ordinal.
- Temperature in degrees is quantitative. Temperature recorded as cold, mild or hot is ordinal.
Recording the number keeps more information: you can always put numbers into bands later, but you can never get the exact numbers back from the bands.
Common questions
- Is age categorical or quantitative?
- Age in years is quantitative: it is an amount of time, and an average age means something. It is usually treated as continuous, because time can be split as finely as you like, even though surveys round it to whole years. Age becomes categorical only when it is recorded in bands such as 18 to 24 and 25 to 34, and then it is ordinal, because the bands have an order.
- Is a zip code categorical or quantitative?
- Categorical, and nominal. A zip code is written in digits, but it is a label for an area. The average of two zip codes is not a place, and a larger zip code is not more of anything. The same goes for phone numbers, jersey numbers and ID numbers.
- What is the difference between qualitative and quantitative data?
- Qualitative is another name for categorical. Qualitative data describes a quality or a group, such as a colour, a brand or a yes or no answer. Quantitative data is a number that measures or counts something, such as a height, a price or the number of pets in a home.
- Is a rating from 1 to 5 ordinal or quantitative?
- Strictly it is ordinal: the ratings have an order, but nothing makes the step from 1 to 2 the same size as the step from 4 to 5. In practice many analyses average ratings anyway, which treats them as quantitative. If you do that, say so, because the average assumes the steps are equal.
- What graph should I use for categorical data?
- A bar chart, or a pie chart when the categories are parts of one whole. For ordinal data keep the bars in their natural order rather than sorting them by height. Histograms, box plots and scatter plots are for quantitative data and do not work for categories.
- What is the difference between discrete and continuous variables?
- Both are quantitative. A discrete variable is counted and jumps between separate values, like the number of goals in a match. A continuous variable is measured and can take any value in a range, like a time or a temperature. A quick test: if a value halfway between two possible values makes sense, the variable is continuous.