Measurement Levels
The level of measurement (or scale of measurement) of a variable describes how much information its values carry. There are four levels, each adding a property to the one before it:
| Level | Categories? | Ordered? | Equal intervals? | True zero? | Example |
|---|---|---|---|---|---|
| Nominal | ✓ | eye colour, payment method | |||
| Ordinal | ✓ | ✓ | hotel stars, "small / medium / large" | ||
| Interval | ✓ | ✓ | ✓ | temperature in °C, calendar year | |
| Ratio | ✓ | ✓ | ✓ | ✓ | weight, income, reaction time |
Nominal and ordinal data are qualitative; interval and ratio data are quantitative.
Nominal
Values are just names. There is no natural order: "card" is not more or less than "cash". You can count and compare frequencies, and the mode is the only meaningful average.
Ordinal
Values have an order, but the gaps between them are not necessarily equal. On a survey scale very unhappy / unhappy / neutral / happy / very happy, "happy" is above "neutral", but is the step from neutral to happy the same size as from happy to very happy? We can't say. The median and percentiles are meaningful; the mean is debatable.
Interval
Differences are meaningful and equal, but zero is arbitrary. 20 °C is 10 degrees warmer than 10 °C, but it is not "twice as warm", because 0 °C is not the absence of temperature. Means and standard deviations work, ratios don't.
Ratio
Like interval, plus a true zero that means "none of it". 0 kg means no weight, so 80 kg really is twice 40 kg. Every statistic is allowed.
Why the level matters: a demonstration
The ratio trap with interval data is easy to show. Converting to Kelvin (which has a true zero) changes the "ratio" completely:
morning_c, noon_c = 10, 20
print("Celsius ratio:", noon_c / morning_c)
to_kelvin = lambda c: c + 273.15
print("Kelvin ratio: ", round(to_kelvin(noon_c) / to_kelvin(morning_c), 4))
to_fahrenheit = lambda c: c * 9 / 5 + 32
print("Fahrenheit ratio:", round(to_fahrenheit(noon_c) / to_fahrenheit(morning_c), 4))Celsius ratio: 2.0
Kelvin ratio: 1.0353
Fahrenheit ratio: 1.36
The difference of 10 °C is real; the "2× warmer" is an artefact of where Celsius puts its zero.
Ordinal data in pandas
pandas supports ordered categoricals, so sorting, comparisons and medians follow the real order instead of alphabetical order:
import pandas as pd
answers = ["neutral", "happy", "very happy", "unhappy", "happy",
"happy", "very unhappy", "neutral", "very happy", "happy"]
scale = ["very unhappy", "unhappy", "neutral", "happy", "very happy"]
mood = pd.Series(pd.Categorical(answers, categories=scale, ordered=True))
print(mood.value_counts(sort=False))
print()
print("lowest answer:", mood.min())
print("highest answer:", mood.max())
codes = mood.cat.codes # 0 = very unhappy ... 4 = very happy
median_code = int(codes.median())
print("median answer:", scale[median_code])
print("share 'happy' or better:", (mood >= "happy").mean())very unhappy 1
unhappy 1
neutral 2
happy 4
very happy 2
Name: count, dtype: int64
lowest answer: very unhappy
highest answer: very happy
median answer: happy
share 'happy' or better: 0.6
Notice that the median was computed on the codes 0–4 and then translated back into a label. That is a legitimate operation for ordinal data, because the median only needs the order.
Summary of allowed statistics
| Level | Counts & mode | Median & percentiles | Mean & std | Ratios ("twice as") |
|---|---|---|---|---|
| Nominal | ✓ | |||
| Ordinal | ✓ | ✓ | (careful) | |
| Interval | ✓ | ✓ | ✓ | |
| Ratio | ✓ | ✓ | ✓ | ✓ |
import statistics
payment = ["card", "cash", "card", "phone", "card", "cash"] # nominal
stars = [3, 4, 4, 5, 2, 4, 3] # ordinal
year_built = [1975, 1990, 2004, 2012] # interval
weight_kg = [62.0, 75.5, 81.2, 58.9] # ratio
print("nominal -> mode:", statistics.mode(payment))
print("ordinal -> median stars:", statistics.median(stars))
print("interval -> mean year:", statistics.mean(year_built))
print("ratio -> heaviest/lightest:", round(max(weight_kg) / min(weight_kg), 2))nominal -> mode: card
ordinal -> median stars: 4
interval -> mean year: 1995.25
ratio -> heaviest/lightest: 1.38
Note: In practice many researchers compute means of Likert-style scores (1–5). It can be useful, but remember it assumes equal spacing between answers, an assumption the data itself doesn't guarantee.
Test yourself
Finishing positions in a race (1st, 2nd, 3rd…) are measured at which level?
- Nominal
- Ordinal
- Interval
- Ratio
Why is temperature in °C an *interval* rather than a *ratio* variable?
- It can be negative
- Its zero point is arbitrary, not an absence of temperature
- It is measured with a thermometer
- It has decimals
Which is the most informative measure of centre for *nominal* data?
- Mean
- Median
- Mode
- Standard deviation